Tweak the admin UI, start new lookup UI

This commit is contained in:
Thomas Sileo 2018-07-21 00:04:15 +02:00
parent dc8365ff53
commit a3cb459ae0
3 changed files with 25 additions and 2 deletions

14
app.py
View file

@ -76,6 +76,7 @@ from config import _drop_db
from config import custom_cache_purge_hook from config import custom_cache_purge_hook
from utils.key import get_secret_key from utils.key import get_secret_key
from utils.media import Kind from utils.media import Kind
from utils.lookup import lookup
back = activitypub.MicroblogPubBackend() back = activitypub.MicroblogPubBackend()
@ -843,7 +844,7 @@ def _build_thread(data, include_children=True):
@app.route("/note/<note_id>") @app.route("/note/<note_id>")
def note_by_id(note_id): def note_by_id(note_id):
if is_api_request(): 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( data = DB.activities.find_one(
{"box": Box.OUTBOX.value, "remote_id": back.activity_url(note_id)} {"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") @app.route("/admin/thread")
@login_required @login_required
def admin_thread(): def admin_thread():

View file

@ -1,15 +1,22 @@
<div id="header"> <div id="header">
<div class="h-card p-author"> <div class="h-card p-author">
<data class="u-photo" value="{{ config.ME.icon.url }}"></data> <data class="u-photo" value="{{ config.ME.icon.url }}"></data>
<a href="{{ config.ID }}" class="u-url u-uid no-hover title"> <a href="{{ config.ID }}" class="u-url u-uid no-hover title">
<span style="font-size:1.1em;">{{ config.NAME }}</span> <span style="font-size:1.1em;">{{ config.NAME }}</span>
<span style="font-size:0.85em;" class="subtitle-username">@<span class="gold p-name">{{ config.USERNAME }}</span>@<span class="gold">{{ config.DOMAIN }}</span> <span style="font-size:0.85em;" class="subtitle-username">@<span class="gold p-name">{{ config.USERNAME }}</span>@<span class="gold">{{ config.DOMAIN }}</span>
<small><a class="remote-follow-button" href="/remote_follow">Remote follow</a></small> {% if not session.logged_in %}<small><a class="remote-follow-button" href="/remote_follow">Remote follow</a></small>{% endif %}
</a> </a>
{% if not request.path.startswith('/admin') %}
<div class="p-note summary"> <div class="p-note summary">
{{ config.SUMMARY | safe }} {{ config.SUMMARY | safe }}
</div> </div>
{% endif %}
</div> </div>
{% if not request.path.startswith('/admin') %}
<div class="menu"> <div class="menu">
<ul> <ul>
<li><a href="/" {% if request.path == "/" %}class="selected"{% endif %}>Notes <small class="badge">{{ notes_count }}</small></a></li> <li><a href="/" {% if request.path == "/" %}class="selected"{% endif %}>Notes <small class="badge">{{ notes_count }}</small></a></li>
@ -22,4 +29,6 @@
--> -->
</ul> </ul>
</div> </div>
{% endif %}
</div> </div>

View file

@ -22,6 +22,8 @@
<li class="left"><a href="/admin/new"{% if request.path == "/admin/new" %} class="selected" {% endif %}>New</a></li> <li class="left"><a href="/admin/new"{% if request.path == "/admin/new" %} class="selected" {% endif %}>New</a></li>
<li class="left"><a href="/admin/stream"{% if request.path == "/admin/stream" %} class="selected" {% endif %}>Stream</a></li> <li class="left"><a href="/admin/stream"{% if request.path == "/admin/stream" %} class="selected" {% endif %}>Stream</a></li>
<li class="left"><a href="/admin/notifications"{% if request.path == "/admin/notifications" %} class="selected" {% endif %}>Notifications</a></li> <li class="left"><a href="/admin/notifications"{% if request.path == "/admin/notifications" %} class="selected" {% endif %}>Notifications</a></li>
<li class="left"><a href="/following"{% if request.path == "/following" %} class="selected" {% endif %}>Following</a></li>
<li class="left"><a href="/admin/lookup"{% if request.path == "/admin/lookup" %} class="selected" {% endif %}>Lookup</a></li>
<li class="left"><a href="/admin/logout">Logout</a></li> <li class="left"><a href="/admin/logout">Logout</a></li>
</ul> </ul>
</div> </div>