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

Added redirects for backwards compatibility

This commit is contained in:
Krateng 2020-09-02 20:38:38 +02:00
parent 8acf2ef503
commit f61804b095
2 changed files with 19 additions and 5 deletions

View File

@ -11,7 +11,3 @@ def init_apis(server):
for api in apis:
apis[api].mount(server=server,path="apis/"+api)
# backwards compatibility
nativeapi = copy.deepcopy(apis["mlj_1"])
nativeapi.mount(server=server,path="api")

View File

@ -15,7 +15,7 @@ from . import malojatime
from . import utilities
from . import malojauri
from .utilities import resolveImage
from .malojauri import uri_to_internal, remove_identical
from .malojauri import uri_to_internal, remove_identical, compose_querystring
from . import globalconf
from .jinjaenv.context import jinja_environment
# doreah toolkit
@ -58,6 +58,24 @@ auth.authapi.mount(server=webserver)
from .apis import init_apis
init_apis(webserver)
# redirects for backwards compatibility
@webserver.get("/api/s/<pth:path>")
@webserver.post("/api/s/<pth:path>")
def deprecated_api_s(pth):
redirect("/apis/" + pth + "?" + compose_querystring(request.query))
@webserver.get("/api/<pth:path>")
@webserver.post("/api/<pth:path>")
def deprecated_api(pth):
redirect("/apis/mlj_1/" + pth + "?" + compose_querystring(request.query))
pthjoin = os.path.join
def generate_css():