|
|
@ -1,13 +1,19 @@
|
|
|
|
from os import system, name
|
|
|
|
from os import system, name
|
|
|
|
from threading import Thread
|
|
|
|
|
|
|
|
from time import sleep
|
|
|
|
from time import sleep
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from threading import Thread
|
|
|
|
|
|
|
|
from multiprocessing import Process
|
|
|
|
|
|
|
|
|
|
|
|
from network import *
|
|
|
|
from network import *
|
|
|
|
from updater import *
|
|
|
|
from updater import *
|
|
|
|
|
|
|
|
from proxy import *
|
|
|
|
|
|
|
|
from status import *
|
|
|
|
|
|
|
|
|
|
|
|
# Здесь общий запуск всех файлов и команд
|
|
|
|
# Здесь общий запуск всех файлов и команд
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
# Проверка обновлений
|
|
|
|
# Проверка обновлений
|
|
|
|
from sys import argv
|
|
|
|
from sys import argv
|
|
|
|
if len(argv) == 1:
|
|
|
|
if len(argv) == 1:
|
|
|
@ -18,54 +24,53 @@ if len(argv) == 1:
|
|
|
|
exit()
|
|
|
|
exit()
|
|
|
|
print("\nУспешно перезагружено!")
|
|
|
|
print("\nУспешно перезагружено!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Запуск прокси для сервисов
|
|
|
|
from proxy import *
|
|
|
|
# проксируем http сервер
|
|
|
|
|
|
|
|
|
|
|
|
http_port = port_gen()
|
|
|
|
http_port = port_gen()
|
|
|
|
print(f"HTTP: {http_port}")
|
|
|
|
print(f"HTTP: {http_port}")
|
|
|
|
rp_http = Thread(target = watch_http, args=(http_port,))
|
|
|
|
rp_http = Thread(target = watch_http, args=(http_port,))
|
|
|
|
rp_http.daemon = True
|
|
|
|
|
|
|
|
rp_http.start()
|
|
|
|
rp_http.start()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# проксируем сервер обработки запросов
|
|
|
|
serv_port = port_gen()
|
|
|
|
serv_port = port_gen()
|
|
|
|
print(f"SERV: {serv_port}")
|
|
|
|
print(f"SERV: {serv_port}")
|
|
|
|
rp_serv = Thread(target = watch_serv, args=(serv_port,))
|
|
|
|
rp_serv = Thread(target = watch_serv, args=(serv_port,))
|
|
|
|
rp_serv.daemon = True
|
|
|
|
|
|
|
|
rp_serv.start()
|
|
|
|
rp_serv.start()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Стартуем сервисы
|
|
|
|
# Стартуем сервисы
|
|
|
|
# http сервер
|
|
|
|
# http сервер
|
|
|
|
http = Thread(target = server_http)
|
|
|
|
http = Thread(target = server_http)
|
|
|
|
http.daemon = True
|
|
|
|
|
|
|
|
http.start()
|
|
|
|
http.start()
|
|
|
|
# сервер для пинга
|
|
|
|
# сервер обработки запросов
|
|
|
|
server = Thread(target = server, args=(http_port,))
|
|
|
|
srv = Thread(target = server, args=(http_port,))
|
|
|
|
server.daemon = True
|
|
|
|
srv.start()
|
|
|
|
server.start()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Стартуем авто-поиск портов и авто-обновление сайтов
|
|
|
|
# Стартуем авто-поиск портов и авто-обновление сайтов
|
|
|
|
updater = Thread(target = update_demon, args=(serv_port,))
|
|
|
|
updater = Thread(target = update_demon, args=(serv_port,))
|
|
|
|
updater.daemon = True
|
|
|
|
|
|
|
|
updater.start()
|
|
|
|
updater.start()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# !!! ИДЁТ ПЕРЕРАБОТКА !!!
|
|
|
|
# Стартуем интерфейс
|
|
|
|
# Стартуем интерфейс
|
|
|
|
system(f"python -m streamlit run --server.address=127.0.0.1 interface.py {serv_port}")
|
|
|
|
#system(f"python -m streamlit run --server.address=127.0.0.1 interface.py {serv_port}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
|
|
|
# Запускаем главный процесс, чтобы потом легко убить его
|
|
|
|
|
|
|
|
p = Process(target=main)
|
|
|
|
|
|
|
|
p.start()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
status_set(True) # Устанавливаем статус, что программа работает
|
|
|
|
|
|
|
|
|
|
|
|
while True:
|
|
|
|
st = status_check()
|
|
|
|
|
|
|
|
while st:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
pass
|
|
|
|
st = status_check()
|
|
|
|
except:
|
|
|
|
sleep(0.01)
|
|
|
|
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
|
|
|
|
p.terminate()
|
|
|
|
exit()
|
|
|
|
exit()
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
#print(client(8000, "ping"))
|
|
|
|
# Когда послан код завершения
|
|
|
|
#ports = port_check(serv_port)
|
|
|
|
p.terminate()
|
|
|
|
#print(ports)
|
|
|
|
exit()
|
|
|
|
|
|
|
|
|
|
|
|
#print(client(4015, "ping"))
|
|
|
|
|
|
|
|
#print(client(4137, "is_just.jet"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#client(4092, "publish_just.jet<>4066")
|
|
|
|
|
|
|
|