diff --git a/core/__pycache__/handler.cpython-39.pyc b/core/__pycache__/handler.cpython-39.pyc index 25fcebf..af0b4c0 100644 Binary files a/core/__pycache__/handler.cpython-39.pyc and b/core/__pycache__/handler.cpython-39.pyc differ diff --git a/core/bottle b/core/bottle new file mode 160000 index 0000000..eb1982e --- /dev/null +++ b/core/bottle @@ -0,0 +1 @@ +Subproject commit eb1982ea22937a042f5a6e98c5709f779a8fd66c diff --git a/core/handler.py b/core/handler.py index da979bf..a1a2ac6 100755 --- a/core/handler.py +++ b/core/handler.py @@ -3,6 +3,8 @@ import json # from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer from http.server import BaseHTTPRequestHandler +from core.bottle.bottle import Bottle, run +#route, post, head, request, error, run import logging import os, urllib from utils.utils import get_list_overlays, load_config, write_config, sort_install_pkg @@ -13,13 +15,14 @@ from core.jwt import genaratorSecretsToken import logging from io import BytesIO #repl = '\n' - + app =Bottle +@app.post(/login) def login(user='demo', password='demo'): if auth(): return(generatoSecretsToken()) else: return ("403") - +@app.post('/') def main(): try: with open('./pkgs.json', 'tr') as fn: @@ -30,7 +33,7 @@ def main(): except Exception(e): print(e) return "404" - +@app.post('/set_settings') def set_settings_app(params): config = load_config() # param = self.path.replace("/?st_app=", "") @@ -45,7 +48,7 @@ def set_settings_app(params): write_config(port, Lang) print(config) print(param) - +@app.post(/find/) def search(pkg): # param = self.path.replace("/find?pkg=", "") #request['params']['name'] Pk_list = [] @@ -69,9 +72,16 @@ def search(pkg): # self.r_t = str(json.dumps(search_result)) return str(json.dumps(Search_result)) # self.r_t = json.dumps(pkg_list) - +@app.post('/get_settings') def get_settings_app(): return str(json.dumps(load_config())) +@app.route('*',['GET']}) +def req_get(): + return" 404" + +# run (host='0.0.0.0', port=8000, keyfile='key.pem', certfile='cert.pem') + + class Handler(BaseHTTPRequestHandler): #self.Response = "" @@ -139,7 +149,7 @@ class Handler(BaseHTTPRequestHandler): def do_GET(self): print("do_GET:\n") print(str(self.path), str(self.headers)) - + self.send_response(404) # print(Router.parse_url(self)) # print("data:\t" + self.rfile.read()) # request = Router.parse_url(self) diff --git a/utils/__pycache__/package.cpython-39.pyc b/utils/__pycache__/package.cpython-39.pyc index 6145159..44bf492 100644 Binary files a/utils/__pycache__/package.cpython-39.pyc and b/utils/__pycache__/package.cpython-39.pyc differ diff --git a/utils/__pycache__/parsePortage.cpython-39.pyc b/utils/__pycache__/parsePortage.cpython-39.pyc new file mode 100644 index 0000000..5682dda Binary files /dev/null and b/utils/__pycache__/parsePortage.cpython-39.pyc differ diff --git a/utils/__pycache__/utils.cpython-39.pyc b/utils/__pycache__/utils.cpython-39.pyc index a8b014f..363fc83 100644 Binary files a/utils/__pycache__/utils.cpython-39.pyc and b/utils/__pycache__/utils.cpython-39.pyc differ diff --git a/utils/package.py b/utils/package.py index 23d1129..a532a43 100644 --- a/utils/package.py +++ b/utils/package.py @@ -3,7 +3,7 @@ import json import portage portage.root -from parsePackage import PortageConfig +from utils.parsePortage import PortageConfig portge = portage.db[portage.root]["porttree"].dbapi #from utils.utils import sort_install_pkg #ПЛАН: diff --git a/utils/parsePortage.py b/utils/parsePortage.py index f692bcb..b497023 100644 --- a/utils/parsePortage.py +++ b/utils/parsePortage.py @@ -1,7 +1,7 @@ #-*- codding:UTF-8 -*- #!/usr/bin/env python import os, sys, json -from utils import load_config +from utils.utils import load_config class PortageConfig(): def __init__(self): self.Config = load_config() @@ -80,9 +80,9 @@ if __name__ == '__main__': Test.parseMakeConf() elif sys.argv[1] == "use": Test.templParse('package.use', res=True) - elif sys.argv[1] == "mask: + elif sys.argv[1] == "mask": Test.templParse('package.mask', res=True) - elif sys.argv[1] == "unmask: + elif sys.argv[1] == "unmask": Test.templParse('package.unmask', res=True) else: - + pass