advanced.lua 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. local uci = luci.model.uci.cursor()
  2. local server_table = {}
  3. uci:foreach("shadowsocksr", "servers", function(s)
  4. if s.alias then
  5. server_table[s[".name"]] = "[%s]:%s" % {string.upper(s.v2ray_protocol or s.type), s.alias}
  6. elseif s.server and s.server_port then
  7. server_table[s[".name"]] = "[%s]:%s:%s" % {string.upper(s.v2ray_protocol or s.type), s.server, s.server_port}
  8. end
  9. end)
  10. local key_table = {}
  11. for key, _ in pairs(server_table) do
  12. table.insert(key_table, key)
  13. end
  14. table.sort(key_table)
  15. m = Map("shadowsocksr")
  16. -- [[ global ]]--
  17. s = m:section(TypedSection, "global", translate("Server failsafe auto swith and custom update settings"))
  18. s.anonymous = true
  19. -- o = s:option(Flag, "monitor_enable", translate("Enable Process Deamon"))
  20. -- o.rmempty = false
  21. -- o.default = "1"
  22. o = s:option(Flag, "enable_switch", translate("Enable Auto Switch"))
  23. o.rmempty = false
  24. o.default = "1"
  25. o = s:option(Value, "switch_time", translate("Switch check cycly(second)"))
  26. o.datatype = "uinteger"
  27. o:depends("enable_switch", "1")
  28. o.default = 667
  29. o = s:option(Value, "switch_timeout", translate("Check timout(second)"))
  30. o.datatype = "uinteger"
  31. o:depends("enable_switch", "1")
  32. o.default = 5
  33. o = s:option(Value, "switch_try_count", translate("Check Try Count"))
  34. o.datatype = "uinteger"
  35. o:depends("enable_switch", "1")
  36. o.default = 3
  37. o = s:option(Value, "gfwlist_url", translate("gfwlist Update url"))
  38. o:value("https://fastly.jsdelivr.net/gh/YW5vbnltb3Vz/domain-list-community@release/gfwlist.txt", translate("v2fly/domain-list-community"))
  39. o:value("https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/gfw.txt", translate("Loyalsoldier/v2ray-rules-dat"))
  40. o:value("https://fastly.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt", translate("Loukky/gfwlist-by-loukky"))
  41. o:value("https://fastly.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt", translate("gfwlist/gfwlist"))
  42. o.default = "https://fastly.jsdelivr.net/gh/YW5vbnltb3Vz/domain-list-community@release/gfwlist.txt"
  43. o = s:option(Value, "chnroute_url", translate("Chnroute Update url"))
  44. o:value("https://ispip.clang.cn/all_cn.txt", translate("Clang.CN"))
  45. o:value("https://ispip.clang.cn/all_cn_cidr.txt", translate("Clang.CN.CIDR"))
  46. o:value("https://fastly.jsdelivr.net/gh/gaoyifan/china-operator-ip@ip-lists/china.txt", translate("china-operator-ip"))
  47. o.default = "https://ispip.clang.cn/all_cn.txt"
  48. o = s:option(Flag, "netflix_enable", translate("Enable Netflix Mode"))
  49. o.rmempty = false
  50. o = s:option(Value, "nfip_url", translate("nfip_url"))
  51. o:value("https://fastly.jsdelivr.net/gh/QiuSimons/Netflix_IP/NF_only.txt", translate("Netflix IP Only"))
  52. o:value("https://fastly.jsdelivr.net/gh/QiuSimons/Netflix_IP/getflix.txt", translate("Netflix and AWS"))
  53. o.default = "https://fastly.jsdelivr.net/gh/QiuSimons/Netflix_IP/NF_only.txt"
  54. o.description = translate("Customize Netflix IP Url")
  55. o:depends("netflix_enable", "1")
  56. o = s:option(Flag, "adblock", translate("Enable adblock"))
  57. o.rmempty = false
  58. o = s:option(Value, "adblock_url", translate("adblock_url"))
  59. o:value("https://raw.githubusercontent.com/neodevpro/neodevhost/master/lite_dnsmasq.conf", translate("NEO DEV HOST Lite"))
  60. o:value("https://raw.githubusercontent.com/neodevpro/neodevhost/master/dnsmasq.conf", translate("NEO DEV HOST Full"))
  61. o:value("https://anti-ad.net/anti-ad-for-dnsmasq.conf", translate("anti-AD"))
  62. o.default = "https://raw.githubusercontent.com/neodevpro/neodevhost/master/lite_dnsmasq.conf"
  63. o:depends("adblock", "1")
  64. o.description = translate("Support AdGuardHome and DNSMASQ format list")
  65. o = s:option(Button, "reset", translate("Reset to defaults"))
  66. o.rawhtml = true
  67. o.template = "shadowsocksr/reset"
  68. -- [[ SOCKS5 Proxy ]]--
  69. s = m:section(TypedSection, "socks5_proxy", translate("Global SOCKS5 Proxy Server"))
  70. s.anonymous = true
  71. o = s:option(ListValue, "server", translate("Server"))
  72. o:value("nil", translate("Disable"))
  73. o:value("same", translate("Same as Global Server"))
  74. for _, key in pairs(key_table) do
  75. o:value(key, server_table[key])
  76. end
  77. o.default = "nil"
  78. o.rmempty = false
  79. o = s:option(Value, "local_port", translate("Local Port"))
  80. o.datatype = "port"
  81. o.default = 1080
  82. o.rmempty = false
  83. return m