From 07b21f577a7ea498d035e4e53b90fa95151acab6 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Sun, 14 Jun 2020 00:48:20 +0800 Subject: [PATCH] Don't re-enable node after manually disable service --- luci-app-ssr-plus/Makefile | 4 +-- .../root/etc/config/shadowsocksr | 2 +- .../root/usr/share/shadowsocksr/subscribe.lua | 36 ++++++++++--------- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/luci-app-ssr-plus/Makefile b/luci-app-ssr-plus/Makefile index 47c6b328..809c697f 100644 --- a/luci-app-ssr-plus/Makefile +++ b/luci-app-ssr-plus/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ssr-plus -PKG_VERSION:=178 -PKG_RELEASE:=7 +PKG_VERSION:=179 +PKG_RELEASE:=1 include $(INCLUDE_DIR)/package.mk diff --git a/luci-app-ssr-plus/root/etc/config/shadowsocksr b/luci-app-ssr-plus/root/etc/config/shadowsocksr index 15c79fef..29311531 100644 --- a/luci-app-ssr-plus/root/etc/config/shadowsocksr +++ b/luci-app-ssr-plus/root/etc/config/shadowsocksr @@ -15,7 +15,7 @@ config global option nfip_url 'https://cdn.jsdelivr.net/gh/QiuSimons/Netflix_IP/NF_only.txt' option adblock_url 'https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf' option threads '0' - option global_server 'nil' + option global_server 'disable' option netflix_server 'nil' option netflix_proxy '0' diff --git a/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua b/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua index 79588bb7..498ae3a0 100644 --- a/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua +++ b/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua @@ -415,23 +415,25 @@ local execute = function() ucic:commit(name) -- 如果原有服务器节点已经不见了就尝试换为第一个节点 local globalServer = ucic:get_first(name, 'global', 'global_server', '') - local firstServer = ucic:get_first(name, uciType) - if firstServer then - if not ucic:get(name, globalServer) then - luci.sys.call("/etc/init.d/" .. name .. " stop > /dev/null 2>&1 &") - ucic:commit(name) - ucic:set(name, ucic:get_first(name, 'global'), 'global_server', ucic:get_first(name, uciType)) - ucic:commit(name) - log('当前主服务器节点已被删除,正在自动更换为第一个节点。') - luci.sys.call("/etc/init.d/" .. name .. " start > /dev/null 2>&1 &") - else - log('维持当前主服务器节点。') - luci.sys.call("/etc/init.d/" .. name .." restart > /dev/null 2>&1 &") - end - else - log('没有服务器节点了,停止服务') - luci.sys.call("/etc/init.d/" .. name .. " stop > /dev/null 2>&1 &") - end + if globalServer ~= "nil" then + local firstServer = ucic:get_first(name, uciType) + if firstServer then + if not ucic:get(name, globalServer) then + luci.sys.call("/etc/init.d/" .. name .. " stop > /dev/null 2>&1 &") + ucic:commit(name) + ucic:set(name, ucic:get_first(name, 'global'), 'global_server', ucic:get_first(name, uciType)) + ucic:commit(name) + log('当前主服务器节点已被删除,正在自动更换为第一个节点。') + luci.sys.call("/etc/init.d/" .. name .. " start > /dev/null 2>&1 &") + else + log('维持当前主服务器节点。') + luci.sys.call("/etc/init.d/" .. name .." restart > /dev/null 2>&1 &") + end + else + log('没有服务器节点了,停止服务') + luci.sys.call("/etc/init.d/" .. name .. " stop > /dev/null 2>&1 &") + end + end log('新增节点数量: ' ..add, '删除节点数量: ' .. del) log('订阅更新成功') end