|
|
@ -85,6 +85,18 @@ def server(http_port):
|
|
|
|
if site:
|
|
|
|
if site:
|
|
|
|
conn.send("accepted".encode())
|
|
|
|
conn.send("accepted".encode())
|
|
|
|
client(port, f"get_{site}")
|
|
|
|
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()
|
|
|
|
conn.close()
|
|
|
|
|
|
|
|
|
|
|
@ -109,14 +121,12 @@ def recv(s, data_out):
|
|
|
|
data_out.put(data)
|
|
|
|
data_out.put(data)
|
|
|
|
|
|
|
|
|
|
|
|
# op = operation
|
|
|
|
# op = operation
|
|
|
|
def client(port, op = "ping"):
|
|
|
|
def client(port, op = "ping", host = 'jetwork.404.mn'):
|
|
|
|
host = 'jetwork.404.mn'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Если порт не определён
|
|
|
|
# Если порт не определён
|
|
|
|
if not port:
|
|
|
|
if not port:
|
|
|
|
return None
|
|
|
|
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()
|
|
|
|
s = socket.socket()
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
s.connect((host, port))
|
|
|
|
s.connect((host, port))
|
|
|
|