add: move upload server to buckets

This commit is contained in:
trisua 2025-08-21 00:30:29 -04:00
parent 8116307ba0
commit 75fe720f21
83 changed files with 351 additions and 458 deletions

View file

@ -421,7 +421,7 @@
(span
(str (text "general:label.could_not_find_post"))))
(text "{%- endif %} {%- endif %}"))
(text "{{ self::post_media(upload_ids=post.uploads) }} {% else %}")
(text "{{ self::post_media(upload_ids=post.uploads, bucket=\"post_media\") }} {% else %}")
(details
("class" "card tiny lowered w_full")
(summary
@ -448,7 +448,7 @@
(span
(text "Could not find original post...")))
(text "{%- endif %} {%- endif %}"))
(text "{{ self::post_media(upload_ids=post.uploads) }}")))
(text "{{ self::post_media(upload_ids=post.uploads, bucket=\"post_media\") }}")))
(text "{%- endif %} {%- endif %}")
(text "{% if poll -%} {{ self::poll(post=post, poll=poll) }} {%- endif %}")
@ -465,15 +465,15 @@
(text "{% if community and show_community and community.id != config.town_square or question %}"))
(text "{%- endif %} {%- endmacro %}")
(text "{% macro post_media(upload_ids, custom_click=false) -%} {% if upload_ids|length > 0 -%}")
(text "{% macro post_media(upload_ids, custom_click=false, bucket) -%} {% if upload_ids|length > 0 -%}")
(div
("class" "media_gallery gap_2")
(text "{% for upload in upload_ids %}")
(img
("src" "/api/v1/uploads/{{ upload }}")
("src" "{{ config.service_hosts.buckets }}/{{ bucket }}/{{ upload }}")
("data-upload-id" "{{ upload }}")
("alt" "Image upload")
("onclick" "{% if custom_click -%} {{ custom_click }} {%- else -%} trigger('ui::lightbox_open', ['/api/v1/uploads/{{ upload }}']) {%- endif %}"))
("onclick" "{% if custom_click -%} {{ custom_click }} {%- else -%} trigger('ui::lightbox_open', ['{{ config.service_hosts.buckets }}/{{ bucket }}/{{ upload }}']) {%- endif %}"))
(text "{% endfor %}"))
(text "{%- endif %} {%- endmacro %} {% macro notification(notification) -%}")
(div
@ -825,7 +825,7 @@
("id" "question_content:{{ question.id }}")
(text "{{ question.content|markdown|safe }}"))
; question drawings
(text "{{ self::post_media(upload_ids=question.drawings) }}")
(text "{{ self::post_media(upload_ids=question.drawings, bucket=\"drawings\") }}")
; asking about
(text "{% if asking_about -%}")
(text "{{ self::post(post=asking_about[1], owner=asking_about[0], secondary=not secondary, show_community=false) }}")

View file

@ -41,7 +41,7 @@
display: inline;
width: 100dvw;
height: 100dvh;
background-image: url(\"{{ config.host|safe }}/api/v1/uploads/{{ ad.upload_id }}\");
background-image: url(\"{{ config.service_hosts.buckets }}/ads/{{ ad.upload_id }}\");
background-position: center;
background-size: contain;
}

View file

@ -13,7 +13,7 @@
(str (text "economy:label.thumbnails"))))
(div
("class" "card flex flex_col gap_2")
(text "{{ components::post_media(upload_ids=product.uploads.thumbnails, custom_click=\"remove_thumbnail(event.target)\") }}")
(text "{{ components::post_media(upload_ids=product.uploads.thumbnails, custom_click=\"remove_thumbnail(event.target)\", bucket=\"product_imgs\") }}")
(text "{% if product.uploads.thumbnails|length < 4 -%}")
(button
("onclick" "add_thumbnail()")

View file

@ -4,7 +4,7 @@
(text "{% endblock %} {% block body %} {{ macros::nav(selected=\"\") }}")
(main
("class" "flex flex_col gap_2")
(text "{{ components::post_media(upload_ids=product.uploads.thumbnails) }}")
(text "{{ components::post_media(upload_ids=product.uploads.thumbnails, bucket=\"product_imgs\") }}")
(div
("class" "card flex flex_col gap_2")
(h3

View file

@ -55,7 +55,7 @@
(iframe
("id" "browser_iframe")
("frameborder" "0")
("src" "{% if path -%} {{ config.lw_host }}/api/v1/net/{{ path }}?s={{ session }} {%- endif %}"))
("src" "{% if path -%} {{ config.service_hosts.littleweb }}/api/v1/net/{{ path }}?s={{ session }} {%- endif %}"))
(style
("data-turbo-temporary" "true")
@ -124,7 +124,7 @@
// ...
console.log(\"navigate\", uri);
document.getElementById(\"browser_iframe\").src = `{{ config.lw_host|safe }}/api/v1/net/${uri}?s={{ session }}`;
document.getElementById(\"browser_iframe\").src = `{{ config.service_hosts.littleweb|safe }}/api/v1/net/${uri}?s={{ session }}`;
if (!uri.includes(\"atto://\")) {
document.getElementById(\"uri\").setAttribute(\"true_value\", `atto://${uri}`);

View file

@ -101,7 +101,7 @@
("href" "/developer")
(icon (text "code"))
(str (text "developer:label.apps")))
(text "{% if config.lw_host -%}")
(text "{% if config.service_hosts.littleweb -%}")
(button
("onclick" "document.getElementById('littleweb').showModal()")
(icon (text "globe"))

View file

@ -665,12 +665,12 @@
(span
("class" "date")
(text "{{ upload.created }}"))
(text " ({{ upload.what }})")))
(text " ({{ upload.metadata.what }})")))
(div
("class" "flex gap_2")
(button
("class" "raised small")
("onclick" "trigger('ui::lightbox_open', ['/api/v1/uploads/{{ upload.id }}'])")
("onclick" "trigger('ui::lightbox_open', ['{{ config.service_hosts.buckets }}/{{ upload.bucket }}/{{ upload.id }}'])")
(text "{{ icon \"view\" }}")
(span
(text "{{ text \"general:action.view\" }}")))
@ -694,7 +694,7 @@
("name" "alt")
("class" "w_full")
("placeholder" "Alternative text")
(text "{{ upload.alt|safe }}")))
(text "{{ upload.metadata.alt|safe }}")))
(button
(icon (text "check"))