advanced.lua 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.type), s.alias}
  6. elseif s.server and s.server_port then
  7. server_table[s[".name"]] = "[%s]:%s:%s" % {string.upper(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(Flag, "adblock", translate("Enable adblock"))
  38. o.rmempty = false
  39. o = s:option(Value, "adblock_url", translate("adblock_url"))
  40. o:value("https://ghproxy.com/https://raw.githubusercontent.com/neodevpro/neodevhost/master/lite_host_dnsmasq.conf", translate("NEO DEV HOST Lite"))
  41. o:value("https://ghproxy.com/https://raw.githubusercontent.com/neodevpro/neodevhost/master/host_dnsmasq.conf", translate("NEO DEV HOST Full"))
  42. o:value("https://ghproxy.com/https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/adblock-for-dnsmasq.conf", translate("anti-AD"))
  43. o.default = "https://ghproxy.com/https://raw.githubusercontent.com/neodevpro/neodevhost/master/lite_host_dnsmasq.conf"
  44. o:depends("adblock", "1")
  45. o.description = translate("Support AdGuardHome and DNSMASQ format list")
  46. o = s:option(Value, "gfwlist_url", translate("gfwlist Update url"))
  47. o:value("https://ghproxy.com/https://raw.githubusercontent.com/YW5vbnltb3Vz/domain-list-community/release/gfwlist.txt", translate("v2fly/domain-list-community"))
  48. o:value("https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/gfw.txt", translate("Loyalsoldier/v2ray-rules-dat"))
  49. o:value("https://ghproxy.com/https://raw.githubusercontent.com/Loukky/gfwlist-by-loukky/master/gfwlist.txt", translate("Loukky/gfwlist-by-loukky"))
  50. o:value("https://ghproxy.com/https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt", translate("gfwlist/gfwlist"))
  51. o.default = "https://ghproxy.com/https://raw.githubusercontent.com/YW5vbnltb3Vz/domain-list-community/release/gfwlist.txt"
  52. o = s:option(Value, "chnroute_url", translate("Chnroute Update url"))
  53. o:value("https://ispip.clang.cn/all_cn.txt", translate("Clang.CN"))
  54. o:value("https://ispip.clang.cn/all_cn_cidr.txt", translate("Clang.CN.CIDR"))
  55. o.default = "https://ispip.clang.cn/all_cn.txt"
  56. o = s:option(Value, "nfip_url", translate("nfip_url"))
  57. o:value("https://ghproxy.com/https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt", translate("Netflix IP Only"))
  58. o:value("https://ghproxy.com/https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/getflix.txt", translate("Netflix and AWS"))
  59. o.default = "https://ghproxy.com/https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt"
  60. o.description = translate("Customize Netflix IP Url")
  61. o = s:option(Button, "reset", translate("Reset to defaults"))
  62. o.rawhtml = true
  63. o.template = "shadowsocksr/reset"
  64. -- [[ SOCKS5 Proxy ]]--
  65. s = m:section(TypedSection, "socks5_proxy", translate("Global SOCKS5 Proxy Server"))
  66. s.anonymous = true
  67. o = s:option(ListValue, "server", translate("Server"))
  68. o:value("nil", translate("Disable"))
  69. o:value("same", translate("Same as Global Server"))
  70. for _, key in pairs(key_table) do
  71. o:value(key, server_table[key])
  72. end
  73. o.default = "nil"
  74. o.rmempty = false
  75. o = s:option(Value, "local_port", translate("Local Port"))
  76. o.datatype = "port"
  77. o.default = 1080
  78. o.rmempty = false
  79. return m