From a3cb459ae05d83af6265016f4989eac408412e96 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sat, 21 Jul 2018 00:04:15 +0200 Subject: [PATCH] Tweak the admin UI, start new lookup UI --- app.py | 14 +++++++++++++- templates/header.html | 11 ++++++++++- templates/layout.html | 2 ++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 9f1ea47..c830251 100644 --- a/app.py +++ b/app.py @@ -76,6 +76,7 @@ from config import _drop_db from config import custom_cache_purge_hook from utils.key import get_secret_key from utils.media import Kind +from utils.lookup import lookup back = activitypub.MicroblogPubBackend() @@ -843,7 +844,7 @@ def _build_thread(data, include_children=True): @app.route("/note/") def note_by_id(note_id): if is_api_request(): - return redirect(url_for('outbox_activity', item_id=note_id)) + return redirect(url_for("outbox_activity", item_id=note_id)) data = DB.activities.find_one( {"box": Box.OUTBOX.value, "remote_id": back.activity_url(note_id)} @@ -1229,6 +1230,17 @@ def admin(): ) +@app.route("/admin/lookup", methods=["GET", "POST"]) +@login_required +def admin_lookup(): + data = None + if request.method == "POST": + if request.form.get("url"): + data = lookup(request.form.get("url")) + + return render_template("lookup.html", data=data, url=request.form.get("url")) + + @app.route("/admin/thread") @login_required def admin_thread(): diff --git a/templates/header.html b/templates/header.html index eda8b41..287db10 100644 --- a/templates/header.html +++ b/templates/header.html @@ -1,15 +1,22 @@ diff --git a/templates/layout.html b/templates/layout.html index 42b2e95..a61a703 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -22,6 +22,8 @@
  • New
  • Stream
  • Notifications
  • +
  • Following
  • +
  • Lookup
  • Logout