api: fix some missing imports

pull/24/head
justcool393 2022-11-26 14:46:49 -06:00 committed by geese_suck
parent f578cc8d1a
commit 23ff1a9775
Signed by: geese_suck
GPG Key ID: 4D09E4B0A7264746
4 changed files with 22 additions and 19 deletions

View File

@ -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 *

View File

@ -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())

View File

@ -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())

View File

@ -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")