From 3949117be01ac8aca7e41a7179506f27627654e5 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 31 Mar 2025 15:51:17 +0200 Subject: [PATCH] [feature] Use blurhashes in frontend, tidy up gallery view a bit (#3948) * [feature] Use blurhashes in frontend, tidy up gallery view a bit * weeeeeeeeeeeeeeeee * beep boop --- internal/api/util/template.go | 21 ++- internal/processing/account/statuses.go | 3 +- internal/web/domain-blocklist.go | 1 - internal/web/profile.go | 35 ++++- internal/web/settings-panel.go | 8 +- internal/web/thread.go | 12 +- internal/web/web.go | 1 + web/source/blurhash/index.js | 146 ++++++++++++++++++++ web/source/css/_media-wrapper.css | 176 +++++++++++++++++++++--- web/source/css/_status-media.css | 7 +- web/source/css/profile-gallery.css | 19 +-- web/source/frontend/index.js | 116 ++++++++++------ web/source/index.js | 9 ++ web/source/package.json | 1 + web/source/yarn.lock | 5 + web/template/page.tmpl | 9 +- web/template/status_attachment.tmpl | 63 ++++----- 17 files changed, 508 insertions(+), 124 deletions(-) create mode 100644 web/source/blurhash/index.js diff --git a/internal/api/util/template.go b/internal/api/util/template.go index ec04a4d97..38e79484f 100644 --- a/internal/api/util/template.go +++ b/internal/api/util/template.go @@ -48,10 +48,10 @@ type WebPage struct { // Can be nil. Stylesheets []string - // Paths to JS files to add to - // the page as "script" entries. + // JS files to add to the + // page as "script" entries. // Can be nil. - Javascript []string + Javascript []JavascriptEntry // Extra parameters to pass to // the template for rendering, @@ -60,6 +60,21 @@ type WebPage struct { Extra map[string]any } +type JavascriptEntry struct { + // Insert + {{- if not .Bottom }} + + {{- end }} {{- end }}