2
0
Quellcode durchsuchen

/vpn accepts an optional 'ts' parameter with seconds_since_epoch as value

Helge Jung vor 10 Jahren
Ursprung
Commit
755cb1f117
1 geänderte Dateien mit 3 neuen und 2 gelöschten Zeilen
  1. 3 2
      ffstatus/server.py

+ 3 - 2
ffstatus/server.py

@@ -335,6 +335,7 @@ class BatcaveHttpRequestHandler(BaseHTTPRequestHandler):
 		action = query['action'] if 'action' in query else None
 		remote = query['remote'] if 'remote' in query else None
 		gw = query['gw'] if 'gw' in query else None
+		ts = query['ts'] if 'ts' in query else time.time()
 
 		if action == 'list':
 			self.respond_vpnlist()
@@ -371,7 +372,7 @@ class BatcaveHttpRequestHandler(BaseHTTPRequestHandler):
 
 		if action == 'establish':
 			item['active'][gw] = {
-				'establish': time.time(),
+				'establish': ts,
 				'peer': peername,
 				'remote': remote,
 				'remote_raw': remote_raw,
@@ -382,7 +383,7 @@ class BatcaveHttpRequestHandler(BaseHTTPRequestHandler):
 			if gw in item['active']:
 				active = item['active'][gw]
 				del(item['active'][gw])
-			active['disestablish'] = time.time()
+			active['disestablish'] = ts
 			item['last'][gw] = active
 		else:
 			self.send_error(500, 'Unknown action not filtered (' + str(action) + ')')