advanced.lua 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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://cdn.jsdelivr.net/gh/YW5vbnltb3Vz/domain-list-community@release/gfwlist.txt", translate("v2fly/domain-list-community"))
  39. o:value("https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/gfw.txt", translate("Loyalsoldier/v2ray-rules-dat"))
  40. o:value("https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt", translate("Loukky/gfwlist-by-loukky"))
  41. o:value("https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt", translate("gfwlist/gfwlist"))
  42. o.default = "https://cdn.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.default = "https://ispip.clang.cn/all_cn.txt"
  47. o = s:option(Flag, "netflix_enable", translate("Enable Netflix Mode"))
  48. o.rmempty = false
  49. o = s:option(Value, "nfip_url", translate("nfip_url"))
  50. o:value("https://cdn.jsdelivr.net/gh/QiuSimons/Netflix_IP/NF_only.txt", translate("Netflix IP Only"))
  51. o:value("https://cdn.jsdelivr.net/gh/QiuSimons/Netflix_IP/getflix.txt", translate("Netflix and AWS"))
  52. o.default = "https://cdn.jsdelivr.net/gh/QiuSimons/Netflix_IP/NF_only.txt"
  53. o.description = translate("Customize Netflix IP Url")
  54. o:depends("netflix_enable", "1")
  55. o = s:option(Flag, "adblock", translate("Enable adblock"))
  56. o.rmempty = false
  57. o = s:option(Value, "adblock_url", translate("adblock_url"))
  58. o:value("https://raw.githubusercontent.com/neodevpro/neodevhost/master/lite_dnsmasq.conf", translate("NEO DEV HOST Lite"))
  59. o:value("https://raw.githubusercontent.com/neodevpro/neodevhost/master/dnsmasq.conf", translate("NEO DEV HOST Full"))
  60. o:value("https://anti-ad.net/anti-ad-for-dnsmasq.conf", translate("anti-AD"))
  61. o.default = "https://raw.githubusercontent.com/neodevpro/neodevhost/master/lite_dnsmasq.conf"
  62. o:depends("adblock", "1")
  63. o.description = translate("Support AdGuardHome and DNSMASQ format list")
  64. o = s:option(Button, "reset", translate("Reset to defaults"))
  65. o.rawhtml = true
  66. o.template = "shadowsocksr/reset"
  67. -- [[ SOCKS5 Proxy ]]--
  68. s = m:section(TypedSection, "socks5_proxy", translate("Global SOCKS5 Proxy Server"))
  69. s.anonymous = true
  70. o = s:option(ListValue, "server", translate("Server"))
  71. o:value("nil", translate("Disable"))
  72. o:value("same", translate("Same as Global Server"))
  73. for _, key in pairs(key_table) do
  74. o:value(key, server_table[key])
  75. end
  76. o.default = "nil"
  77. o.rmempty = false
  78. o = s:option(Value, "local_port", translate("Local Port"))
  79. o.datatype = "port"
  80. o.default = 1080
  81. o.rmempty = false
  82. return m