diff --git a/files/routes/__init__.py b/files/routes/__init__.py index d933355f6..32c0313b1 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 .api import * +from .docs import * from .reporting import * from .front import * from .login import * diff --git a/files/routes/api.py b/files/routes/api.py deleted file mode 100644 index 415eeebea..000000000 --- a/files/routes/api.py +++ /dev/null @@ -1,21 +0,0 @@ -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(v): - # TODO cache - root = tree.getroot() - - return render_template("docs.html", root=tree.getroot(), v=v) diff --git a/files/routes/docs.py b/files/routes/docs.py new file mode 100644 index 000000000..e8d3e7971 --- /dev/null +++ b/files/routes/docs.py @@ -0,0 +1,13 @@ +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 5ac875f40..a5db159bd 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -188,6 +188,11 @@ def log_item(id, v): def static_megathread_index(v:User): 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") diff --git a/files/templates/docs.html b/files/templates/docs.html index 9de5db38e..272859049 100644 --- a/files/templates/docs.html +++ b/files/templates/docs.html @@ -41,7 +41,8 @@ used to it

You're probably here because you want to create your own application - which calls our REST api.

+ which calls our REST api. Some of the stuff you see here might seem + ugly (it is), but it's mainly inherited from the old Ruqqus API.

This documentation is generated from an XML WADL file.