GUI development
This commit is contained in:
@@ -6,9 +6,6 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
|||||||
|
|
||||||
import modules.gui as gui
|
import modules.gui as gui
|
||||||
from modules.console import cls
|
from modules.console import cls
|
||||||
from modules.virustotal import add_to_cfg
|
|
||||||
from modules.uploader import upload
|
|
||||||
from modules.source import get_source
|
|
||||||
import modules.vars as horsy_vars
|
import modules.vars as horsy_vars
|
||||||
|
|
||||||
# Initialize GUI
|
# Initialize GUI
|
||||||
@@ -90,6 +87,11 @@ def get_source_gui():
|
|||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def upload_gui():
|
||||||
|
from modules.uploader import upload
|
||||||
|
upload(True, ui)
|
||||||
|
|
||||||
# Run functions on startup
|
# Run functions on startup
|
||||||
installed_apps()
|
installed_apps()
|
||||||
|
|
||||||
@@ -100,6 +102,7 @@ ui.delete_button.clicked.connect(uninstall_app)
|
|||||||
ui.search_button.clicked.connect(search_gui)
|
ui.search_button.clicked.connect(search_gui)
|
||||||
ui.install_button.clicked.connect(install_app)
|
ui.install_button.clicked.connect(install_app)
|
||||||
ui.source_button.clicked.connect(get_source_gui)
|
ui.source_button.clicked.connect(get_source_gui)
|
||||||
|
ui.upload_button.clicked.connect(upload_gui)
|
||||||
|
|
||||||
|
|
||||||
# Handle GUI exiting to exit whole program
|
# Handle GUI exiting to exit whole program
|
||||||
|
|||||||
@@ -16,91 +16,128 @@ def urlmatch(s):
|
|||||||
return re.match("^https?://.*.(?:zip|exe)$", s) is not None
|
return re.match("^https?://.*.(?:zip|exe)$", s) is not None
|
||||||
|
|
||||||
|
|
||||||
def upload():
|
def upload(is_gui=False, ui=None):
|
||||||
print('Welcome to the uploader')
|
if not is_gui:
|
||||||
print('Before starting, please make sure you have done your project and [blink]uploaded[/] it to any hosting '
|
print('Welcome to the uploader')
|
||||||
'service or file sharing service')
|
print('Before starting, please make sure you have done your project and [blink]uploaded[/] it to any hosting '
|
||||||
input('[OK] Press enter to continue...')
|
'service or file sharing service')
|
||||||
auth = get_auth()
|
input('[OK] Press enter to continue...')
|
||||||
print('Please enter the name of your project. It should contain only lowercase letters, '
|
auth = get_auth()
|
||||||
'underscores and dashes')
|
print('Please enter the name of your project. It should contain only lowercase letters, '
|
||||||
project_name = None
|
'underscores and dashes')
|
||||||
while project_name is None:
|
project_name = None
|
||||||
project_name = input('> ')
|
while project_name is None:
|
||||||
|
project_name = input('> ')
|
||||||
|
if not matches(project_name) or len(project_name) > 64 or len(project_name) < 3:
|
||||||
|
print('[red]Invalid project name[/red]')
|
||||||
|
project_name = None
|
||||||
|
|
||||||
|
print('Please paste there project description. It should be a short text under 256 characters')
|
||||||
|
description = None
|
||||||
|
while description is None:
|
||||||
|
description = input('> ')
|
||||||
|
if len(description) > 256:
|
||||||
|
print('[red]Description is too long[/red]')
|
||||||
|
description = None
|
||||||
|
|
||||||
|
print('Please paste there url of executable file. It should be a link to exe or zip file hosted somewhere. '
|
||||||
|
'If app needs dependencies or specific launch options (python, node, etc), you can add them later')
|
||||||
|
url = None
|
||||||
|
while url is None:
|
||||||
|
url = input('> ')
|
||||||
|
if not urlmatch(url):
|
||||||
|
print('[red]Invalid file url, also it should end on .exe or .zip[/red]')
|
||||||
|
url = None
|
||||||
|
|
||||||
|
print('Please paste there url of your project on GitHub or somewhere else. It should be a link to source code '
|
||||||
|
'of your app. It can be archive, repository, site, whatever you want, optional but highly recommended.'
|
||||||
|
'If you don\'t want to add it, just press Enter')
|
||||||
|
source_url = input('> ')
|
||||||
|
source_url = None if source_url == '' else source_url
|
||||||
|
|
||||||
|
print('If your app needs any dependencies, please paste its link here. It can be exe of installer from official '
|
||||||
|
'site. If you don\'t want to add it, just press Enter')
|
||||||
|
download = None
|
||||||
|
while download is None:
|
||||||
|
download = input('> ')
|
||||||
|
if download == '':
|
||||||
|
download = None
|
||||||
|
break
|
||||||
|
if not urlmatch(download):
|
||||||
|
print('[red]Invalid download url[/red]')
|
||||||
|
download = None
|
||||||
|
|
||||||
|
print('Please add which files should be run during installation. It should be an executable file name.'
|
||||||
|
'If you don\'t want to add it, just press Enter')
|
||||||
|
install = input('> ')
|
||||||
|
install = None if install == '' else install
|
||||||
|
|
||||||
|
print('Please specify main executable command. It can be executable file name (some-file.exe) or command, that '
|
||||||
|
'launches your script (python some-file.py, etc)')
|
||||||
|
run = None
|
||||||
|
while run is None:
|
||||||
|
run = input('> ')
|
||||||
|
if run == '':
|
||||||
|
print('[red]Please, specify runtime[/red]')
|
||||||
|
run = None
|
||||||
|
|
||||||
|
request = {
|
||||||
|
'auth': auth,
|
||||||
|
'name': project_name,
|
||||||
|
'description': description,
|
||||||
|
'url': url,
|
||||||
|
'sourceUrl': source_url,
|
||||||
|
'download': download,
|
||||||
|
'install': install,
|
||||||
|
'run': run
|
||||||
|
}
|
||||||
|
|
||||||
|
else:
|
||||||
|
auth = get_auth()
|
||||||
|
|
||||||
|
project_name = ui.packagename_box.text()
|
||||||
if not matches(project_name) or len(project_name) > 64 or len(project_name) < 3:
|
if not matches(project_name) or len(project_name) > 64 or len(project_name) < 3:
|
||||||
print('[red]Invalid project name[/red]')
|
print('[red]Invalid project name[/red]')
|
||||||
project_name = None
|
return
|
||||||
|
|
||||||
print('Please paste there project description. It should be a short text under 256 characters')
|
description = ui.package_desc_box.toPlainText()
|
||||||
description = None
|
|
||||||
while description is None:
|
|
||||||
description = input('> ')
|
|
||||||
if len(description) > 256:
|
if len(description) > 256:
|
||||||
print('[red]Description is too long[/red]')
|
print('[red]Description is too long[/red]')
|
||||||
description = None
|
return
|
||||||
|
|
||||||
print('Please paste there url of executable file. It should be a link to exe or zip file hosted somewhere. '
|
url = ui.url_of_exe_box.text()
|
||||||
'If app needs dependencies or specific launch options (python, node, etc), you can add them later')
|
|
||||||
url = None
|
|
||||||
while url is None:
|
|
||||||
url = input('> ')
|
|
||||||
if not urlmatch(url):
|
if not urlmatch(url):
|
||||||
print('[red]Invalid file url, also it should end on .exe or .zip[/red]')
|
print('[red]Invalid file url, also it should end on .exe or .zip[/red]')
|
||||||
url = None
|
return
|
||||||
|
|
||||||
print('Please paste there url of your project on GitHub or somewhere else. It should be a link to source code '
|
source_url = ui.source_url_box.text()
|
||||||
'of your app. It can be archive, repository, site, whatever you want, optional but highly recommended.'
|
source_url = None if source_url == '' else source_url
|
||||||
'If you don\'t want to add it, just press Enter')
|
|
||||||
source_url = input('> ')
|
|
||||||
source_url = None if source_url == '' else source_url
|
|
||||||
|
|
||||||
print('If your app needs any dependencies, please paste its link here. It can be exe of installer from official '
|
download = ui.dependency_url_box.text()
|
||||||
'site. If you don\'t want to add it, just press Enter')
|
|
||||||
download = None
|
|
||||||
while download is None:
|
|
||||||
download = input('> ')
|
|
||||||
if download == '':
|
if download == '':
|
||||||
download = None
|
download = None
|
||||||
break
|
elif not urlmatch(download):
|
||||||
if not urlmatch(download):
|
|
||||||
print('[red]Invalid download url[/red]')
|
print('[red]Invalid download url[/red]')
|
||||||
download = None
|
return
|
||||||
|
|
||||||
print('Please add which files should be run during installation. It should be an executable file name.'
|
install = ui.dependency_run_box.text()
|
||||||
'If you don\'t want to add it, just press Enter')
|
install = None if install == '' else install
|
||||||
install = input('> ')
|
|
||||||
install = None if install == '' else install
|
|
||||||
|
|
||||||
print('Please specify main executable command. It can be executable file name (some-file.exe) or command, that '
|
run = ui.main_exe_box.text()
|
||||||
'launches your script (python some-file.py, etc)')
|
|
||||||
run = None
|
|
||||||
while run is None:
|
|
||||||
run = input('> ')
|
|
||||||
if run == '':
|
if run == '':
|
||||||
print('[red]Please, specify runtime[/red]')
|
print('[red]Please, specify runtime[/red]')
|
||||||
run = None
|
return
|
||||||
|
|
||||||
request = {
|
request = {
|
||||||
'auth': auth,
|
'auth': auth,
|
||||||
'name': project_name,
|
'name': project_name,
|
||||||
'description': description,
|
'description': description,
|
||||||
'url': url,
|
'url': url,
|
||||||
'sourceUrl': source_url,
|
'sourceUrl': source_url,
|
||||||
'download': download,
|
'download': download,
|
||||||
'install': install,
|
'install': install,
|
||||||
'run': run
|
'run': run
|
||||||
}
|
}
|
||||||
|
|
||||||
# request = {
|
|
||||||
# "auth": {"email": "meshko_a@dlit.dp.ua", "password": "VeryGoodPassword"},
|
|
||||||
# "name": "testapp",
|
|
||||||
# "description": "Very good description",
|
|
||||||
# # "url": "https://github.com/Cactus-0/cabanchik/raw/main/dist/cabanchik.exe",
|
|
||||||
# "sourceUrl": "https://github.com/Cactus-0/cabanchik",
|
|
||||||
# "download": "https://www.python.org/ftp/python/3.10.2/python-3.10.2-amd64.exe",
|
|
||||||
# "install": "python-3.10.2-amd64.exe",
|
|
||||||
# "run": "cabanchik.exe"
|
|
||||||
# }
|
|
||||||
|
|
||||||
r = None
|
r = None
|
||||||
while r is None:
|
while r is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user