aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask
diff options
context:
space:
mode:
authorAlexander_Kabui2024-08-12 16:16:08 +0300
committerBonfaceKilz2024-08-29 18:58:56 +0300
commit1d9e79d08c28369147ba52809fc1456e9aafcee6 (patch)
treea76b2a66d7b7c1d4fe62f299c1f6d2f93c758255 /gn2/wqflask
parent1663442724c43cf763d56592f505981cd911cceb (diff)
downloadgenenetwork2-1d9e79d08c28369147ba52809fc1456e9aafcee6.tar.gz
Fetch file path as query parameter.
Diffstat (limited to 'gn2/wqflask')
-rw-r--r--gn2/wqflask/views.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/gn2/wqflask/views.py b/gn2/wqflask/views.py
index 14929b28..562976b1 100644
--- a/gn2/wqflask/views.py
+++ b/gn2/wqflask/views.py
@@ -311,31 +311,31 @@ def gnqna():
@app.route("/editor/", methods=["GET"])
-def edit_gn_file():
- import requests
- results = requests.get("http://localhost:8091/edit?file_path=test.md")
- data = results.json()
- return render_template("gn_editor.html", **data)
+def edit_gn_doc_file():
+ file_path = request.args.get("file_path", "")
+ response = requests.get(f"http://localhost:8091/edit?file_path={file_path}")
+ response.raise_for_status()
+ return render_template("gn_editor.html", **response.json())
@app.route("/editor/settings", methods=["GET"])
-def editor_settings():
+def configure_gn_editor():
return render_template("gn_editor_settings.html")
@app.route("/editor/commit", methods=["GET", "POST"])
-def commit_editor():
+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", #replace this from auth
- "username": "usernm1", # replace this username
+ "email": "test@gmail.com",
+ "username": "usernm1",
"commit_message": request.form.get("msg"),
"prev_commit": request.form.get("hash")})
- # check if error here and show results page
- # use ok here
data = results.json()
data["filename"] = request.form.get("file_path")
return render_template("gn_editor_results_page.html", **data)