diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index ffee7c6c7..85955cc92 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall -PKG_VERSION:=4.71-3 +PKG_VERSION:=4.72-1 PKG_RELEASE:= PKG_CONFIG_DEPENDS:= \ diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua index 5024e871c..7d6ebf8bf 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua @@ -6,27 +6,46 @@ local has_trojan_plus = api.is_finded("trojan-plus") local has_singbox = api.finded_com("singbox") local has_xray = api.finded_com("xray") local has_trojan_go = api.finded_com("trojan-go") +local has_hysteria2 = api.finded_com("hysteria") local ss_aead_type = {} local trojan_type = {} +local vmess_type = {} +local vless_type = {} +local hysteria2_type = {} if has_ss then - ss_aead_type[#ss_aead_type + 1] = "shadowsocks-libev" + local s = "shadowsocks-libev" + table.insert(ss_aead_type, s) end if has_ss_rust then - ss_aead_type[#ss_aead_type + 1] = "shadowsocks-rust" + local s = "shadowsocks-rust" + table.insert(ss_aead_type, s) end if has_trojan_plus then - trojan_type[#trojan_type + 1] = "trojan-plus" + local s = "trojan-plus" + table.insert(trojan_type, s) end if has_singbox then - trojan_type[#trojan_type + 1] = "sing-box" - ss_aead_type[#ss_aead_type + 1] = "sing-box" + local s = "sing-box" + table.insert(trojan_type, s) + table.insert(ss_aead_type, s) + table.insert(vmess_type, s) + table.insert(vless_type, s) + table.insert(hysteria2_type, s) end if has_xray then - trojan_type[#trojan_type + 1] = "xray" - ss_aead_type[#ss_aead_type + 1] = "xray" + local s = "xray" + table.insert(trojan_type, s) + table.insert(ss_aead_type, s) + table.insert(vmess_type, s) + table.insert(vless_type, s) end if has_trojan_go then - trojan_type[#trojan_type + 1] = "trojan-go" + local s = "trojan-go" + table.insert(trojan_type, s) +end +if has_hysteria2 then + local s = "hysteria2" + table.insert(hysteria2_type, s) end m = Map(appname) @@ -48,16 +67,46 @@ o = s:option(DynamicList, "filter_discard_list", translate("Discard List")) o = s:option(DynamicList, "filter_keep_list", translate("Keep List")) if #ss_aead_type > 0 then - o = s:option(ListValue, "ss_aead_type", translate("SS AEAD Node Use Type")) + o = s:option(ListValue, "ss_aead_type", translatef("%s Node Use Type", "SS AEAD")) for key, value in pairs(ss_aead_type) do - o:value(value, translate(value:gsub("^%l",string.upper))) + o:value(value) end end if #trojan_type > 0 then - o = s:option(ListValue, "trojan_type", translate("Trojan Node Use Type")) + o = s:option(ListValue, "trojan_type", translatef("%s Node Use Type", "Trojan")) for key, value in pairs(trojan_type) do - o:value(value, translate(value:gsub("^%l",string.upper))) + o:value(value) + end +end + +if #vmess_type > 0 then + o = s:option(ListValue, "vmess_type", translatef("%s Node Use Type", "VMess")) + for key, value in pairs(vmess_type) do + o:value(value) + end + if has_xray then + o.default = "xray" + end +end + +if #vless_type > 0 then + o = s:option(ListValue, "vless_type", translatef("%s Node Use Type", "VLESS")) + for key, value in pairs(vless_type) do + o:value(value) + end + if has_xray then + o.default = "xray" + end +end + +if #hysteria2_type > 0 then + o = s:option(ListValue, "hysteria2_type", translatef("%s Node Use Type", "Hysteria2")) + for key, value in pairs(hysteria2_type) do + o:value(value) + end + if has_hysteria2 then + o.default = "hysteria2" end end diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua index 203f2e5ea..53ff9535d 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua @@ -1,33 +1,51 @@ local api = require "luci.passwall.api" local appname = api.appname -local sys = api.sys local has_ss = api.is_finded("ss-redir") local has_ss_rust = api.is_finded("sslocal") local has_trojan_plus = api.is_finded("trojan-plus") local has_singbox = api.finded_com("singbox") local has_xray = api.finded_com("xray") local has_trojan_go = api.finded_com("trojan-go") +local has_hysteria2 = api.finded_com("hysteria") local ss_aead_type = {} local trojan_type = {} +local vmess_type = {} +local vless_type = {} +local hysteria2_type = {} if has_ss then - ss_aead_type[#ss_aead_type + 1] = "shadowsocks-libev" + local s = "shadowsocks-libev" + table.insert(ss_aead_type, s) end if has_ss_rust then - ss_aead_type[#ss_aead_type + 1] = "shadowsocks-rust" + local s = "shadowsocks-rust" + table.insert(ss_aead_type, s) end if has_trojan_plus then - trojan_type[#trojan_type + 1] = "trojan-plus" + local s = "trojan-plus" + table.insert(trojan_type, s) end if has_singbox then - trojan_type[#trojan_type + 1] = "sing-box" - ss_aead_type[#ss_aead_type + 1] = "sing-box" + local s = "sing-box" + table.insert(trojan_type, s) + table.insert(ss_aead_type, s) + table.insert(vmess_type, s) + table.insert(vless_type, s) + table.insert(hysteria2_type, s) end if has_xray then - trojan_type[#trojan_type + 1] = "xray" - ss_aead_type[#ss_aead_type + 1] = "xray" + local s = "xray" + table.insert(trojan_type, s) + table.insert(ss_aead_type, s) + table.insert(vmess_type, s) + table.insert(vless_type, s) end if has_trojan_go then - trojan_type[#trojan_type + 1] = "trojan-go" + local s = "trojan-go" + table.insert(trojan_type, s) +end +if has_hysteria2 then + local s = "hysteria2" + table.insert(hysteria2_type, s) end m = Map(appname) @@ -69,20 +87,47 @@ o:depends("filter_keyword_mode", "3") o:depends("filter_keyword_mode", "4") if #ss_aead_type > 0 then - o = s:option(ListValue, "ss_aead_type", translate("SS AEAD Node Use Type")) + o = s:option(ListValue, "ss_aead_type", translatef("%s Node Use Type", "SS AEAD")) o.default = "global" o:value("global", translate("Use global config")) for key, value in pairs(ss_aead_type) do - o:value(value, translate(value:gsub("^%l",string.upper))) + o:value(value) end end if #trojan_type > 0 then - o = s:option(ListValue, "trojan_type", translate("Trojan Node Use Type")) + o = s:option(ListValue, "trojan_type", translatef("%s Node Use Type", "Trojan")) o.default = "global" o:value("global", translate("Use global config")) for key, value in pairs(trojan_type) do - o:value(value, translate(value:gsub("^%l",string.upper))) + o:value(value) + end +end + +if #vmess_type > 0 then + o = s:option(ListValue, "vmess_type", translatef("%s Node Use Type", "VMess")) + o.default = "global" + o:value("global", translate("Use global config")) + for key, value in pairs(vmess_type) do + o:value(value) + end +end + +if #vless_type > 0 then + o = s:option(ListValue, "vless_type", translatef("%s Node Use Type", "VLESS")) + o.default = "global" + o:value("global", translate("Use global config")) + for key, value in pairs(vless_type) do + o:value(value) + end +end + +if #hysteria2_type > 0 then + o = s:option(ListValue, "hysteria2_type", translatef("%s Node Use Type", "Hysteria2")) + o.default = "global" + o:value("global", translate("Use global config")) + for key, value in pairs(hysteria2_type) do + o:value(value) end end diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua index 881ba29cf..1ceb9e821 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua @@ -200,6 +200,20 @@ if has_singbox then o.default = "https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db" o:value("https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db") o.rmempty = false + + o = s:option(Button, "_remove_resource", translate("Remove resource files")) + o.description = translate("Sing-Box will automatically download resource files when starting, you can use this feature achieve upgrade resource files.") + o.inputstyle = "remove" + function o.write(self, section, value) + local geoip_path = s.fields["geoip_path"] and s.fields["geoip_path"]:formvalue(section) or nil + if geoip_path then + os.remove(geoip_path) + end + local geosite_path = s.fields["geosite_path"] and s.fields["geosite_path"]:formvalue(section) or nil + if geosite_path then + os.remove(geosite_path) + end + end end return m diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua index a4c0be587..d936711b7 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua @@ -19,6 +19,87 @@ protocol:value("http") protocol:value("tls") protocol:value("bittorrent") +o = s:option(MultiValue, "inbound", translate("Inbound Tag")) +o:value("tproxy", translate("Transparent proxy")) +o:value("socks", "Socks") + +network = s:option(ListValue, "network", translate("Network")) +network:value("tcp,udp", "TCP UDP") +network:value("tcp", "TCP") +network:value("udp", "UDP") + +source = s:option(DynamicList, "source", translate("Source")) +source.description = "