1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Moved endpoints back out of functions

This commit is contained in:
krateng 2021-12-09 21:12:10 +01:00
parent d23da91101
commit a52c494e4b
2 changed files with 132 additions and 149 deletions

View File

@ -5,7 +5,7 @@ author = {
"email":"maloja@dev.krateng.ch", "email":"maloja@dev.krateng.ch",
"github": "krateng" "github": "krateng"
} }
version = 2,12,17 version = 2,12,18
versionstr = ".".join(str(n) for n in version) versionstr = ".".join(str(n) for n in version)
links = { links = {
"pypi":"malojaserver", "pypi":"malojaserver",

View File

@ -90,19 +90,6 @@ def clean_html(inp):
###### ######
### ERRORS ### ERRORS
##### #####
@ -154,7 +141,8 @@ aliases = {
} }
def register_endpoints_api(): ### API
auth.authapi.mount(server=webserver) auth.authapi.mount(server=webserver)
from .apis import init_apis from .apis import init_apis
@ -171,7 +159,10 @@ def register_endpoints_api():
def deprecated_api(pth): def deprecated_api(pth):
redirect("/apis/mlj_1/" + pth + "?" + request.query_string,308) redirect("/apis/mlj_1/" + pth + "?" + request.query_string,308)
def register_endpoints_web_static():
### STATIC
@webserver.route("/image") @webserver.route("/image")
def dynamic_image(): def dynamic_image():
@ -243,11 +234,7 @@ def register_endpoints_web_static():
### DYNAMIC
def register_endpoints_web_dynamic():
def static_html(name): def static_html(name):
if name in aliases: redirect(aliases[name]) if name in aliases: redirect(aliases[name])
@ -333,10 +320,6 @@ signal.signal(signal.SIGTERM, graceful_exit)
def run_server(): def run_server():
register_endpoints_api()
register_endpoints_web_static()
register_endpoints_web_dynamic()
Thread(target=database.start_db).start() Thread(target=database.start_db).start()
## start database ## start database