From d3486d6927c26493919727f213ebf3f703ae25eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Wed, 11 Jan 2023 23:28:38 +0000 Subject: [PATCH] push missing templates and css changes --- app/templates/admin_direct_messages.html | 20 + app/templates/admin_inbox.html | 46 + app/templates/admin_new.html | 94 ++ app/templates/admin_outbox.html | 35 + app/templates/admin_profile.html | 29 + app/templates/admin_stream.html | 18 + app/templates/articles.html | 20 + app/templates/custom_page.html | 30 + app/templates/error.html | 12 + app/templates/followers.html | 32 + app/templates/following.html | 32 + app/templates/header.html | 69 ++ app/templates/index.html | 60 ++ app/templates/indieauth_flow.html | 45 + app/templates/layout.html | 71 ++ app/templates/login.html | 21 + app/templates/lookup.html | 38 + app/templates/notifications.html | 126 +++ app/templates/object.html | 56 ++ app/templates/redirect.html | 15 + .../redirect_to_remote_instance.html | 15 + app/templates/remote_follow.html | 21 + app/templates/remote_interact.html | 27 + app/templates/utils.html | 853 ++++++++++++++++++ 24 files changed, 1785 insertions(+) create mode 100644 app/templates/admin_direct_messages.html create mode 100644 app/templates/admin_inbox.html create mode 100644 app/templates/admin_new.html create mode 100644 app/templates/admin_outbox.html create mode 100644 app/templates/admin_profile.html create mode 100644 app/templates/admin_stream.html create mode 100644 app/templates/articles.html create mode 100644 app/templates/custom_page.html create mode 100644 app/templates/error.html create mode 100644 app/templates/followers.html create mode 100644 app/templates/following.html create mode 100644 app/templates/header.html create mode 100644 app/templates/index.html create mode 100644 app/templates/indieauth_flow.html create mode 100644 app/templates/layout.html create mode 100644 app/templates/login.html create mode 100644 app/templates/lookup.html create mode 100644 app/templates/notifications.html create mode 100644 app/templates/object.html create mode 100644 app/templates/redirect.html create mode 100644 app/templates/redirect_to_remote_instance.html create mode 100644 app/templates/remote_follow.html create mode 100644 app/templates/remote_interact.html create mode 100644 app/templates/utils.html diff --git a/app/templates/admin_direct_messages.html b/app/templates/admin_direct_messages.html new file mode 100644 index 0000000..88ab312 --- /dev/null +++ b/app/templates/admin_direct_messages.html @@ -0,0 +1,20 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +blog.zak - Direct messages +{% endblock %} + +{% block content %} + +{% for anybox_object, convo, actors in threads %} +
+ With {% for actor in actors %} + + {{ actor.handle }} + + {% endfor %} +
+ {{ utils.display_object(anybox_object) }} +{% endfor %} +{% endblock %} diff --git a/app/templates/admin_inbox.html b/app/templates/admin_inbox.html new file mode 100644 index 0000000..6f9c266 --- /dev/null +++ b/app/templates/admin_inbox.html @@ -0,0 +1,46 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +blog.zak - Inbox +{% endblock %} + +{% block content %} + +{% if show_filters %} +{{ utils.display_box_filters("admin_inbox") }} +{% endif %} + +{% if not inbox %} +
+

Nothing to see yet, start following people in the lookup section.

+
+{% endif %} + +{% for inbox_object in inbox %} +{% if inbox_object.ap_type == "Announce" %} + {{ utils.actor_action(inbox_object, "shared", with_icon=True) }} + {{ utils.display_object(inbox_object.relates_to_anybox_object) }} +{% elif inbox_object.ap_type in ["Article", "Note", "Video", "Page", "Question"] %} +{{ utils.display_object(inbox_object) }} +{% elif inbox_object.ap_type == "Follow" %} + {{ utils.actor_action(inbox_object, "followed you") }} + {{ utils.display_actor(inbox_object.actor, actors_metadata) }} +{% elif inbox_object.ap_type == "Like" %} + {{ utils.actor_action(inbox_object, "liked one of your posts", with_icon=True) }} + {{ utils.display_object(inbox_object.relates_to_anybox_object) }} +{% else %} +

+ Implement {{ inbox_object.ap_type }} + {{ inbox_object.ap_object }} +

+{% endif %} +{% endfor %} + +{% if next_cursor %} +
+

See more

+
+{% endif %} + +{% endblock %} diff --git a/app/templates/admin_new.html b/app/templates/admin_new.html new file mode 100644 index 0000000..692f350 --- /dev/null +++ b/app/templates/admin_new.html @@ -0,0 +1,94 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +blog.zak - New +{% endblock %} + +{% block content %} + +{% if in_reply_to_object %} +
In reply to:
+{{ utils.display_object(in_reply_to_object) }} +{% endif %} + +
+ + + +
+ {{ utils.embed_csrf_token() }} + {{ utils.embed_redirect_url() }} +

+ +

+ + {% if request.query_params.type == "Article" %} +

+ +

+ {% endif %} + + + + + + {% if request.query_params.type == "Question" %} +

+ +

+

+ +

+ {% for i in ["1", "2", "3", "4"] %} +

+ +

+ {% endfor %} + {% endif %} + +

+ +

+

+ +

+ +

+ +

+
+

+ +

+
+
+ +{% endblock %} diff --git a/app/templates/admin_outbox.html b/app/templates/admin_outbox.html new file mode 100644 index 0000000..eae384e --- /dev/null +++ b/app/templates/admin_outbox.html @@ -0,0 +1,35 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +blog.zak - Outbox +{% endblock %} + +{% block content %} + +{{ utils.display_box_filters("admin_outbox") }} + +{% for outbox_object in outbox %} + + {% if outbox_object.ap_type == "Announce" %} +
You shared {{ outbox_object.ap_published_at | timeago }}
+ {{ utils.display_object(outbox_object.relates_to_anybox_object) }} + {% elif outbox_object.ap_type == "Like" %} +
You liked {{ outbox_object.ap_published_at | timeago }}
+ {{ utils.display_object(outbox_object.relates_to_anybox_object) }} + {% elif outbox_object.ap_type == "Follow" %} +
You followed {{ outbox_object.ap_published_at | timeago }}
+ {{ utils.display_actor(outbox_object.relates_to_actor, actors_metadata) }} + {% elif outbox_object.ap_type in ["Article", "Note", "Video", "Question"] %} + {{ utils.display_object(outbox_object) }} + {% endif %} + +{% endfor %} + +{% if next_cursor %} +
+

See more

+
+{% endif %} + +{% endblock %} diff --git a/app/templates/admin_profile.html b/app/templates/admin_profile.html new file mode 100644 index 0000000..9592bb2 --- /dev/null +++ b/app/templates/admin_profile.html @@ -0,0 +1,29 @@ +{%- import "utils.html" as utils with context -%} + +{% block head %} +blog.zak - {{ actor.display_name }} +{% endblock %} + +{% extends "layout.html" %} +{% block content %} + {{ utils.display_actor(actor, actors_metadata, with_details=True) }} + {% for inbox_object in inbox_objects %} + {% if inbox_object.ap_type == "Announce" %} + {{ utils.actor_action(inbox_object, "shared", with_icon=True) }} + {{ utils.display_object(inbox_object.relates_to_anybox_object) }} + {% else %} + {{ utils.display_object(inbox_object) }} + {% endif %} + {% endfor %} + +{% if next_cursor %} +
+

+ + See more + +

+
+{% endif %} + +{% endblock %} diff --git a/app/templates/admin_stream.html b/app/templates/admin_stream.html new file mode 100644 index 0000000..f07fbf5 --- /dev/null +++ b/app/templates/admin_stream.html @@ -0,0 +1,18 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +blog.zak - Stream +{% endblock %} + +{% block content %} + +{% for inbox_object in stream %} +{% if inbox_object.ap_type == "Announce" %} + {{ utils.display_object(inbox_object.relates_to_anybox_object) }} +{% elif inbox_object.ap_type in ["Article", "Note", "Video"] %} +{{ utils.display_object(inbox_object) }} +{% endif %} +{% endfor %} + +{% endblock %} diff --git a/app/templates/articles.html b/app/templates/articles.html new file mode 100644 index 0000000..f9d31a9 --- /dev/null +++ b/app/templates/articles.html @@ -0,0 +1,20 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +blog.zak - articles +{% endblock %} + +{% block content %} +{% include "header.html" %} + + + +{% endblock %} diff --git a/app/templates/custom_page.html b/app/templates/custom_page.html new file mode 100644 index 0000000..63dd2e6 --- /dev/null +++ b/app/templates/custom_page.html @@ -0,0 +1,30 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +{{ title }} +{% if request.url.path == "/" %} + + + + + + + + + + + + + +{% endif %} +{% endblock %} + +{% block content %} +{% include "header.html" %} + +
+ {{ page_content | safe }} +
+ +{% endblock %} diff --git a/app/templates/error.html b/app/templates/error.html new file mode 100644 index 0000000..c45a567 --- /dev/null +++ b/app/templates/error.html @@ -0,0 +1,12 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} +{% block main_tag %} class="main-flex"{% endblock %} +{% block head %} +{{ title }} +{% endblock %} + +{% block content %} +
+

