diff --git a/docs/api.xml b/docs/api.xml
index de6778420..df6731f4b 100644
--- a/docs/api.xml
+++ b/docs/api.xml
@@ -10,6 +10,8 @@
Written in a deprecated format due to it's verbosity and
easy porting to OpenAPI's Swagger, which supports nice
frontends.
+
+ View it at /dev/api
-->
-
+
The posts title. :emojis: will be parsed as well. Plaintext. No markdown.
@@ -78,8 +81,9 @@
-
-
+
+ Not found
+
@@ -98,8 +102,8 @@
+ style="url"
+ type="xsd:string">
User URL
@@ -157,7 +161,7 @@
style="plain"
type="xsd:url">
- Fullname of the parent (this isn't actually real, right?)
+ ID of the parent post. Starts with p_
for a parent submission, and c_
for a comment submission. Anything else will emit a 400.
Your messages content
+
+
+ Parent submission (the id, right?)
+
+
+
+
+ If this post is marked as sensitive.
+
+
+
+
+
+
+
+ User is exiled from the hole, or needs extra permissions.
+ User is banned and needs to do better.
+
+
+
-
+
diff --git a/files/routes/__init__.py b/files/routes/__init__.py
index 5649270be..32c0313b1 100644
--- a/files/routes/__init__.py
+++ b/files/routes/__init__.py
@@ -20,6 +20,7 @@ from files.routes.jinja2 import *
from .admin import *
from .comments import *
from .errors import *
+from .docs import *
from .reporting import *
from .front import *
from .login import *
diff --git a/files/routes/comments.py b/files/routes/comments.py
index 334455f16..108fed507 100644
--- a/files/routes/comments.py
+++ b/files/routes/comments.py
@@ -79,6 +79,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
else: template = "submission.html"
return render_template(template, v=v, p=post, sort=sort, comment_info=comment_info, render_replies=True, sub=post.subr)
+#- API
@app.post("/comment")
@limiter.limit("1/second;20/minute;200/hour;1000/day")
@auth_required
@@ -91,7 +92,7 @@ def comment(v):
id = parent_fullname[2:]
parent_comment_id = None
rts = False
-
+
if parent_fullname.startswith("p_"):
parent = get_post(id, v=v)
parent_post = parent
diff --git a/files/routes/docs.py b/files/routes/docs.py
new file mode 100644
index 000000000..5270dee6c
--- /dev/null
+++ b/files/routes/docs.py
@@ -0,0 +1,35 @@
+import os
+from collections import Counter
+from json import loads
+from shutil import copyfile
+import xml
+
+import gevent
+
+from files.classes import *
+from files.helpers.actions import *
+from files.helpers.alerts import *
+from files.helpers.cloudflare import purge_files_in_cache
+from files.helpers.const import *
+from files.helpers.get import *
+from files.helpers.marsify import marsify
+from files.helpers.media import *
+from files.helpers.owoify import owoify
+from files.helpers.regex import *
+from files.helpers.sanitize import filter_emojis_only
+from files.helpers.slots import *
+from files.helpers.treasure import *
+from files.routes.front import comment_idlist
+from files.routes.routehelpers import execute_shadowban_viewers_and_voters
+from files.routes.wrappers import *
+from files.__main__ import app, cache, limiter
+
+import xml.etree.ElementTree as ET
+
+tree = ET.parse('docs/api.xml')
+
+@app.get("/dev/api")
+def get_docs_page():
+ root = tree.getroot()
+
+ return render_template("docs.html", root=tree.getroot())
diff --git a/files/templates/docs.html b/files/templates/docs.html
new file mode 100644
index 000000000..272859049
--- /dev/null
+++ b/files/templates/docs.html
@@ -0,0 +1,81 @@
+{% extends "default.html" %}
+
+{#% Some macros %#}
+{% macro docbook_read(info) -%}
+ {% for p in info -%}
+ {#% Lazy hack, not """conforming""" to docbook %#}
+
+ {{- p.text -}}
+
+ {%- endfor %}
+{%- endmacro %}
+
+{%- macro param_table(info) -%}
+
+
+ Param |
+ Description |
+ Type |
+ Format |
+ Required |
+
+ {% for param in info %}
+
+
+ {{ param.attrib.name }} |
+ {{- docbook_read(param[0]) -}} |
+ {{ param.attrib.type }} |
+ {{ param.attrib.style }} |
+ {{ param.attrib.required }} |
+
+ {% endfor %}
+
+{%- endmacro -%}
+
+{% block pagetitle %}Documentation{% endblock %}
+{% block content %}
+
+
rDrama REST Api Documentaion
+
+
Warning: This documentation is SHIT, so get
+ used to it
+
+
You're probably here because you want to create your own application
+ 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.
+
+
+
+ {% for res in root[0] %}
+
+ {#% There's usually only one method, but this is more correct %#}
+ {% for method in res %}
+
+
+ {{- method.attrib.name -}}
+
+ {{ res.attrib.path }}
+
+ {% for info in method %}
+ {% if info.tag == "{http://wadl.dev.java.net/2009/02}doc" %}
+ {{ docbook_read(info) }}
+ {% elif info.tag == "{http://wadl.dev.java.net/2009/02}request" %}
+ {{ param_table(info) }}
+ {% elif info.tag == "{http://wadl.dev.java.net/2009/02}response" %}
+ Response {{ info.attrib.status }}
+ {% for response_child in info %}
+ {% if response_child.tag == "{http://wadl.dev.java.net/2009/02}param" %}
+ {{ param_table(info) }}
+ {% elif response_child.tag == "{http://wadl.dev.java.net/2009/02}doc" %}
+ {{ docbook_read(response_child) }}
+ {% endif %}
+ {% endfor %}
+ {% endif %}
+ {% endfor %}
+ {% endfor %}
+
+ {% endfor %}
+
+{% endblock %}