mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 14:23:38 +00:00
luci-app-ssr-plus: add subscribe auto-switch setting
This commit is contained in:
parent
06f2f56860
commit
25dd637650
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-ssr-plus
|
||||
PKG_VERSION:=147
|
||||
PKG_VERSION:=148
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
@ -41,10 +41,16 @@ o.write = function()
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "servers"))
|
||||
end
|
||||
|
||||
o = s:option(Flag, "switch", translate("Subscribe Default Auto-Switch"))
|
||||
o.rmempty = false
|
||||
o.description = translate("Subscribe new add server default Auto-Switch on")
|
||||
o.default="1"
|
||||
|
||||
o = s:option(Flag, "proxy", translate("Through proxy update"))
|
||||
o.rmempty = false
|
||||
o.description = translate("Through proxy update list, Not Recommended ")
|
||||
|
||||
|
||||
o = s:option(Button,"subscribe", translate("Update All Subscribe Severs"))
|
||||
o.rawhtml = true
|
||||
o.template = "shadowsocksr/subscribe"
|
||||
|
@ -570,3 +570,9 @@ msgstr "当前证书路径"
|
||||
|
||||
msgid "Please confirm the current certificate path"
|
||||
msgstr "请选择确认所传证书,证书不正确将无法运行"
|
||||
|
||||
msgid "Subscribe Default Auto-Switch"
|
||||
msgstr "订阅新节点自动切换设置"
|
||||
|
||||
msgid "Subscribe new add server default Auto-Switch on"
|
||||
msgstr "订阅加入的新节点默认开启自动切换"
|
||||
|
@ -21,6 +21,7 @@ local name = 'shadowsocksr'
|
||||
local uciType = 'servers'
|
||||
local ucic = luci.model.uci.cursor()
|
||||
local proxy = ucic:get_first(name, 'server_subscribe', 'proxy', '0')
|
||||
local switch = ucic:get_first(name, 'server_subscribe', 'switch', '1')
|
||||
local subscribe_url = ucic:get_first(name, 'server_subscribe', 'subscribe_url', {})
|
||||
|
||||
local log = function(...)
|
||||
@ -337,19 +338,14 @@ local execute = function()
|
||||
log('忽略手动添加的节点: ' .. old.alias)
|
||||
end
|
||||
|
||||
-- 保留原有节点的自动切换设置
|
||||
|
||||
if(old.switch_enable)
|
||||
then
|
||||
nodeResult.switch_enable = old.switch_enable
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
for k, v in ipairs(nodeResult) do
|
||||
for kk, vv in ipairs(v) do
|
||||
if not vv._ignore then
|
||||
local section = ucic:add(name, uciType)
|
||||
ucic:tset(name, section, vv)
|
||||
ucic:set(name, section, "switch_enable", switch)
|
||||
add = add + 1
|
||||
end
|
||||
|
||||
@ -389,4 +385,3 @@ if subscribe_url and #subscribe_url > 0 then
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user