aboutsummaryrefslogtreecommitdiff
path: root/gn2
diff options
context:
space:
mode:
authorAlexander_Kabui2024-08-19 14:08:57 +0300
committerBonfaceKilz2024-08-29 18:58:56 +0300
commita0f9be94930241544a00bf2f214daf9171d6a82f (patch)
tree6a38dad30da8ee3e89c699bdc17d509815576bee /gn2
parent93ac77ce6cd30b97577b2d216d184bd8188b8856 (diff)
downloadgenenetwork2-a0f9be94930241544a00bf2f214daf9171d6a82f.tar.gz
Integrate gn-auth to gn-editor.
Diffstat (limited to 'gn2')
-rw-r--r--gn2/wqflask/views.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/gn2/wqflask/views.py b/gn2/wqflask/views.py
index 4b003613..4c7a0ae2 100644
--- a/gn2/wqflask/views.py
+++ b/gn2/wqflask/views.py
@@ -311,6 +311,7 @@ def gnqna():
@app.route("/editor/", methods=["GET"])
+@require_oauth2
def edit_gn_doc_file():
file_path = request.args.get("file-path", "")
response = requests.get(f"http://localhost:8091/edit?file_path={file_path}")
@@ -319,21 +320,22 @@ def edit_gn_doc_file():
@app.route("/editor/settings", methods=["GET"])
+@require_oauth2
def configure_gn_editor():
return render_template("gn_editor_settings.html")
@app.route("/editor/commit", methods=["GET", "POST"])
+@require_oauth2
def commit_gn_doc():
- # TODO add gn-auth requirement for this endpoint
# TODO add env variable for gn-guile web server
if request.method == "GET":
return render_template("gn_editor_commit.html")
results = requests.post("http://localhost:8091/commit", json={
"content": request.form.get("content"),
"filename": request.form.get("file_path"),
- "email": "test@gmail.com",
- "username": "usernm1",
+ "username": session_info()["user"]["name"],
+ "email": session_info()["user"]["email"],
"commit_message": request.form.get("msg"),
"prev_commit": request.form.get("hash")})
data = results.json()