瀏覽代碼

/providers: update ip assignment only if requested by query parameter

Helge Jung 9 年之前
父節點
當前提交
09affcb812
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      ffstatus/server.py

+ 2 - 1
ffstatus/server.py

@@ -455,6 +455,7 @@ class BatcaveHttpRequestHandler(BaseHTTPRequestHandler):
 
 		isps = {}
 		vpnstorage_updated = False
+		vpnstorage_update_allowed = 'update' in query and query['update'] == 'allowed'
 		for key in vpn:
 			if key is None: continue
 			item = vpn[key]
@@ -465,7 +466,7 @@ class BatcaveHttpRequestHandler(BaseHTTPRequestHandler):
 			for gw in item['active']:
 				if 'remote' in item['active'][gw]:
 					ip = item['active'][gw]['remote']
-					if not isinstance(ip, dict):
+					if vpnstorage_update_allowed and not isinstance(ip, dict):
 						# try to resolve ip now
 						resolved = ffstatus.resolve_ipblock(ip)
 						if not resolved is None: