add: store avatars and banners in uploads
This commit is contained in:
parent
1e50ace8b2
commit
dbed2b2457
36 changed files with 211 additions and 363 deletions
|
@ -84,7 +84,7 @@
|
|||
("class" "card_nest")
|
||||
(div
|
||||
("class" "card small flex flex_row gap_2 items_center")
|
||||
(text "{{ components::avatar(username=user.id, size=\"32px\", selector_type=\"id\") }}")
|
||||
(text "{{ components::avatar(id=user.id, size=\"32px\") }}")
|
||||
(select
|
||||
("id" "community_to_post_to")
|
||||
("onchange" "update_community_avatar(event); check_community_supports_title(event)")
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
(text "{% macro avatar(username, size=\"24px\", selector_type=\"username\") -%}")
|
||||
(text "{% macro avatar(id, size=\"24px\") -%}")
|
||||
(img
|
||||
("title" "{{ username }}'s avatar")
|
||||
("src" "/api/v1/auth/user/{{ username }}/avatar?selector_type={{ selector_type }}")
|
||||
("alt" "@{{ username }}")
|
||||
("title" "User avatar")
|
||||
("src" "{{ config.service_hosts.buckets }}/avatars/{{ id }}")
|
||||
("alt" "User avatar")
|
||||
("class" "avatar shadow")
|
||||
("loading" "lazy")
|
||||
("style" "--size: {{ size }}"))
|
||||
|
@ -20,11 +20,11 @@
|
|||
("class" "avatar shadow")
|
||||
("loading" "lazy")
|
||||
("style" "--size: {{ size }}"))
|
||||
(text "{%- endif %} {%- endmacro %} {% macro banner(username, border_radius=\"var(--radius)\") -%}")
|
||||
(text "{%- endif %} {%- endmacro %} {% macro banner(id, border_radius=\"var(--radius)\") -%}")
|
||||
(img
|
||||
("title" "{{ username }}'s banner")
|
||||
("src" "/api/v1/auth/user/{{ username }}/banner")
|
||||
("alt" "@{{ username }}'s banner")
|
||||
("title" "User banner")
|
||||
("src" "{{ config.service_hosts.buckets }}/banners/{{ id }}")
|
||||
("alt" "User banner")
|
||||
("class" "banner shadow w_full")
|
||||
("loading" "lazy")
|
||||
("style" "border-radius: {{ border_radius }};"))
|
||||
|
@ -372,7 +372,7 @@
|
|||
(text "{% if not expect_repost -%}")
|
||||
(a
|
||||
("href" "/@{{ owner.username }}")
|
||||
(text "{{ self::avatar(username=owner.username, size=\"52px\", selector_type=\"username\") }}"))
|
||||
(text "{{ self::avatar(id=owner.id, size=\"52px\") }}"))
|
||||
(text "{%- endif %}")
|
||||
(div
|
||||
("class" "flex flex_col w_full gap_1 post_right {% if expect_repost -%}repost{%- endif %}")
|
||||
|
@ -381,7 +381,7 @@
|
|||
(text "{% if expect_repost -%}")
|
||||
(a
|
||||
("href" "/@{{ owner.username }}")
|
||||
(text "{{ self::avatar(username=owner.username, size=\"24px\", selector_type=\"username\") }}"))
|
||||
(text "{{ self::avatar(id=owner.id, size=\"24px\") }}"))
|
||||
(text "{%- endif %}")
|
||||
(span
|
||||
; ("class" "name")
|
||||
|
@ -542,7 +542,7 @@
|
|||
(a
|
||||
("href" "/@{{ owner.username }}")
|
||||
("class" "mobile")
|
||||
(text "{{ self::avatar(username=owner.username, size=\"24px\", selector_type=\"username\") }}"))
|
||||
(text "{{ self::avatar(id=owner.id, size=\"24px\") }}"))
|
||||
(span
|
||||
("class" "name")
|
||||
(text "{{ self::full_username(user=owner) }}"))
|
||||
|
@ -561,7 +561,7 @@
|
|||
("style" "min-width: 200px")
|
||||
(a
|
||||
("href" "/@{{ owner.username }}")
|
||||
(text "{{ self::avatar(username=owner.username, size=\"64px\", selector_type=\"username\") }}"))
|
||||
(text "{{ self::avatar(id=owner.id, size=\"64px\") }}"))
|
||||
(div
|
||||
("class" "fade flex flex_col")
|
||||
("style" "font-size: 12px")
|
||||
|
@ -617,10 +617,10 @@
|
|||
(div
|
||||
("class" "card small")
|
||||
("style" "padding: 0")
|
||||
(text "{{ self::banner(username=user.username, border_radius=\"0px\") }}"))
|
||||
(text "{{ self::banner(id=user.id, border_radius=\"0px\") }}"))
|
||||
(div
|
||||
("class" "card secondary flex items_center gap_4")
|
||||
(text "{{ self::avatar(username=user.username, size=\"24px\") }}")
|
||||
(text "{{ self::avatar(id=user.id, size=\"24px\") }}")
|
||||
(b
|
||||
("class" "flex items_center gap_2")
|
||||
(text "{{ self::username(user=user) }}")
|
||||
|
@ -768,11 +768,11 @@
|
|||
("class" "avatar shadow")
|
||||
("loading" "lazy")
|
||||
("style" "--size: 52px"))
|
||||
(text "{% else %} {{ self::avatar(username=\"anonymous\", selector_type=\"username\", size=\"52px\") }} {%- endif %}"))
|
||||
(text "{% else %} {{ self::avatar(id=\"0\", size=\"52px\") }} {%- endif %}"))
|
||||
(text "{% else %}")
|
||||
(a
|
||||
("href" "/@{{ owner.username }}")
|
||||
(text "{{ self::avatar(username=owner.username, selector_type=\"username\", size=\"52px\") }}"))
|
||||
(text "{{ self::avatar(id=owner.id, size=\"52px\") }}"))
|
||||
(text "{%- endif %}")
|
||||
(div
|
||||
("class" "flex flex_col gap_1 w_full")
|
||||
|
@ -1186,7 +1186,7 @@
|
|||
(a
|
||||
("href" "/@{{ user.username }}")
|
||||
("target" "_top")
|
||||
(text "{{ self::avatar(username=user.username, size=\"42px\") }}"))
|
||||
(text "{{ self::avatar(id=user.id, size=\"42px\") }}"))
|
||||
(text "{%- endif %}")
|
||||
(div
|
||||
("class" "flex flex_col gap_1 w_full")
|
||||
|
@ -1354,7 +1354,7 @@
|
|||
("class" "flex gap_2 items_center card tiny user_plate {% if secondary -%}secondary{%- endif %} {% if full -%} w_full {%- endif %}")
|
||||
(a
|
||||
("href" "/@{{ user.username }}")
|
||||
(text "{{ self::avatar(username=user.username, size=\"42px\", selector_type=\"username\") }}"))
|
||||
(text "{{ self::avatar(id=user.id, size=\"42px\") }}"))
|
||||
(div
|
||||
("class" "flex justify_center flex_col")
|
||||
("style" "{% if show_menu or show_kick -%}width: 60%{% else %}max-width: calc(100% - 42px - var(--pad-4)){%- endif %}")
|
||||
|
@ -2127,7 +2127,7 @@
|
|||
; user info
|
||||
(a
|
||||
("href" "/@{{ owner.username }}")
|
||||
(text "{{ self::avatar(username=owner.username, size=\"24px\", selector_type=\"username\") }}"))
|
||||
(text "{{ self::avatar(id=owner.id, size=\"24px\") }}"))
|
||||
(span
|
||||
("class" "name")
|
||||
(text "{{ self::full_username(user=owner) }}"))
|
||||
|
@ -2571,7 +2571,7 @@
|
|||
("class" "card lowered flex gap_2 flex_row")
|
||||
(a
|
||||
("href" "/@{{ owner.username }}")
|
||||
(text "{{ self::avatar(username=owner.username, size=\"32px\") }}"))
|
||||
(text "{{ self::avatar(id=owner.username, size=\"32px\") }}"))
|
||||
(div
|
||||
("class" "flex flex_col")
|
||||
(text "{{ self::full_username(user=owner) }}")
|
||||
|
@ -2596,7 +2596,7 @@
|
|||
("class" "card flex gap_2 flex_row")
|
||||
(a
|
||||
("href" "/@{{ owner.username }}")
|
||||
(text "{{ self::avatar(username=owner.username, size=\"32px\") }}"))
|
||||
(text "{{ self::avatar(id=owner.username, size=\"32px\") }}"))
|
||||
(div
|
||||
("class" "flex flex_col")
|
||||
(text "{{ self::full_username(user=owner) }}")
|
||||
|
@ -2612,14 +2612,14 @@
|
|||
(text "{% for receiver in letter.receivers %}")
|
||||
(a
|
||||
("href" "/api/v1/auth/user/find/{{ receiver }}")
|
||||
(text "{{ components::avatar(username=receiver, selector_type=\"id\", size=\"18px\") }}"))
|
||||
(text "{{ components::avatar(id=receiver, size=\"18px\") }}"))
|
||||
(text "{%- endfor %}"))))
|
||||
(text "{% else %}")
|
||||
(div
|
||||
("class" "card small flex gap_2 flex_row")
|
||||
(a
|
||||
("href" "/@{{ owner.username }}")
|
||||
(text "{{ self::avatar(username=owner.username, size=\"24px\") }}"))
|
||||
(text "{{ self::avatar(id=owner.username, size=\"24px\") }}"))
|
||||
(text "{{ self::full_username(user=owner) }}"))
|
||||
(text "{%- endif %}")
|
||||
|
||||
|
|
|
@ -45,11 +45,11 @@
|
|||
|
||||
(meta
|
||||
("name" "og:image")
|
||||
("content" "{{ config.host|safe }}/api/v1/auth/user/{{ owner.username }}/avatar?selector_type=username"))
|
||||
("content" "{{ config.service_hosts.buckets|safe }}/avatars/{{ owner.id }}"))
|
||||
|
||||
(meta
|
||||
("name" "twitter:image")
|
||||
("content" "{{ config.host|safe }}/api/v1/auth/user/{{ owner.username }}/avatar?selector_type=usernamev"))
|
||||
("content" "{{ config.service_hosts.buckets|safe }}/avatars/{{ owner.id }}"))
|
||||
|
||||
(meta
|
||||
("name" "twitter:card")
|
||||
|
@ -148,7 +148,7 @@
|
|||
(a
|
||||
("class" "flex items_center")
|
||||
("href" "/@{{ owner.username }}")
|
||||
(text "{{ components::avatar(username=owner.username, selector_type=\"username\", size=\"18px\") }}"))
|
||||
(text "{{ components::avatar(id=owner.id, size=\"18px\") }}"))
|
||||
|
||||
(text "{% if (view_mode and owner) or not view_mode -%}")
|
||||
(a
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
("onclick" "trigger('atto::hooks::dropdown', [event])")
|
||||
("exclude" "dropdown")
|
||||
("style" "gap: var(--pad-1) !important")
|
||||
(text "{{ components::avatar(username=user.username, size=\"24px\") }}")
|
||||
(text "{{ components::avatar(id=user.id, size=\"24px\") }}")
|
||||
(icon_class (text "chevron-down") (text "dropdown_arrow")))
|
||||
|
||||
(text "{{ components::user_menu() }}"))
|
||||
|
|
|
@ -118,7 +118,7 @@
|
|||
("exclude" "dropdown")
|
||||
("style" "gap: var(--pad-1) !important")
|
||||
("title" "Account options")
|
||||
(text "{{ components::avatar(username=user.username, size=\"24px\") }}")
|
||||
(text "{{ components::avatar(id=user.id, size=\"24px\") }}")
|
||||
(icon_class (text "chevron-down") (text "dropdown_arrow")))
|
||||
|
||||
(text "{{ components::user_menu() }}"))
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
const is_id = receiver.startsWith(\"id:\");
|
||||
receiver = receiver.replaceAll(\"<\", \"<\").replaceAll(\">\", \">\").replace(\"id:\", \"\");
|
||||
element.innerHTML += `<button class=\"small lowered\" onclick=\"remove_receiver('${receiver}')\" type=\"button\">
|
||||
<img class=\"avatar\" style=\"--size: 18px\" src=\"/api/v1/auth/user/${receiver}/avatar?selector_type=${is_id ? \"id\" : \"username\"}\" />
|
||||
<img class=\"avatar\" style=\"--size: 18px\" src=\"${_app_base.service_hosts.buckets}/avatars/${receiver}\" />
|
||||
<span>${is_id ? \"...\" : receiver}</span>
|
||||
</button>`;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
("class" "card small flex items_center gap_2")
|
||||
(a
|
||||
("href" "/api/v1/auth/user/find/{{ request.id }}")
|
||||
(text "{{ components::avatar(username=request.id, selector_type=\"id\") }}"))
|
||||
(text "{{ components::avatar(id=request.id) }}"))
|
||||
(span
|
||||
(text "{{ text \"requests:label.user_follow_request\" }}")))
|
||||
(div
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
(a
|
||||
("class" "card small flex items_center gap_2 flush")
|
||||
("href" "/api/v1/auth/user/find/{{ item.moderator }}")
|
||||
(text "{{ components::avatar(username=item.moderator, selector_type=\"id\") }}")
|
||||
(text "{{ components::avatar(id=item.moderator) }}")
|
||||
(span
|
||||
(text "{{ item.moderator }}"))
|
||||
(span
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
(a
|
||||
("class" "card small flex items_center gap_2 flush")
|
||||
("href" "/api/v1/auth/user/find/{{ item.moderator }}")
|
||||
(text "{{ components::avatar(username=item.moderator, selector_type=\"id\") }}")
|
||||
(text "{{ components::avatar(id=item.moderator) }}")
|
||||
(span
|
||||
(text "{{ item.moderator }}"))
|
||||
(span
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
(a
|
||||
("class" "card small flex items_center gap_2 flush")
|
||||
("href" "/api/v1/auth/user/find/{{ item.owner }}")
|
||||
(text "{{ components::avatar(username=item.owner, selector_type=\"id\") }}")
|
||||
(text "{{ components::avatar(id=item.owner) }}")
|
||||
(span
|
||||
(text "{{ item.owner }}"))
|
||||
(span
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
("class" "flex items_center gap_2 flush")
|
||||
("href" "/api/v1/auth/user/find/{{ item.moderator }}")
|
||||
("title" "Moderator")
|
||||
(text "{{ components::avatar(username=item.moderator, selector_type=\"id\") }}")
|
||||
(text "{{ components::avatar(id=item.moderator) }}")
|
||||
(span
|
||||
(text "{{ item.moderator }}"))
|
||||
(span
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
|
||||
(meta
|
||||
("name" "og:image")
|
||||
("content" "{{ config.host|safe }}/api/v1/auth/user/{{ owner.username }}/avatar?selector_type=username"))
|
||||
("content" "{{ config.service_hosts.buckets|safe }}/avatars/{{ owner.id }}"))
|
||||
|
||||
(meta
|
||||
("name" "twitter:image")
|
||||
("content" "{{ config.host|safe }}/api/v1/auth/user/{{ owner.username }}/avatar?selector_type=usernamev"))
|
||||
("content" "{{ config.service_hosts.buckets|safe }}/avatars/{{ owner.id }}"))
|
||||
|
||||
(meta
|
||||
("name" "twitter:card")
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
("class" "card flex items_center gap_2")
|
||||
(a
|
||||
("href" "/@{{ post[1].username }}")
|
||||
(text "{{ components::avatar(username=post[1].username, size=\"24px\", selector_type=\"username\") }}"))
|
||||
(text "{{ components::avatar(id=post[1].id, size=\"24px\") }}"))
|
||||
(div
|
||||
("class" "name")
|
||||
(text "{{ components::full_username(user=post[1]) }}")))
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
("class" "card small flex items_center justify_between gap_2")
|
||||
(div
|
||||
("class" "flex items_center gap_2")
|
||||
(text "{{ components::avatar(username=profile.username, size=\"24px\") }}")
|
||||
(text "{{ components::avatar(id=profile.id, size=\"24px\") }}")
|
||||
(span
|
||||
(text "{{ profile.username }}")))
|
||||
(b
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
(meta
|
||||
("name" "og:image")
|
||||
("content" "{{ config.host|safe }}/api/v1/auth/user/{{ profile.username }}/avatar?selector_type=username"))
|
||||
("content" "{{ config.service_hosts.buckets|safe }}/avatars/{{ profile.id }}"))
|
||||
|
||||
(meta
|
||||
("name" "twitter:image")
|
||||
("content" "{{ config.host|safe }}/api/v1/auth/user/{{ profile.username }}/avatar?selector_type=username"))
|
||||
("content" "{{ config.service_hosts.buckets|safe }}/avatars/{{ profile.id }}"))
|
||||
|
||||
(meta
|
||||
("name" "twitter:card")
|
||||
|
@ -46,7 +46,7 @@
|
|||
(article
|
||||
(div
|
||||
("class" "content_container flex flex_col gap_4")
|
||||
(text "{{ components::banner(username=profile.username) }}")
|
||||
(text "{{ components::banner(id=profile.id) }}")
|
||||
(div
|
||||
("class" "w_full flex gap_4 flex_collapse")
|
||||
(div
|
||||
|
@ -57,7 +57,7 @@
|
|||
(div
|
||||
("class" "card flex gap_2")
|
||||
("id" "user_avatar_and_name")
|
||||
(text "{{ components::avatar(username=profile.username,size=\"72px\") }}")
|
||||
(text "{{ components::avatar(id=profile.id,size=\"72px\") }}")
|
||||
(div
|
||||
("class" "flex flex_col")
|
||||
(h3
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
("class" "card small flex items_center justify_between gap_2")
|
||||
(div
|
||||
("class" "flex items_center gap_2")
|
||||
(text "{{ components::avatar(username=profile.username, size=\"24px\") }}")
|
||||
(text "{{ components::avatar(id=profile.id, size=\"24px\") }}")
|
||||
(span
|
||||
(text "{{ profile.username }}")))
|
||||
(b
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
("class" "flex items_center gap_2 flush")
|
||||
("href" "/api/v1/auth/user/find/{{ question[0].receiver }}")
|
||||
(icon (text "send"))
|
||||
(text "{{ components::avatar(username=question[0].receiver, selector_type='id') }}"))
|
||||
(text "{{ components::avatar(id=question[0].receiver) }}"))
|
||||
|
||||
; show button to delete question
|
||||
(button
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
("class" "card small flex items_center justify_between gap_2")
|
||||
(div
|
||||
("class" "flex items_center gap_2")
|
||||
(text "{{ components::avatar(username=profile.username, size=\"24px\") }}")
|
||||
(text "{{ components::avatar(id=profile.id, size=\"24px\") }}")
|
||||
(span
|
||||
(text "{{ profile.username }}")))
|
||||
(b
|
||||
|
|
|
@ -466,7 +466,7 @@
|
|||
("class" "card secondary flex flex_wrap gap_2 items_center justify_between")
|
||||
(div
|
||||
("class" "flex gap_2")
|
||||
(text "{{ components::avatar(username=user.username) }} {{ components::full_username(user=user) }}"))
|
||||
(text "{{ components::avatar(id=user.id) }} {{ components::full_username(user=user) }}"))
|
||||
(div
|
||||
("class" "flex gap_2")
|
||||
(button
|
||||
|
@ -522,7 +522,7 @@
|
|||
("class" "card secondary flex flex_wrap gap_2 items_center justify_between")
|
||||
(div
|
||||
("class" "flex gap_2")
|
||||
(text "{{ components::avatar(username=user.username) }} {{ components::full_username(user=user) }}"))
|
||||
(text "{{ components::avatar(id=user.id) }} {{ components::full_username(user=user) }}"))
|
||||
(div
|
||||
("class" "flex gap_2")
|
||||
(button
|
||||
|
@ -594,7 +594,7 @@
|
|||
("class" "card secondary flex flex_wrap gap_2 items_center justify_between")
|
||||
(div
|
||||
("class" "flex gap_2")
|
||||
(text "{{ components::avatar(username=user.username) }} {{ components::full_username(user=user) }}"))
|
||||
(text "{{ components::avatar(id=user.id) }} {{ components::full_username(user=user) }}"))
|
||||
(div
|
||||
("class" "flex gap_2")
|
||||
(a
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
("class" "card small flex items_center justify_between gap_2")
|
||||
(div
|
||||
("class" "flex items_center gap_2")
|
||||
(text "{{ components::avatar(username=profile.username, size=\"24px\") }}")
|
||||
(text "{{ components::avatar(id=profile.id, size=\"24px\") }}")
|
||||
(span
|
||||
(text "{{ profile.username }}")))
|
||||
(b
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
name: \"tetratto\",
|
||||
ns_store: {},
|
||||
classes: {},
|
||||
service_hosts: {
|
||||
buckets: \"{{ config.service_hosts.buckets }}\",
|
||||
}
|
||||
};
|
||||
|
||||
globalThis.no_policy = false;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
("class" "card_nest")
|
||||
(div
|
||||
("class" "card small flex items_center gap_2")
|
||||
(text "{{ components::avatar(username=add_user.username, size=\"24px\") }}")
|
||||
(text "{{ components::avatar(id=add_user.username, size=\"24px\") }}")
|
||||
(text "{{ components::full_username(user=add_user) }}"))
|
||||
(div
|
||||
("class" "card flex flex_col gap_2")
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
("class" "flex items_center gap_2")
|
||||
(a
|
||||
("href" "/api/v1/auth/user/find/{{ stack.owner }}")
|
||||
(text "{{ components::avatar(username=stack.owner, selector_type=\"id\") }}"))
|
||||
(text "{{ components::avatar(id=stack.owner) }}"))
|
||||
(span
|
||||
(text "{{ stack.name }}")))
|
||||
(div
|
||||
|
@ -81,7 +81,7 @@
|
|||
(a
|
||||
("href" "/api/v1/auth/user/find/{{ user }}")
|
||||
("class" "flush")
|
||||
(text "{{ components::avatar(username=user, selector_type=\"id\", size=\"24px\") }}"))
|
||||
(text "{{ components::avatar(id=user, size=\"24px\") }}"))
|
||||
(text "{% endfor %}"))
|
||||
(text "{%- endif %}")
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
("class" "card secondary flex flex_wrap gap_2 items_center justify_between")
|
||||
(div
|
||||
("class" "flex gap_2")
|
||||
(text "{{ components::avatar(username=user.username) }} {{ components::full_username(user=user) }}"))
|
||||
(text "{{ components::avatar(id=user.id) }} {{ components::full_username(user=user) }}"))
|
||||
(button
|
||||
("class" "lowered small red")
|
||||
("onclick" "remove_user('{{ user.username }}')")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue