aboutsummaryrefslogtreecommitdiff
path: root/app/blueprints/api/endpoints.py
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2020-01-22 23:10:02 +0000
committerrubenwardy <rw@rubenwardy.com>2020-01-22 23:10:06 +0000
commit595d6ea3b6d663080448085cc2b0c9473388bc37 (patch)
tree09c7841f9ff18a6bb5a85af6a8b83d7c1e2f3d97 /app/blueprints/api/endpoints.py
parent71fa62fd6a10b3c39e236b65e5f4054e71770e2b (diff)
downloadcheatdb-595d6ea3b6d663080448085cc2b0c9473388bc37.tar.xz
Use server-side markdown renderer in WYSIWYG preview
Fixes #117
Diffstat (limited to 'app/blueprints/api/endpoints.py')
-rw-r--r--app/blueprints/api/endpoints.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/blueprints/api/endpoints.py b/app/blueprints/api/endpoints.py
index e37454f..266bf93 100644
--- a/app/blueprints/api/endpoints.py
+++ b/app/blueprints/api/endpoints.py
@@ -19,8 +19,10 @@ from flask import *
from flask_user import *
from . import bp
from .auth import is_api_authd
+from app import csrf
from app.models import *
from app.utils import is_package_page
+from app.markdown import render_markdown
from app.querybuilder import QueryBuilder
@bp.route("/api/packages/")
@@ -107,3 +109,9 @@ def whoami(token):
return jsonify({ "is_authenticated": False, "username": None })
else:
return jsonify({ "is_authenticated": True, "username": token.owner.username })
+
+
+@bp.route("/api/markdown/", methods=["POST"])
+@csrf.exempt
+def clean_markdown():
+ return render_markdown(request.data.decode("utf-8"))