소스 검색

Don't re-enable node after manually disable service

coolsnowwolf 5 년 전
부모
커밋
07b21f577a
3개의 변경된 파일22개의 추가작업 그리고 20개의 파일을 삭제
  1. 2 2
      luci-app-ssr-plus/Makefile
  2. 1 1
      luci-app-ssr-plus/root/etc/config/shadowsocksr
  3. 19 17
      luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua

+ 2 - 2
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
 

+ 1 - 1
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'
 

+ 19 - 17
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