1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Separate XRay and V2Ray key in wizard, add V2Ray/XRay UDP activation in Wizard page

This commit is contained in:
Ycarus (Yannick Chabanois) 2024-11-15 17:30:15 +01:00
parent 0b3b88ab95
commit d4e18ee799
2 changed files with 42 additions and 8 deletions

View file

@ -1076,6 +1076,14 @@ function wizard_add()
luci.sys.call("/etc/init.d/shadowsocks-rust rules_down >/dev/null 2>/dev/null")
end
-- Enable/disable v2ray/xray udp
local v2rayudp = luci.http.formvalue("v2rayudp") or "0"
ucic:set("v2ray","main_transparent_proxy","redirect_udp",v2rayudp)
ucic:save("v2ray")
ucic:commit("v2ray")
ucic:set("xray","main_transparent_proxy","redirect_udp",v2rayudp)
ucic:save("xray")
ucic:commit("xray")
local v2ray_user = luci.http.formvalue("v2ray_user")
ucic:set("v2ray","omrout","s_vmess_user_id",v2ray_user)
@ -1084,13 +1092,15 @@ function wizard_add()
ucic:set("v2ray","omrout","s_socks_user_id",v2ray_user)
ucic:save("v2ray")
ucic:commit("v2ray")
ucic:set("xray","omrout","s_vmess_user_id",v2ray_user)
ucic:set("xray","omrout","s_vless_user_id",v2ray_user)
ucic:set("xray","omrout","s_vless_reality_user_id",v2ray_user)
ucic:set("xray","omrout","s_trojan_user_id",v2ray_user)
ucic:set("xray","omrout","s_socks_user_id",v2ray_user)
local xray_user = luci.http.formvalue("xray_user")
ucic:set("xray","omrout","s_vmess_user_id",xray_user)
ucic:set("xray","omrout","s_vless_user_id",xray_user)
ucic:set("xray","omrout","s_vless_reality_user_id",xray_user)
ucic:set("xray","omrout","s_trojan_user_id",xray_user)
ucic:set("xray","omrout","s_socks_user_id",xray_user)
ucic:save("xray")
ucic:commit("xray")
ucic:save("shadowsocks-libev")
ucic:commit("shadowsocks-libev")
ucic:save("shadowsocks-rust")

View file

@ -321,18 +321,42 @@
</div>
</div>
<% end %>
<% if nixio.fs.access("/etc/init.d/v2ray") or nixio.fs.access("/etc/init.d/xray") then %>
<% if nixio.fs.access("/etc/init.d/v2ray") then %>
<div class="cbi-value">
<label class="cbi-value-title"><%:V2Ray/XRay user id%></label>
<label class="cbi-value-title"><%:V2Ray user id%></label>
<div class="cbi-value-field">
<input type="text" name="v2ray_user" placeholder="<%:V2Ray user%>" class="cbi-input-text" value="<%=uci:get("v2ray","omrout","s_vmess_user_id")%>" />
<br />
<div class="cbi-value-description">
<%:Key is retrieved from server API by default.%> <%:V2Ray is used for TCP and UDP.%>
<%:Key is retrieved from server API by default.%>
</div>
</div>
</div>
<% end %>
<% if nixio.fs.access("/etc/init.d/xray") then %>
<div class="cbi-value">
<label class="cbi-value-title"><%:XRay user id%></label>
<div class="cbi-value-field">
<input type="text" name="xray_user" placeholder="<%:XRay user%>" class="cbi-input-text" value="<%=uci:get("xray","omrout","s_vmess_user_id")%>" />
<br />
<div class="cbi-value-description">
<%:Key is retrieved from server API by default.%>
</div>
</div>
</div>
<% end %>
<% if nixio.fs.access("/etc/init.d/xray") or nixio.fs.access("/etc/init.d/v2ray") then %>
<div class="cbi-value">
<label class="cbi-value-title"><%:V2Ray/XRay UDP%></label>
<div class="cbi-value-field">
<input type="checkbox" name="v2rayudp" class="cbi-input-checkbox" value="1" <% if luci.model.uci.cursor():get("v2ray","main_transparent_proxy","redirect_udp") == "1" or luci.model.uci.cursor():get("xray","main_transparent_proxy","redirect_udp") == "1" then %>checked<% end %>>
<br />
<div class="cbi-value-description">
<%:When proxy V2Ray/XRay VLESS, VMESS or Trojan is used, use it for UDP%>
</div>
</div>
</div>
<% end %>
<div class="cbi-value">
<label class="cbi-value-title"><%:Encryption%></label>
<div class="cbi-value-field">