From 136fde4a7e9a2da96f7129b2dff3ebab40cecb3d Mon Sep 17 00:00:00 2001 From: none Date: Mon, 26 Feb 2024 13:26:16 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=B2=D1=81=D0=B5=D1=85=20=D1=81=D0=B0=D0=B9=D1=82?= =?UTF-8?q?=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- network.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/network.py b/network.py index 78b9dc5..60d24db 100644 --- a/network.py +++ b/network.py @@ -85,6 +85,18 @@ def server(http_port): if site: conn.send("accepted".encode()) client(port, f"get_{site}") + elif op == "check_all": + sites = next(os.walk('cached/'), (None, None, []))[1] + sites_comp = "" + for i in sites: + # Проверяем версию + ver = read(f"cached/{i}/config.json")["ver"] + sites_comp += i + f"_{ver}<>" + sites_comp = sites_comp[:-2] + if sites_comp == "": + conn.send("None".encode()) + else: + conn.send(sites_comp.encode()) conn.close() @@ -109,14 +121,12 @@ def recv(s, data_out): data_out.put(data) # op = operation -def client(port, op = "ping"): - host = 'jetwork.404.mn' - +def client(port, op = "ping", host = 'jetwork.404.mn'): # Если порт не определён if not port: return None - if op == "ping" or op[:3] == "is_" or op[:8] == "publish_": + if op == "ping" or op[:3] == "is_" or op[:8] == "publish_" or op == "check_all": s = socket.socket() try: s.connect((host, port))