mirror of
https://github.com/Justuser3310/jetwork.git
synced 2025-01-18 17:08:48 +00:00
Прототип интерфейса
This commit is contained in:
parent
12b70d4325
commit
e278115092
11
interface.py
Normal file
11
interface.py
Normal file
@ -0,0 +1,11 @@
|
||||
import streamlit as st
|
||||
|
||||
st.title('jetwork')
|
||||
|
||||
# Получаем все сайты
|
||||
from os import walk
|
||||
sites = next(walk('cached/'), (None, None, []))[1]
|
||||
|
||||
for i in sites:
|
||||
addr = f"http://127.0.0.1:8000/{i}/index.html"
|
||||
f"[{i}]({addr})"
|
31
main.py
31
main.py
@ -5,7 +5,7 @@ from time import sleep
|
||||
from network import *
|
||||
|
||||
# Здесь общий запуск всех файлов и команд
|
||||
'''
|
||||
|
||||
# Проверка обновлений
|
||||
from sys import argv
|
||||
if len(argv) == 1:
|
||||
@ -15,7 +15,6 @@ if len(argv) == 1:
|
||||
system("python main.py updated")
|
||||
exit()
|
||||
print("\nУспешно перезагружено!")
|
||||
'''
|
||||
|
||||
# Порт для приёма всяких запросов
|
||||
def reverse_proxy(dest, port = 8000):
|
||||
@ -50,31 +49,15 @@ os.chdir("../") # возвращаемся в корень
|
||||
server = Thread(target = server, args=(http_port,))
|
||||
server.start()
|
||||
|
||||
|
||||
# Стартуем интерфейс
|
||||
system("python -m streamlit run --server.address=0.0.0.0 interface.py")
|
||||
|
||||
|
||||
|
||||
#print(client(8000, "ping"))
|
||||
#ports = port_check(serv_port)
|
||||
#print(ports)
|
||||
|
||||
#print(client(4015, "ping"))
|
||||
#print(client(4137, "is_just.jet"))
|
||||
|
||||
'''
|
||||
# Режим отладки
|
||||
mode = 1
|
||||
|
||||
if mode == 0:
|
||||
serv_http = Thread(target = server_http)
|
||||
serv_http.start()
|
||||
|
||||
sleep(1)
|
||||
os.chdir("../") # возвращаемся в корень
|
||||
|
||||
serv = Thread(target = server, args=(http_port,))
|
||||
serv.start()
|
||||
elif mode == 1:
|
||||
pport = int(input())
|
||||
port_dest = client(pport, f"publish_just.jet<>{http_port}")
|
||||
print(port_dest)
|
||||
# if port_dest != "not exist":
|
||||
# client(port_dest, "get_just.jet")
|
||||
|
||||
'''
|
||||
|
@ -33,6 +33,11 @@ if op == "1":
|
||||
conf = {"type": "dynamic", "ver": 1, "port": int(port)}
|
||||
write(conf, f"mysites/{domain}/config.json")
|
||||
|
||||
# Создаём index.html для загрузки сайта
|
||||
with open(f"mysites/{domain}/index.html", "w") as f:
|
||||
f.write("<h1> Hello jetwork! </h1>")
|
||||
f.close()
|
||||
|
||||
# Архивируем и создаём сигнатуру для подтверждения неизменности архива
|
||||
make_archive(f"mysites/{domain}", "zip", f"mysites/{domain}")
|
||||
sign(f"mysites/{domain}.zip", f"mysites/{domain}.key", f"mysites/{domain}")
|
||||
@ -95,7 +100,10 @@ elif op == "3":
|
||||
|
||||
|
||||
# Копируем файлы из mysites в cached
|
||||
rmtree(f"cached/{domain}")
|
||||
try:
|
||||
rmtree(f"cached/{domain}")
|
||||
except:
|
||||
pass
|
||||
copytree(f"mysites/{domain}", f"cached/{domain}")
|
||||
copyfile(f"mysites/{domain}.pem", f"cached/{domain}.pem")
|
||||
copyfile(f"mysites/{domain}.sig", f"cached/{domain}.sig")
|
||||
|
Loading…
Reference in New Issue
Block a user