From e3284416d2d80b239fab7a825b4fbaa5c93f2007 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 15 Jul 2018 21:12:57 +0200 Subject: [PATCH] Better Link support --- app.py | 4 +++- templates/index.html | 4 ++-- templates/stream.html | 2 +- templates/utils.html | 17 +++++++++-------- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app.py b/app.py index 9dbea90..91003bc 100644 --- a/app.py +++ b/app.py @@ -269,8 +269,10 @@ def domain(url): def get_url(u): if isinstance(u, dict): return u["href"] - else: + elif isinstance(u, str): return u + else: + raise ValueError(f"unexpected URL field type: {type(u)}: {u!r}") @app.template_filter() diff --git a/templates/index.html b/templates/index.html index 6cc2e37..a398087 100644 --- a/templates/index.html +++ b/templates/index.html @@ -27,7 +27,7 @@ {% set boost_actor = item.activity.actor | get_actor %} {% if session.logged_in %}
- {{ boost_actor.name }} boosted + {{ boost_actor.name }} boosted
@@ -37,7 +37,7 @@
{% else %}

- {{ boost_actor.name }} boosted + {{ boost_actor.name }} boosted

{% endif %} {% if item.meta.object %} diff --git a/templates/stream.html b/templates/stream.html index 26fdc3b..365288a 100644 --- a/templates/stream.html +++ b/templates/stream.html @@ -14,7 +14,7 @@ {% if item | has_type('Announce') %} {% set boost_actor = item.activity.actor | get_actor %} -

{{ boost_actor.name or boost_actor.preferredUsername }} boosted

+

{{ boost_actor.name or boost_actor.preferredUsername }} boosted

{% if item.meta.object %} {{ utils.display_note(item.meta.object, ui=True) }} {% endif %} diff --git a/templates/utils.html b/templates/utils.html index f2893d1..ffb4c11 100644 --- a/templates/utils.html +++ b/templates/utils.html @@ -31,7 +31,7 @@ {% if not perma %} - + {% endif %} @@ -47,7 +47,7 @@