You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.9 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

from os import system
from urllib.request import urlretrieve as download
from db import *
print('''1. Linux
2. Windows
3. Android (Termux)''')
raw_os = input('ОС установки >> ')
oses = {'1': 'Linux', '2': 'Windows', '3': 'Android'}
os = oses[raw_os]
# Записываем ОС в конфиг
conf = read()
conf['os'] = os
write(conf)
if os == 'Android':
print('''---
Устанавливаем зависимости rust...
---''')
system('pkg install rust')
print('''---
[1/3] Устанавливаем зависимости Python...
---''')
system('pip install -r requirements.txt')
print('''---
[2/3] Скачиваем обратный прокси...
---''')
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
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')
system('del bore.zip')
elif os == 'Android':
system('pkg install bore')
else:
print('Увы, вероятно Ваша ОС не поддерживается.')
print('Завершение работы...')
exit()
print('''---
[3/3] Создаём папки для работы...
---''')
system('mkdir cached')
system('mkdir verify')
system('mkdir mysites')
# TODO
#print('Максимальный размер для кэшированных файлов. (в гигабайтах)')
#print('Укажите 0 для отключения ограничения.')
#max = input('>> ')
# Записываем в конфиг
#config['max'] = max
#write(config)
print('''
---
Установка завершена!
Чтобы подключится к jetwork выполните: python main.py
---''')