diff --git a/files/routes/__init__.py b/files/routes/__init__.py index 32c0313b1..d933355f6 100644 --- a/files/routes/__init__.py +++ b/files/routes/__init__.py @@ -20,7 +20,7 @@ from files.routes.jinja2 import * from .admin import * from .comments import * from .errors import * -from .docs import * +from .api import * from .reporting import * from .front import * from .login import * diff --git a/files/routes/api.py b/files/routes/api.py new file mode 100644 index 000000000..1228682d0 --- /dev/null +++ b/files/routes/api.py @@ -0,0 +1,21 @@ +import xml.etree.ElementTree as ET + +from flask import render_template + +from files.routes.wrappers import auth_required, auth_desired +from files.__main__ import app + +tree = ET.parse('docs/api.xml') + +@app.get("/api") +@auth_required +def api(v): + return render_template("api.html", v=v) + +@app.get("/api/docs") +@auth_desired +def get_docs_page(): + # TODO cache + root = tree.getroot() + + return render_template("docs.html", root=tree.getroot()) diff --git a/files/routes/docs.py b/files/routes/docs.py deleted file mode 100644 index e8d3e7971..000000000 --- a/files/routes/docs.py +++ /dev/null @@ -1,13 +0,0 @@ -import xml -import xml.etree.ElementTree as ET -from files.__main__ import app, cache, limiter - -tree = ET.parse('docs/api.xml') - -@app.get("/dev/api") -@auth_desired -def get_docs_page(): - # TODO cache - root = tree.getroot() - - return render_template("docs.html", root=tree.getroot()) diff --git a/files/routes/static.py b/files/routes/static.py index 1601ba3e7..0705c07fc 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -188,11 +188,6 @@ def log_item(id, v): def static_megathread_index(v): return render_template("megathread_index.html", v=v) -@app.get("/api") -@auth_required -def api(v): - return render_template("api.html", v=v) - @app.get("/contact") @app.get("/contactus") @app.get("/contact_us")