|
|
@ -1,51 +1,62 @@
|
|
|
|
from os import system, name
|
|
|
|
from os import system
|
|
|
|
from urllib.request import urlretrieve as download
|
|
|
|
from urllib.request import urlretrieve as download
|
|
|
|
|
|
|
|
|
|
|
|
from db import *
|
|
|
|
from db import *
|
|
|
|
config = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Устанавливаем зависимости
|
|
|
|
print('''1. Linux
|
|
|
|
system("pip install -r requirements.txt")
|
|
|
|
2. Windows
|
|
|
|
|
|
|
|
3. Android (Termux)''')
|
|
|
|
# Скачиваем bore (для проброса портов)
|
|
|
|
raw_os = input('ОС установки >> ')
|
|
|
|
if name == "posix":
|
|
|
|
oses = {'1': 'Linux', '2': 'Windows', '3': 'Android'}
|
|
|
|
download("https://github.com/ekzhang/bore/releases/download/v0.5.0/bore-v0.5.0-x86_64-unknown-linux-musl.tar.gz", "bore.tar.gz")
|
|
|
|
os = oses[raw_os]
|
|
|
|
system("tar -zxvf bore.tar.gz")
|
|
|
|
|
|
|
|
system("rm -rf bore.tar.gz")
|
|
|
|
# Записываем ОС в конфиг
|
|
|
|
|
|
|
|
conf = read()
|
|
|
|
import getpass
|
|
|
|
conf['os'] = os
|
|
|
|
user = getpass.getuser()
|
|
|
|
write(conf)
|
|
|
|
|
|
|
|
|
|
|
|
#system("mkdir ~/.streamlit")
|
|
|
|
print('''---
|
|
|
|
#with open(f"/home/{user}/.streamlit/credentials.toml", "w") as f:
|
|
|
|
[1/3] Устанавливаем зависимости python...
|
|
|
|
# f.write('[general]\nemail = "a@a.a"')
|
|
|
|
---''')
|
|
|
|
#f.close()
|
|
|
|
system('pip install -r requirements.txt')
|
|
|
|
elif name == "nt":
|
|
|
|
|
|
|
|
|
|
|
|
print('''---
|
|
|
|
|
|
|
|
Скачиваем обратный прокси...
|
|
|
|
|
|
|
|
---''')
|
|
|
|
|
|
|
|
if os == 'Linux':
|
|
|
|
|
|
|
|
download('https://github.com/ekzhang/bore/releases/download/v0.5.0/bore-v0.5.0-x86_64-unknown-linux-musl.tar.gz', 'bore.tar.gz')
|
|
|
|
|
|
|
|
system('tar -zxvf bore.tar.gz')
|
|
|
|
|
|
|
|
system('rm -rf bore.tar.gz')
|
|
|
|
|
|
|
|
elif os == 'Windows':
|
|
|
|
from shutil import unpack_archive as unpack
|
|
|
|
from shutil import unpack_archive as unpack
|
|
|
|
download("https://github.com/ekzhang/bore/releases/download/v0.5.0/bore-v0.5.0-x86_64-pc-windows-msvc.zip", "bore.zip")
|
|
|
|
download('https://github.com/ekzhang/bore/releases/download/v0.5.0/bore-v0.5.0-x86_64-pc-windows-msvc.zip', 'bore.zip')
|
|
|
|
unpack("bore.zip")
|
|
|
|
unpack('bore.zip')
|
|
|
|
system("del bore.zip")
|
|
|
|
system('del bore.zip')
|
|
|
|
|
|
|
|
elif os == 'Android':
|
|
|
|
#system("mkdir C:\\Users\\windows\\.streamlit")
|
|
|
|
system('pkg install bore-cli')
|
|
|
|
#with open("C:\\Users\\windows\\.streamlit\\credentials.toml", "w") as f:
|
|
|
|
|
|
|
|
# f.write('[general]\nemail = "a@a.a"')
|
|
|
|
|
|
|
|
#f.close()
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
print("Увы, вероятно Ваша ОС не поддерживается.")
|
|
|
|
print('Увы, вероятно Ваша ОС не поддерживается.')
|
|
|
|
print("Завершение работы...")
|
|
|
|
print('Завершение работы...')
|
|
|
|
exit()
|
|
|
|
exit()
|
|
|
|
|
|
|
|
|
|
|
|
# Создаём папку для кэшированных сайтов
|
|
|
|
print('''---
|
|
|
|
system("mkdir cached")
|
|
|
|
Создаём папки для работы...
|
|
|
|
system("mkdir verify")
|
|
|
|
---''')
|
|
|
|
system("mkdir mysites")
|
|
|
|
system('mkdir cached')
|
|
|
|
|
|
|
|
system('mkdir verify')
|
|
|
|
|
|
|
|
system('mkdir mysites')
|
|
|
|
|
|
|
|
|
|
|
|
# TODO
|
|
|
|
# TODO
|
|
|
|
#print("Максимальный размер для кэшированных файлов. (в гигабайтах)")
|
|
|
|
#print('Максимальный размер для кэшированных файлов. (в гигабайтах)')
|
|
|
|
#print("Укажите 0 для отключения ограничения.")
|
|
|
|
#print('Укажите 0 для отключения ограничения.')
|
|
|
|
#max = input(">> ")
|
|
|
|
#max = input('>> ')
|
|
|
|
# Записываем в конфиг
|
|
|
|
# Записываем в конфиг
|
|
|
|
#config["max"] = max
|
|
|
|
#config['max'] = max
|
|
|
|
#write(config)
|
|
|
|
#write(config)
|
|
|
|
|
|
|
|
|
|
|
|
print("\nЧтобы подключится к jetwork выполните: python main.py")
|
|
|
|
print('''
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
Установка завершена!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Чтобы подключится к jetwork выполните: python main.py
|
|
|
|
|
|
|
|
---''')
|
|
|
|