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 0838d86b9..37fc38afb 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) @@ -47,16 +66,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 62fd2ee8f..e7062877c 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) @@ -68,20 +86,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/view/passwall/node_list/link_share_man.htm b/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm index 8e78f726f..12fdebe6b 100644 --- a/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm +++ b/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm @@ -5,6 +5,7 @@ local api = require "luci.passwall.api"