diff --git a/app/main.py b/app/main.py index 217e611..fc28f78 100644 --- a/app/main.py +++ b/app/main.py @@ -76,6 +76,7 @@ _RESIZED_CACHE: MutableMapping[tuple[str, int], tuple[bytes, str, Any]] = LFUCac # TODO(ts): # # Next: +# - allow to interact with object not in anybox (i.e. like from a lookup) # - only show 10 most recent threads in DMs # - custom CSS for disabled button (e.g. sharing on a direct post) # - prevent double accept/double follow diff --git a/app/scss/main.scss b/app/scss/main.scss index 8265e3b..a1e8cf2 100644 --- a/app/scss/main.scss +++ b/app/scss/main.scss @@ -13,6 +13,44 @@ $code-highlight-background: #f0f0f0; // Load custom theme @import "theme.scss"; +.show-more-wrapper { + .p-summary { + display: inline-block; + } + label { + margin-left: 5px; + } + .show-more-state { + display: none; + } + .show-more-state ~ .obj-content { + margin-top: 0; + } + .show-more-state:checked ~ .obj-content { + display: none; + } +} +.sensitive-attachment { + display: inline-block; + .sensitive-attachment-state { + display: none; + } + .sensitive-attachment-state:checked ~ .sensitive-attachment-box div { + display:none; + } + .sensitive-attachment-box { + position: relative; + div { + position: absolute; + width: 100%; + height: 100%; + z-index: 10; + backdrop-filter: blur(2em); + } + } +} + + blockquote { border-left: 3px solid $secondary-color; margin-left: 0; @@ -207,8 +245,9 @@ footer { } } -.show-sensitive-btn, .show-more-btn { +.show-sensitive-btn, .show-more-btn, .label-btn { @include admin-button; + padding: 10px 5px; margin: 20px 0; } @@ -272,10 +311,10 @@ nav.flexbox { } } .activity-attachment { + margin: 30px 0; img, audio, video { width: 100%; max-width: 740px; - margin: 30px 0; } } img.inline-img { diff --git a/app/templates/utils.html b/app/templates/utils.html index 300c701..f170fdb 100644 --- a/app/templates/utils.html +++ b/app/templates/utils.html @@ -123,50 +123,6 @@ {% endmacro %} -{% macro sensitive_button(permalink_id) %} -
- -{% for k, v in request.query_params.items() %} - -{% endfor %} - -
-{% endmacro %} - -{% macro hide_sensitive_button(permalink_id) %} -
- {% for k, v in request.query_params.items() %} - {% if not (k == "show_sensitive" and v == permalink_id) %} - - {% endif %} - {% endfor %} - -
-{% endmacro %} - -{% macro show_more_button(permalink_id) %} -
- -{% for k, v in request.query_params.items() %} - -{% endfor %} - -
-{% endmacro %} - -{% macro show_less_button(permalink_id) %} -
- {% for k, v in request.query_params.items() %} - {% if not (k == "show_more" and v == permalink_id) %} - - {% endif %} - {% endfor %} - -
-{% endmacro %} - - - {% macro admin_reply_button(ap_object_id) %}
@@ -348,21 +304,26 @@ {% macro display_attachments(object) %} - {% if object.attachments and object.sensitive and not object.permalink_id in request.query_params.getlist("show_sensitive") %} - {{ sensitive_button(object.permalink_id )}} - {% endif %} - {% if object.attachments and (not object.sensitive or (object.sensitive and object.permalink_id in request.query_params.getlist("show_sensitive"))) %} - {% if object.sensitive %} - {{ hide_sensitive_button(object.permalink_id) }} - {% endif %} {% for attachment in object.attachments %} + {% 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 }} + {{ attachment.name }} {% endif %} {% elif attachment.type == "Video" or (attachment | has_media_type("video")) %} - + {% elif attachment.type == "Audio" or (attachment | has_media_type("audio")) %} {% elif attachment.type == "Link" %} @@ -370,8 +331,15 @@ {% else %} {{ attachment.url }} {% endif %} + {% if object.sensitive %} +
+
+
+
+ {% else %} +
+ {% endif %} {% endfor %} - {% endif %} {% endmacro %} {% macro display_object(object, likes=[], shares=[], webmentions=[], expanded=False, actors_metadata={}, is_object_page=False) %} @@ -403,25 +371,20 @@ {% endif %} - {% if object.summary %} -

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

+
+
+

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

+
+ + {% endif %} - - {% if object.sensitive and object.permalink_id not in request.query_params.getlist("show_more") %} - {{ show_more_button(object.permalink_id) }} - {% endif %} - - {% if not object.sensitive or (object.sensitive and object.permalink_id in request.query_params.getlist("show_more")) %} - {% if object.sensitive %} - {{ show_less_button(object.permalink_id) }} - {% endif %} +
{{ object.content | clean_html(object) | safe }}
- {% endif %} - {% if object.ap_type == "Question" and (not object.sensitive or (object.sensitive and object.permalink_id in request.query_params.getlist("show_more"))) %} + {% 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 %} @@ -468,12 +431,16 @@ {% endif %} + {{ display_og_meta(object) }} {% endif %} - {{ display_og_meta(object) }} +
+ {% if object.summary %} +
+ {% endif %} -
+
{{ display_attachments(object) }}