{{ title | safe }}

+
+{% endblock %} diff --git a/app/templates/followers.html b/app/templates/followers.html new file mode 100644 index 0000000..609c16c --- /dev/null +++ b/app/templates/followers.html @@ -0,0 +1,32 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +blog.zak - followers + +{% endblock %} + +{% block content %} +{% include "header.html" %} +
+ + +{% set x_more = followers_count - followers | length %} +{% if x_more > 0 %} +
+

And {{ x_more }} more.

+
+{% endif %} + +{% if is_admin %} + +{% endif %} + +
+{% endblock %} diff --git a/app/templates/following.html b/app/templates/following.html new file mode 100644 index 0000000..4f35678 --- /dev/null +++ b/app/templates/following.html @@ -0,0 +1,32 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +blog.zak - follows + +{% endblock %} + +{% block content %} +{% include "header.html" %} +
+ + +{% set x_more = following_count - following | length %} +{% if x_more > 0 %} +
+

And {{ x_more }} more.

+
+{% endif %} + +{% if is_admin %} + +{% endif %} + +
+{% endblock %} diff --git a/app/templates/header.html b/app/templates/header.html new file mode 100644 index 0000000..3c8dc21 --- /dev/null +++ b/app/templates/header.html @@ -0,0 +1,69 @@ + diff --git a/app/templates/index.html b/app/templates/index.html new file mode 100644 index 0000000..eb790b8 --- /dev/null +++ b/app/templates/index.html @@ -0,0 +1,60 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +blog.zak + + + + + + + + + + + + + +{% endblock %} + +{% block content %} +{% include "header.html" %} + +{% if objects %} + +
+ + {% for outbox_object in objects %} + {% if outbox_object.ap_type in ["Note", "Video", "Question"] %} + {{ utils.display_object(outbox_object) }} + {% elif outbox_object.ap_type == "Announce" %} +
+ +
+ {{ utils.display_object(outbox_object.relates_to_anybox_object, is_h_entry=False) }} +
+
+ {% endif %} + {% endfor %} +
+ + {% if has_previous_page or has_next_page %} +
+ {% if has_previous_page %} + Previous + {% endif %} + + {% if has_next_page %} + Next + {% endif %} +
+ {% endif %} + +{% else %} +
+

Nothing to see here yet!

+
+{% endif %} + +{% endblock %} diff --git a/app/templates/indieauth_flow.html b/app/templates/indieauth_flow.html new file mode 100644 index 0000000..fb4d15c --- /dev/null +++ b/app/templates/indieauth_flow.html @@ -0,0 +1,45 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} +{% block content %} +
+
+ {% if client.logo %} + + {% endif %} +
+
+ {% if client.url %} + {{ client.name }} + {% else %} + {{ client.name }} + {% endif %} +

wants you to login{% if me %} as {{ me }}{% endif %} with the following redirect URI: {{ redirect_uri }}.

+ + +
+ {{ utils.embed_csrf_token() }} + {% if scopes %} +

Scopes

+
    + {% for scope in scopes %} +
  • +
  • + {% endfor %} +
+ {% endif %} + + + + + + + + +
+
+
+
+
+{% endblock %} diff --git a/app/templates/layout.html b/app/templates/layout.html new file mode 100644 index 0000000..db894a4 --- /dev/null +++ b/app/templates/layout.html @@ -0,0 +1,71 @@ + + + + + + + + + + + + +{% block head %}{% endblock %} + + +
+ +{% if is_admin %} +
+{% macro admin_link(url, text) %} +{% set url_for = BASE_URL + request.app.router.url_path_for(url) %} +{{ text }} +{% endmacro %} +
+ +
+ +
+{% endif %} +{% block content %}{% endblock %} + +
+ +{%- macro header_link(url, text) -%} +{% set url_for = BASE_URL + request.app.router.url_path_for(url) %} +{{ text }} +{% endmacro %} + + +{% if is_admin %} + +{% endif %} + + + diff --git a/app/templates/login.html b/app/templates/login.html new file mode 100644 index 0000000..8f3940a --- /dev/null +++ b/app/templates/login.html @@ -0,0 +1,21 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} +{% block head %} + +{% endblock %} +{% block main_tag %} class="main-flex"{% endblock %} +{% block content %} +
+
+ {% if error %} +

Invalid password.

+ {% endif %} +
+ + + + +
+
+
+{% endblock %} diff --git a/app/templates/lookup.html b/app/templates/lookup.html new file mode 100644 index 0000000..fc100f2 --- /dev/null +++ b/app/templates/lookup.html @@ -0,0 +1,38 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +blog.zak - Lookup +{% endblock %} + +{% block content %} + +
+

Interact with an ActivityPub object via its URL or look for a user using @user@domain.tld

+ +
+ + +
+
+ + {% if error %} +
+ {% if error.value == "NOT_FOUND" %} +

The remote object is unavailable.

+ {% elif error.value == "UNAUTHORIZED" %} +

Missing permissions to fetch the remote object.

+ {% elif error.value == "TIMEOUT" %} +

Lookup timed out, please try refreshing the page.

+ {% else %} +

Unexpected error, please check the logs and report an issue if needed.

+ {% endif %} +
+ {% endif %} + + {% if ap_object and ap_object.ap_type in actor_types %} + {{ utils.display_actor(ap_object, actors_metadata, with_details=True) }} + {% elif ap_object %} + {{ utils.display_object(ap_object, actors_metadata=actors_metadata) }} + {% endif %} +{% endblock %} diff --git a/app/templates/notifications.html b/app/templates/notifications.html new file mode 100644 index 0000000..d94a032 --- /dev/null +++ b/app/templates/notifications.html @@ -0,0 +1,126 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +blog.zak - Notifications +{% endblock %} + +{% macro notif_actor_action(notif, text, with_icon=False) %} +
+ + {% if with_icon %}{{ utils.display_tiny_actor_icon(notif.actor) }}{% endif %} {{ notif.actor.display_name | clean_html(notif.actor) | safe }} {{ text }} + {{ notif.created_at | timeago }} + {% if notif.is_new %} + new + {% endif %} +
+{% endmacro %} + +{% block content %} +
+

Notifications

+
+
+ {%- for notif in notifications %} +
+ {%- if notif.notification_type.value == "new_follower" %} + {{ notif_actor_action(notif, "followed you") }} + {{ utils.display_actor(notif.actor, actors_metadata) }} + {%- elif notif.notification_type.value == "pending_incoming_follower" %} + {{ notif_actor_action(notif, "sent a follow request") }} + {{ utils.display_actor(notif.actor, actors_metadata, pending_incoming_follow_notif=notif) }} + {% elif notif.notification_type.value == "rejected_follower" %} + {% elif notif.notification_type.value == "unfollow" %} + {{ notif_actor_action(notif, "unfollowed you") }} + {{ utils.display_actor(notif.actor, actors_metadata) }} + {%- elif notif.notification_type.value == "follow_request_accepted" %} + {{ notif_actor_action(notif, "accepted your follow request") }} + {{ utils.display_actor(notif.actor, actors_metadata) }} + {%- elif notif.notification_type.value == "follow_request_rejected" %} + {{ notif_actor_action(notif, "rejected your follow request") }} + {{ utils.display_actor(notif.actor, actors_metadata) }} + {% elif notif.notification_type.value == "blocked" %} + {{ notif_actor_action(notif, "blocked you") }} + {{ utils.display_actor(notif.actor, actors_metadata) }} + {% elif notif.notification_type.value == "unblocked" %} + {{ notif_actor_action(notif, "unblocked you") }} + {{ utils.display_actor(notif.actor, actors_metadata) }} + {% elif notif.notification_type.value == "block" %} + {{ notif_actor_action(notif, "was blocked") }} + {{ utils.display_actor(notif.actor, actors_metadata) }} + {% elif notif.notification_type.value == "unblock" %} + {{ notif_actor_action(notif, "was unblocked") }} + {{ utils.display_actor(notif.actor, actors_metadata) }} + {%- elif notif.notification_type.value == "move" %} + {# for move notif, the actor is the target and the inbox object the Move activity #} + + {{ utils.display_actor(notif.actor) }} + {% elif notif.notification_type.value == "like" %} + {{ notif_actor_action(notif, "liked a post", with_icon=True) }} + {{ utils.display_object(notif.outbox_object) }} + {% elif notif.notification_type.value == "undo_like" %} + {{ notif_actor_action(notif, "unliked a post", with_icon=True) }} + {{ utils.display_object(notif.outbox_object) }} + {% elif notif.notification_type.value == "announce" %} + {{ notif_actor_action(notif, "shared a post", with_icon=True) }} + {{ utils.display_object(notif.outbox_object) }} + {% elif notif.notification_type.value == "undo_announce" %} + {{ notif_actor_action(notif, "unshared a post", with_icon=True) }} + {{ utils.display_object(notif.outbox_object) }} + {% elif notif.notification_type.value == "mention" %} + {{ notif_actor_action(notif, "mentioned you") }} + {{ utils.display_object(notif.inbox_object) }} + {% elif notif.notification_type.value == "new_webmention" %} +
+ new webmention from + {% set facepile_item = notif.webmention.as_facepile_item %} + {% if facepile_item %} + {{ facepile_item.actor_name }} + {% endif %} + {{ notif.webmention.source }} +
+ {{ utils.display_object(notif.outbox_object) }} + {% elif notif.notification_type.value == "updated_webmention" %} +
+ updated webmention from + {% set facepile_item = notif.webmention.as_facepile_item %} + {% if facepile_item %} + {{ facepile_item.actor_name }} + {% endif %} + {{ notif.webmention.source }} +
+ {{ utils.display_object(notif.outbox_object) }} + {% elif notif.notification_type.value == "deleted_webmention" %} +
+ deleted webmention from + {% set facepile_item = notif.webmention.as_facepile_item %} + {% if facepile_item %} + {{ facepile_item.actor_name }} + {% endif %} + {{ notif.webmention.source }} +
+ {{ utils.display_object(notif.outbox_object) }} + {% else %} +
+ Implement {{ notif.notification_type }} +
+ {%- endif %} +
+ {%- endfor %} +
+ +{% if next_cursor %} +
+

+ + See more{% if more_unread_count %} ({{ more_unread_count }} unread left){% endif %} + +

+
+{% endif %} + +{% endblock %} diff --git a/app/templates/object.html b/app/templates/object.html new file mode 100644 index 0000000..812493a --- /dev/null +++ b/app/templates/object.html @@ -0,0 +1,56 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +{% if outbox_object %} +{% if outbox_object.content %} + {% set excerpt = outbox_object.content | html2text | trim | truncate(50) %} +{% else %} + {% set excerpt = outbox_object.summary | html2text | trim | truncate(50) %} +{% endif %} +{% if outbox_object.name %}{{ outbox_object.name }}{% else %}{{ local_actor.display_name }}: "{{ excerpt }}"{% endif %} + + + + + + + + + + +{% endif %} +{% endblock %} + +{% block content %} + +{% if outbox_object %} +{% include "header.html" %} +{% endif %} + +{% macro display_replies_tree(replies_tree_node) %} + +{% if replies_tree_node.is_requested %} +{{ utils.display_object(replies_tree_node.ap_object, likes=likes, shares=shares, webmentions=webmentions, expanded=not replies_tree_node.is_root, is_object_page=True, is_h_entry=False) }} +{% else %} + {% if replies_tree_node.wm_reply %} + {# u-comment h-cite is displayed by default for webmention #} + {{ utils.display_webmention_reply(replies_tree_node.wm_reply) }} + {% else %} +
+ {{ utils.display_object(replies_tree_node.ap_object, is_h_entry=False) }} +
+ {% endif %} +{% endif %} + +{% for child in replies_tree_node.children %} + {{ display_replies_tree(child) }} +{% endfor %} + +{% endmacro %} + +
+{{ display_replies_tree(replies_tree) }} +
+ +{% endblock %} diff --git a/app/templates/redirect.html b/app/templates/redirect.html new file mode 100644 index 0000000..8b8db7e --- /dev/null +++ b/app/templates/redirect.html @@ -0,0 +1,15 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +blog.zak - Redirect +{% endblock %} + +{% block content %} +{% include "header.html" %} + +
+

You are being redirected to: {{ url }}

+
+ +{% endblock %} diff --git a/app/templates/redirect_to_remote_instance.html b/app/templates/redirect_to_remote_instance.html new file mode 100644 index 0000000..b5e5cfd --- /dev/null +++ b/app/templates/redirect_to_remote_instance.html @@ -0,0 +1,15 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +blog.zak - Redirect +{% endblock %} + +{% block content %} +{% include "header.html" %} + +
+

You are being redirected to your instance: {{ url }}

+
+ +{% endblock %} diff --git a/app/templates/remote_follow.html b/app/templates/remote_follow.html new file mode 100644 index 0000000..ed25be0 --- /dev/null +++ b/app/templates/remote_follow.html @@ -0,0 +1,21 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +Remote follow {{ local_actor.display_name }} + +{% endblock %} + +{% block content %} +{% include "header.html" %} + +
+

Remotely follow {{ local_actor.display_name }}

+
+ {{ utils.embed_csrf_token() }} + + +
+
+ +{% endblock %} diff --git a/app/templates/remote_interact.html b/app/templates/remote_interact.html new file mode 100644 index 0000000..0fbfe26 --- /dev/null +++ b/app/templates/remote_interact.html @@ -0,0 +1,27 @@ +{%- import "utils.html" as utils with context -%} +{% extends "layout.html" %} + +{% block head %} +Interact from your instance + +{% endblock %} + +{% block content %} +{% include "header.html" %} + +
+

Interact with this object

+
+ +{{ utils.display_object(outbox_object) }} + +
+
+ {{ utils.embed_csrf_token() }} + + + +
+
+ +{% endblock %} diff --git a/app/templates/utils.html b/app/templates/utils.html new file mode 100644 index 0000000..d88a881 --- /dev/null +++ b/app/templates/utils.html @@ -0,0 +1,853 @@ +{% macro embed_csrf_token() %} +{% block embed_csrf_token scoped %} + +{% endblock %} +{% endmacro %} + +{% macro embed_redirect_url(permalink_id=None) %} +{% block embed_redirect_url scoped %} + +{% endblock %} +{% endmacro %} + +{% macro admin_block_button(actor) %} +{% block admin_block_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url() }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_unblock_button(actor) %} +{% block admin_unblock_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url() }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_hide_shares_button(actor) %} +{% block admin_hide_shares_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url() }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_show_shares_button(actor) %} +{% block admin_show_shares_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url() }} + + +
+{% endblock %} +{% endmacro %} + + +{% macro admin_follow_button(actor) %} +{% block admin_follow_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url() }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_accept_incoming_follow_button(notif) %} +{% block admin_accept_incoming_follow_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url() }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_reject_incoming_follow_button(notif) %} +{% block admin_reject_incoming_follow_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url() }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_like_button(ap_object_id, permalink_id) %} +{% block admin_like_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url(permalink_id) }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_bookmark_button(ap_object_id, permalink_id) %} +{% block admin_bookmark_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url(permalink_id) }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_unbookmark_button(ap_object_id, permalink_id) %} +{% block admin_unbookmark_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url(permalink_id) }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_pin_button(ap_object_id, permalink_id) %} +{% block admin_pin_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url(permalink_id) }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_unpin_button(ap_object_id, permalink_id) %} +{% block admin_unpin_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url(permalink_id) }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_delete_button(ap_object) %} +{% block admin_delete_button scoped %} +
+ {{ embed_csrf_token() }} + + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_force_delete_button(ap_object_id, permalink_id=None) %} +{% block admin_force_delete_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url(permalink_id) }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_force_delete_webmention_button(webmention_id, permalink_id=None) %} +{% block admin_force_delete_webmention_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url(permalink_id) }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_announce_button(ap_object_id, permalink_id=None) %} +{% block admin_announce_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url(permalink_id) }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_undo_button(ap_object_id, action="undo", permalink_id=None) %} +{% block admin_undo_button scoped %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url(permalink_id) }} + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_reply_button(ap_object_id) %} +{% block admin_reply_button scoped %} +
+ + +
+{% endblock %} +{% endmacro %} + +{% macro admin_dm_button(actor_handle) %} +{% block admin_dm_button scoped %} +
+ + + +
+{% endblock %} +{% endmacro %} + +{% macro admin_mention_button(actor_handle) %} +{% block admin_mention_button scoped %} +
+ + +
+{% endblock %} +{% endmacro %} + + + +{% macro admin_profile_button(ap_actor_id) %} +{% block admin_profile_button scoped %} +
+ + +
+{% endblock %} +{% endmacro %} + +{% macro admin_expand_button(ap_object) %} +{% block admin_expand_button scoped %} +{# TODO turn these into a regular link and append permalink ID if it's a reply #} +
+ + +
+{% endblock %} +{% endmacro %} + +{% macro display_box_filters(route) %} +{% block display_box_filters scoped %} + +{% endblock %} +{% endmacro %} + +{% macro display_tiny_actor_icon(actor) %} +{% block display_tiny_actor_icon scoped %} + +{% endblock %} +{% endmacro %} + +{% macro actor_action(inbox_object, text, with_icon=False) %} +{% block actor_action scoped %} +
+ + {% if with_icon %}{{ display_tiny_actor_icon(inbox_object.actor) }}{% endif %} {{ inbox_object.actor.display_name | clean_html(inbox_object.actor) | safe }} + {{ text }} + {{ inbox_object.ap_published_at | timeago }} +
+ +{% endblock %} +{% endmacro %} + +{% macro display_actor(actor, actors_metadata={}, embedded=False, with_details=False, pending_incoming_follow_notif=None) %} +{% block display_actor scoped %} +{% set metadata = actors_metadata.get(actor.ap_id) %} + +{% if not embedded %} +
+{% endif %} + + + +{% if is_admin and metadata %} +
+ +
+{% endif %} + +{% if with_details %} + {% if actor.summary %} +
+ {{ actor.summary | clean_html(actor) | safe }} +
+ {% endif %} + + {% if actor.attachments %} +
+ {% for prop in actor.attachments %} +
+ {% if prop.type == "PropertyValue" %} +
{{ prop.name }}
+
{{ prop.value | clean_html(actor) | safe }}
+ {% endif %} +
+ {% endfor %} +
+ {% endif %} +{% endif %} + +{% if not embedded %} +
+{% endif %} + +{% endblock %} +{% endmacro %} + +{% macro display_og_meta(object) %} +{% block display_og_meta scoped %} +{% if object.og_meta %} +{% for og_meta in object.og_meta[:1] %} +
+ {% if og_meta.image %} +
+ +
+ {% endif %} +
+ {{ og_meta.title }} + {% if og_meta.site_name %} + {{ og_meta.site_name }} + {% endif %} +
+
+{% endfor %} +{% endif %} +{% endblock %} +{% endmacro %} + + +{% macro display_attachments(object) %} +{% block display_attachments scoped %} + + {% for attachment in object.attachments %} + {% if attachment.type != "PropertyValue" %} + {% set orientation = "unknown" %} + {% if attachment.width %} + {% set orientation = "portrait" if attachment.width < attachment.height else "landscape" %} + {% endif %} + {% if object.sensitive and (attachment.type == "Image" or (attachment | has_media_type("image")) or attachment.type == "Video" or (attachment | has_media_type("video"))) %} +
+ +
+
+ +
+
+ {% else %} +
+ {% endif %} + + {% if attachment.type == "Image" or (attachment | has_media_type("image")) %} + {% if attachment.url not in object.inlined_images %} + + {{ attachment.name }} + + {% endif %} + {% elif attachment.type == "Video" or (attachment | has_media_type("video")) %} +
+ +
GIF
+
+ {% elif attachment.type == "Audio" or (attachment | has_media_type("audio")) %} + + {% elif attachment.type == "Link" %} + {{ attachment.url | truncate(64, True) }} ({{ attachment.mimetype}}) + {% else %} + + {% if attachment.name %}{{ attachment.name }}{% else %}{{ attachment.url | truncate(64, True) }}{% endif %} + ({{ attachment.mimetype }}) + {% endif %} + {% if object.sensitive and (attachment.type == "Image" or (attachment | has_media_type("image")) or attachment.type == "Video" or (attachment | has_media_type("video"))) %} +
+
+
+
+ {% else %} +
+ {% endif %} + {% endif %} + {% endfor %} +{% endblock %} +{% endmacro %} + +{% macro display_webmention_reply(wm_reply) %} +{% block display_webmention_reply scoped %} + +
+ + +

in reply to + this object +

+ +
+
+ {{ wm_reply.content | clean_html_wm | safe }} +
+
+ + +
+ +{% endblock %} +{% endmacro %} + +{% macro display_object(object, likes=[], shares=[], webmentions=[], expanded=False, actors_metadata={}, is_object_page=False, is_h_entry=True) %} +{% block display_object scoped %} +{% set is_article_mode = object.is_from_outbox and object.ap_type == "Article" and is_object_page %} +{% if object.ap_type in ["Note", "Article", "Video", "Page", "Question", "Event"] %} +
+ + {% if is_article_mode %} + + + + + + {% else %} + {{ display_actor(object.actor, actors_metadata, embedded=True) }} + {% endif %} + + {% if object.in_reply_to %} +

in reply to + this object +

+ {% endif %} + + {% if object.ap_type in ["Article", "Event"] %} +

{{ object.name }}

+ {% endif %} + + {% if object.ap_type == "Event" %} + {% if object.ap_object.get("endTime") and object.ap_object.get("startTime") %} +

On {{ object.ap_object.startTime | parse_datetime | format_date }} + (ends {{ object.ap_object.endTime | parse_datetime | format_date }})

+ {% endif %} + {% endif %} + + {% if object.ap_object.get("location") %} + {% set loc = object.ap_object.get("location") %} + {% if loc.type == "Place" and loc.latitude and loc.longitude %} +
+

Location

+ {% if loc.name %}{{ loc.name }}{% endif %} + + + + {{loc.latitude}},{{loc.longitude}} + +
+ {% endif %} + {% endif %} + + {% if is_article_mode %} + + {% endif %} + + {% if object.summary %} +
+ +
+

{{ object.summary | clean_html(object) | safe }}

+
+ +
+ {% endif %} +
+
+ {{ object.content | clean_html(object) | safe }} +
+ + {% if object.ap_type == "Question" %} + {% set can_vote = is_admin and object.is_from_inbox and not object.is_poll_ended and not object.voted_for_answers %} + {% if can_vote %} +
+ {{ embed_csrf_token() }} + {{ embed_redirect_url(object.permalink_id) }} + + {% endif %} + + {% if object.poll_items %} +
    + {% for item in object.poll_items %} +
  • + {% set pct = item | poll_item_pct(object.poll_voters_count) %} +

    + {% if can_vote %} + + + {% endif %} + + {{ pct }}% ({{ item.replies.totalItems }} votes) +

    + + + +
  • + {% endfor %} +
+ {% endif %} + + {% if can_vote %} +

+ +

+
+ {% endif %} + + + {% endif %} + + {{ display_og_meta(object) }} + +
+ {% if object.summary %} +
+ {% endif %} + +
+ {{ display_attachments(object) }} +
+ + + + {% if is_admin %} + + {% endif %} + + + {% if likes or shares or webmentions %} +
+ {% if likes %} +
Likes +
+ {% for like in likes %} + + {{ like.name }} + + {% endfor %} + {% if object.likes_count > likes | length %} +
+ and {{ object.likes_count - likes | length }} more. +
+ {% endif %} +
+
+ {% endif %} + + {% if shares %} +
Shares +
+ {% for share in shares %} + + {{ share.name }} + + {% endfor %} + {% if object.announces_count > shares | length %} +
+ and {{ object.announces_count - shares | length }} more. +
+ {% endif %} +
+
+ {% endif %} + + {% if webmentions %} +
Webmentions +
+ {% for webmention in webmentions %} + {% set wm = webmention.as_facepile_item %} + {% if wm %} + + {{ wm.actor_name }} + + {% endif %} + {% endfor %} +
+
+ {% endif %} + +
+ {% endif %} + + +
+{% endif %} +{% endblock %} +{% endmacro %}