Procházet zdrojové kódy

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

Helge Jung před 9 roky
rodič
revize
09affcb812
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  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: