summaryrefslogtreecommitdiff
diff options
from:
to:
context:
space:
mode:
authorGravatar SayaAndy <saya.andy@posteo.com> 2026-05-02 12:58:40 +0700
committerGravatar SayaAndy <saya.andy@posteo.com> 2026-05-02 12:58:40 +0700
commit2d727cc1eeb926f5b5ee578a0ee54269e0390a96 (patch)
tree40c43fefdf44bd4495b3f56bb5253c6691c8a0f2
parentced61eee79d1c06864cd1d580fa6c549365ba213 (diff)
downloadweb-2d727cc1eeb926f5b5ee578a0ee54269e0390a96.tar.gz
web-2d727cc1eeb926f5b5ee578a0ee54269e0390a96.zip
refactor: parametrize static & photo storage url
refactor: parametrize allow origins
-rw-r--r--config/config.go23
-rw-r--r--config/config.local.yaml22
-rw-r--r--config/config.prod.yaml22
-rw-r--r--config/config.stage.yaml22
-rw-r--r--internal/glightbox/extension.go11
-rw-r--r--internal/glightbox/html_renderer.go42
-rw-r--r--internal/router/handlers/lang-blog-title.go2
-rw-r--r--internal/router/handlers/lang.go10
-rw-r--r--internal/router/router.go42
-rw-r--r--views/layouts/general-page.html16
-rw-r--r--views/messages/new-post.html2
-rw-r--r--views/pages/global-map.html14
-rw-r--r--views/pages/home-page.html2
-rw-r--r--views/partials/catalogue-blog-cards.html2
14 files changed, 178 insertions, 54 deletions
diff --git a/config/config.go b/config/config.go
index ebe0367..536a333 100644
--- a/config/config.go
+++ b/config/config.go
@@ -20,6 +20,9 @@ type Config struct {
Mail MailConfig `json:"Mail" yaml:"mail" validate:"required"`
CanonicalEndpoint string `json:"CanonicalEndpoint" yaml:"canonicalEndpoint" validate:"required"`
Meta MetaConfig `json:"Meta" yaml:"meta"`
+ PhotoStorage PhotoStorageConfig `json:"PhotoStorage" yaml:"photoStorage"`
+ StaticStorage PhotoTypeConfig `json:"StaticStorage" yaml:"staticStorage"`
+ AllowOrigins []string `json:"AllowOrigins" yaml:"allowOrigins"`
}
type BlogPagesConfig struct {
@@ -158,6 +161,26 @@ type MetaConfig struct {
GoogleSiteVerification string `json:"GoogleSiteVerification" yaml:"googleSiteVerification"`
}
+type PhotoStorageConfig struct {
+ Full PhotoTypeConfig `json:"Full" yaml:"full" validate:"required"`
+ Webp PhotoTypeConfig `json:"Webp" yaml:"webp"`
+ Thumbnail1600p PhotoTypeConfig `json:"Thumbnail1600p" yaml:"thumbnail1600p"`
+ Thumbnail1200p PhotoTypeConfig `json:"Thumbnail1200p" yaml:"thumbnail1200p"`
+ Thumbnail800p PhotoTypeConfig `json:"Thumbnail800p" yaml:"thumbnail800p"`
+ Thumbnail560p PhotoTypeConfig `json:"Thumbnail560p" yaml:"thumbnail560p"`
+ Thumbnail320p PhotoTypeConfig `json:"Thumbnail320p" yaml:"thumbnail320p"`
+ HomePageGifs HomePageGifsConfig `json:"HomePageGifs" yaml:"homePageGifs"`
+}
+
+type PhotoTypeConfig struct {
+ BaseUrl string `json:"BaseUrl" yaml:"baseUrl" validate:"url,required"`
+}
+
+type HomePageGifsConfig struct {
+ BaseUrl string `json:"BaseUrl" yaml:"baseUrl" validate:"url,required"`
+ Indexes []string `json:"Indexes" yaml:"indexes"`
+}
+
func LoadConfig(path string, config *Config) error {
fileBytes, err := os.ReadFile(path)
if err != nil {
diff --git a/config/config.local.yaml b/config/config.local.yaml
index c02dc2d..d312504 100644
--- a/config/config.local.yaml
+++ b/config/config.local.yaml
@@ -46,3 +46,25 @@ mail:
trigger:
onNewPost: "* * * * *"
canonicalEndpoint: 'http://127.0.0.1:3000'
+photoStorage:
+ full:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/full/%s
+ webp:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp/%s.webp
+ thumbnail1600p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-1600p/%s.webp
+ thumbnail1200p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-1200p/%s.webp
+ thumbnail800p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-800p/%s.webp
+ thumbnail560p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-560p/%s.webp
+ thumbnail320p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-320p/%s.webp
+ homePageGifs:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-static/home-page-gifs/otter-%s.gif
+ indexes: ['1', '2', '3']
+staticStorage:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-static
+allowOrigins:
+ - https://f003.backblazeb2.com
diff --git a/config/config.prod.yaml b/config/config.prod.yaml
index b40ba57..2c5a159 100644
--- a/config/config.prod.yaml
+++ b/config/config.prod.yaml
@@ -47,3 +47,25 @@ mail:
canonicalEndpoint: 'https://${FQDN}'
meta:
googleSiteVerification: '${GOOGLE_SITE_VERIFICATION}'
+photoStorage:
+ full:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/full/%s
+ webp:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp/%s.webp
+ thumbnail1600p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-1600p/%s.webp
+ thumbnail1200p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-1200p/%s.webp
+ thumbnail800p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-800p/%s.webp
+ thumbnail560p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-560p/%s.webp
+ thumbnail320p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-320p/%s.webp
+ homePageGifs:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-static/home-page-gifs/otter-%s.gif
+ indexes: ['1', '2', '3']
+staticStorage:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-static
+allowOrigins:
+ - https://f003.backblazeb2.com
diff --git a/config/config.stage.yaml b/config/config.stage.yaml
index efa94ae..0889c19 100644
--- a/config/config.stage.yaml
+++ b/config/config.stage.yaml
@@ -45,3 +45,25 @@ mail:
trigger:
onNewPost: "0/3 * * * *"
canonicalEndpoint: 'https://${FQDN}'
+photoStorage:
+ full:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/full/%s
+ webp:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp/%s.webp
+ thumbnail1600p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-1600p/%s.webp
+ thumbnail1200p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-1200p/%s.webp
+ thumbnail800p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-800p/%s.webp
+ thumbnail560p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-560p/%s.webp
+ thumbnail320p:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-photos/webp-320p/%s.webp
+ homePageGifs:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-static/home-page-gifs/otter-%s.gif
+ indexes: ['1', '2', '3']
+staticStorage:
+ baseUrl: https://f003.backblazeb2.com/file/sayana-static
+allowOrigins:
+ - https://f003.backblazeb2.com
diff --git a/internal/glightbox/extension.go b/internal/glightbox/extension.go
index 7fd17b1..e9a9f3e 100644
--- a/internal/glightbox/extension.go
+++ b/internal/glightbox/extension.go
@@ -1,6 +1,7 @@
package glightbox
import (
+ "github.com/SayaAndy/saya-today-web/config"
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/parser"
"github.com/yuin/goldmark/renderer"
@@ -8,10 +9,12 @@ import (
)
// Extension that combines parser and renderer
-type GLightboxExtension struct{}
+type GLightboxExtension struct {
+ photoStorage config.PhotoStorageConfig
+}
-func NewGLightboxExtension() goldmark.Extender {
- return &GLightboxExtension{}
+func NewGLightboxExtension(photoStorage config.PhotoStorageConfig) goldmark.Extender {
+ return &GLightboxExtension{photoStorage}
}
func (e *GLightboxExtension) Extend(m goldmark.Markdown) {
@@ -22,7 +25,7 @@ func (e *GLightboxExtension) Extend(m goldmark.Markdown) {
)
m.Renderer().AddOptions(
renderer.WithNodeRenderers(
- util.Prioritized(NewGLightboxHTMLRenderer(), 500),
+ util.Prioritized(NewGLightboxHTMLRenderer(e.photoStorage), 500),
),
)
}
diff --git a/internal/glightbox/html_renderer.go b/internal/glightbox/html_renderer.go
index f71a8f2..b2cd855 100644
--- a/internal/glightbox/html_renderer.go
+++ b/internal/glightbox/html_renderer.go
@@ -8,6 +8,7 @@ import (
"strings"
"time"
+ "github.com/SayaAndy/saya-today-web/config"
"github.com/SayaAndy/saya-today-web/internal/tailwind"
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/ast"
@@ -21,9 +22,10 @@ type GLightboxHTMLRenderer struct {
html.Config
md goldmark.Markdown
anchorMatchRe *regexp.Regexp
+ photoStorage config.PhotoStorageConfig
}
-func NewGLightboxHTMLRenderer(opts ...html.Option) renderer.NodeRenderer {
+func NewGLightboxHTMLRenderer(photoStorage config.PhotoStorageConfig, opts ...html.Option) renderer.NodeRenderer {
r := &GLightboxHTMLRenderer{
Config: html.NewConfig(),
md: goldmark.New(
@@ -44,11 +46,12 @@ func NewGLightboxHTMLRenderer(opts ...html.Option) renderer.NodeRenderer {
),
),
),
+ anchorMatchRe: regexp.MustCompile(`(?s)<\s*a(\s+[^<]*)(href\s*=\s*["'].*?["'])\s*([^<]*)>(.*?)<\s*\/\s*a\s*>`),
+ photoStorage: photoStorage,
}
for _, opt := range opts {
opt.SetHTMLOption(&r.Config)
}
- r.anchorMatchRe = regexp.MustCompile(`(?s)<\s*a(\s+[^<]*)(href\s*=\s*["'].*?["'])\s*([^<]*)>(.*?)<\s*\/\s*a\s*>`)
return r
}
@@ -111,19 +114,32 @@ func (r *GLightboxHTMLRenderer) renderGLightbox(w util.BufWriter, source []byte,
anchorlessCaptionHTML := r.anchorMatchRe.ReplaceAll(captionHTML, []byte("<span class=\"linklike\" $1 $3>$4</span>"))
elements = append(elements, fmt.Sprintf(`
- <a href="https://f003.backblazeb2.com/file/sayana-photos/full/%s" class="glightbox grid-item %s grid-item-%s p-1"
- data-gallery="gallery" data-title="%s" %s>
+ <a href="%[7]s" class="glightbox grid-item %[1]s grid-item-%[2]s p-1"
+ data-gallery="gallery" data-title="%[3]s" %[4]s>
<picture>
- <source media="(width < 800px)" srcset="https://f003.backblazeb2.com/file/sayana-photos/webp-320p/%s.webp" />
- <source media="(width < 2400px)" srcset="https://f003.backblazeb2.com/file/sayana-photos/webp-560p/%s.webp" />
- <source media="(width < 3200px)" srcset="https://f003.backblazeb2.com/file/sayana-photos/webp-800p/%s.webp" />
- <source media="(width < 4000px)" srcset="https://f003.backblazeb2.com/file/sayana-photos/webp-1200p/%s.webp" />
- <source media="(width >= 4000px)" srcset="https://f003.backblazeb2.com/file/sayana-photos/webp-1600p/%s.webp" />
- <img src="https://f003.backblazeb2.com/file/sayana-photos/webp-560p/%s.webp" />
+ <source media="(width < 800px)" srcset="%[8]s" />
+ <source media="(width < 2400px)" srcset="%[9]s" />
+ <source media="(width < 3200px)" srcset="%[10]s" />
+ <source media="(width < 4000px)" srcset="%[11]s" />
+ <source media="(width >= 4000px)" srcset="%[12]s" />
+ <img src="%[9]s" />
</picture>
- <span class="grid-tooltip-text"><p>%s</p></span>
- <span class="grid-item-index">%d</span>
- </a>`, fullImageUrl, strings.Join(tagClassList, " "), galleryID, dayDate.Format("2006-01-02 15:04:05 -07:00"), dataDescriptionAttribute, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, anchorlessCaptionHTML, i+1))
+ <span class="grid-tooltip-text"><p>%[5]s</p></span>
+ <span class="grid-item-index">%[6]d</span>
+ </a>`,
+ strings.Join(tagClassList, " "),
+ galleryID,
+ dayDate.Format("2006-01-02 15:04:05 -07:00"),
+ dataDescriptionAttribute,
+ anchorlessCaptionHTML,
+ i+1,
+ fmt.Sprintf(r.photoStorage.Full.BaseUrl, fullImageUrl),
+ fmt.Sprintf(r.photoStorage.Thumbnail1600p.BaseUrl, imageUrlWithoutExt),
+ fmt.Sprintf(r.photoStorage.Thumbnail1200p.BaseUrl, imageUrlWithoutExt),
+ fmt.Sprintf(r.photoStorage.Thumbnail800p.BaseUrl, imageUrlWithoutExt),
+ fmt.Sprintf(r.photoStorage.Thumbnail560p.BaseUrl, imageUrlWithoutExt),
+ fmt.Sprintf(r.photoStorage.Thumbnail320p.BaseUrl, imageUrlWithoutExt),
+ ))
if glightboxDescId != "" {
elements = append(elements, fmt.Sprintf(`
diff --git a/internal/router/handlers/lang-blog-title.go b/internal/router/handlers/lang-blog-title.go
index f1be0a5..49744c1 100644
--- a/internal/router/handlers/lang-blog-title.go
+++ b/internal/router/handlers/lang-blog-title.go
@@ -74,7 +74,7 @@ func (r *BlogPageHandler) AddMeta(c *fiber.Ctx, supplements *router.Supplements,
return []router.MetaField{
{Property: "og:title", Content: metadata.Title},
{Property: "og:description", Content: fmt.Sprintf("%s [%s]", metadata.ShortDescription, metadata.ActionDate)},
- {Property: "og:image", Content: fmt.Sprintf("https://f003.backblazeb2.com/file/sayana-photos/webp-320p/%s.webp", metadata.Thumbnail)},
+ {Property: "og:image", Content: fmt.Sprintf(supplements.PhotoStorage.Thumbnail320p.BaseUrl, metadata.Thumbnail)},
{Property: "og:url", Content: fmt.Sprintf("%s/%s/blog/%s", templateMap["CanonicalEndpoint"], lang, c.Params("title"))},
{Property: "og:type", Content: "website"},
{Name: "twitter:card", Content: "summary_large_image"},
diff --git a/internal/router/handlers/lang.go b/internal/router/handlers/lang.go
index c618353..25b5036 100644
--- a/internal/router/handlers/lang.go
+++ b/internal/router/handlers/lang.go
@@ -53,7 +53,10 @@ func (r *HomeHandler) AddMeta(c *fiber.Ctx, supplements *router.Supplements, lan
return []router.MetaField{
{Property: "og:title", Content: supplements.Localization[lang].HomePage.Header},
{Property: "og:description", Content: supplements.Localization[lang].HomePage.HomePageDescription},
- {Property: "og:image", Content: fmt.Sprintf("https://f003.backblazeb2.com/file/sayana-static/home-page-gifs/otter-%d.gif", rand.Int()%3+1)},
+ {Property: "og:image", Content: fmt.Sprintf(
+ supplements.PhotoStorage.HomePageGifs.BaseUrl,
+ supplements.PhotoStorage.HomePageGifs.Indexes[rand.Int()%len(supplements.PhotoStorage.HomePageGifs.Indexes)],
+ )},
{Property: "og:url", Content: fmt.Sprintf("%s/%s", templateMap["CanonicalEndpoint"], lang)},
{Property: "og:type", Content: "website"},
}, nil
@@ -63,7 +66,10 @@ func (r *HomeHandler) RenderBody(c *fiber.Ctx, supplements *router.Supplements,
templateMap["Title"] = supplements.Localization[lang].HomePage.Header
templateMap["FilledHeartCount"] = uint(40)
templateMap["OutlineHeartCount"] = uint(40)
- templateMap["GifName"] = fmt.Sprintf("otter-%d.gif", rand.Int()%3+1)
+ templateMap["GifUrl"] = fmt.Sprintf(
+ supplements.PhotoStorage.HomePageGifs.BaseUrl,
+ supplements.PhotoStorage.HomePageGifs.Indexes[rand.Int()%len(supplements.PhotoStorage.HomePageGifs.Indexes)],
+ )
templateMap["FunFacts"] = supplements.FactGiver.Give(lang)
return fiber.StatusOK, nil
}
diff --git a/internal/router/router.go b/internal/router/router.go
index e8fb47a..926d21a 100644
--- a/internal/router/router.go
+++ b/internal/router/router.go
@@ -101,6 +101,8 @@ type Supplements struct {
TemplateManager *templatemanager.TemplateManager
MarkdownRenderer goldmark.Markdown
Meta config.MetaConfig
+ PhotoStorage config.PhotoStorageConfig
+ StaticStorage config.PhotoTypeConfig
}
type Router struct {
@@ -156,7 +158,7 @@ func NewRouter(cfg *config.Config) (*Router, error) {
supplements.MarkdownRenderer = goldmark.New(
goldmark.WithExtensions(
- glightbox.NewGLightboxExtension(),
+ glightbox.NewGLightboxExtension(cfg.PhotoStorage),
tailwind.NewTailwindExtension(),
),
goldmark.WithParserOptions(
@@ -217,6 +219,8 @@ func NewRouter(cfg *config.Config) (*Router, error) {
}
supplements.Meta = cfg.Meta
+ supplements.PhotoStorage = cfg.PhotoStorage
+ supplements.StaticStorage = cfg.StaticStorage
enablePrintRoutes := false
if cfg.LogLevel <= slog.LevelDebug {
@@ -229,7 +233,7 @@ func NewRouter(cfg *config.Config) (*Router, error) {
})
app.Use(cors.New(cors.Config{
- AllowOrigins: "https://f003.backblazeb2.com",
+ AllowOrigins: strings.Join(cfg.AllowOrigins, ","),
AllowMethods: "GET,POST,OPTIONS",
AllowHeaders: "Origin, Content-Type, Accept",
}))
@@ -299,11 +303,13 @@ func (r *Router) InitRoutes() (err error) {
}
defaultMap := fiber.Map{
- "L": r.supplements.Localization[lang],
- "Lang": lang,
- "Path": trimmedPath,
- "QueryString": queryString,
- "CanonicalEndpoint": r.canonicalEndpoint,
+ "L": r.supplements.Localization[lang],
+ "Lang": lang,
+ "Path": trimmedPath,
+ "QueryString": queryString,
+ "CanonicalEndpoint": r.canonicalEndpoint,
+ "StaticStorageBaseUrl": r.supplements.StaticStorage.BaseUrl,
+ "ThumbnailBaseUrl": r.supplements.PhotoStorage.Thumbnail320p.BaseUrl,
}
statusCode, err := currentRoute.Render(c, r.supplements, lang, defaultMap)
@@ -423,10 +429,12 @@ func (r *Router) generalPage(c *fiber.Ctx, route Route, lang string) error {
}
valueMap := fiber.Map{
- "L": r.supplements.Localization[lang],
- "Lang": lang,
- "QueryString": queryString,
- "CanonicalEndpoint": r.canonicalEndpoint,
+ "L": r.supplements.Localization[lang],
+ "Lang": lang,
+ "QueryString": queryString,
+ "CanonicalEndpoint": r.canonicalEndpoint,
+ "StaticStorageBaseUrl": r.supplements.StaticStorage.BaseUrl,
+ "ThumbnailBaseUrl": r.supplements.PhotoStorage.Thumbnail320p.BaseUrl,
}
var err error
@@ -503,11 +511,13 @@ func (r *Router) generalPageSegment(c *fiber.Ctx, part string) error {
var statusCode int
defaultMap := fiber.Map{
- "L": r.supplements.Localization[lang],
- "Lang": lang,
- "Path": strings.Trim(path, "/"),
- "QueryString": queryString,
- "CanonicalEndpoint": r.canonicalEndpoint,
+ "L": r.supplements.Localization[lang],
+ "Lang": lang,
+ "Path": strings.Trim(path, "/"),
+ "QueryString": queryString,
+ "CanonicalEndpoint": r.canonicalEndpoint,
+ "StaticStorageBaseUrl": r.supplements.StaticStorage.BaseUrl,
+ "ThumbnailBaseUrl": r.supplements.PhotoStorage.Thumbnail320p.BaseUrl,
}
switch part {
diff --git a/views/layouts/general-page.html b/views/layouts/general-page.html
index b620566..1265266 100644
--- a/views/layouts/general-page.html
+++ b/views/layouts/general-page.html
@@ -13,8 +13,8 @@
{{- end }}
{{- end }}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css">
- <link rel="stylesheet" href="https://f003.backblazeb2.com/file/sayana-static/libs/leaflet/1.9.4/leaflet.css">
- <link rel="stylesheet" href="https://f003.backblazeb2.com/file/sayana-static/libs/glightbox/3.3.0/css/glightbox.min.css">
+ <link rel="stylesheet" href="{{ .StaticStorageBaseUrl }}/libs/leaflet/1.9.4/leaflet.css">
+ <link rel="stylesheet" href="{{ .StaticStorageBaseUrl }}/libs/glightbox/3.3.0/css/glightbox.min.css">
<link href="/output.css" rel="stylesheet">
{{- with .LinkedData }}
<script type="application/ld+json">
@@ -49,7 +49,7 @@
}
</script>
- <script src="https://f003.backblazeb2.com/file/sayana-static/libs/glightbox/3.3.0/js/glightbox.min.js"></script>
+ <script src="{{ .StaticStorageBaseUrl }}/libs/glightbox/3.3.0/js/glightbox.min.js"></script>
<script>
function sfc32(a, b, c, d) {
@@ -133,7 +133,7 @@
const frameCenters = new Array(4);
for (i = 1; i <= 4; i++) {
let frame = document.createElement("img");
- frame.src = `https://f003.backblazeb2.com/file/sayana-static/themes/ram/ram-frame${i}.webp`;
+ frame.src = `{{ .StaticStorageBaseUrl }}/themes/ram/ram-frame${i}.webp`;
frame.classList.add("ram-frame", "theme-decor", "z-0", "absolute");
let x, y;
outerLoop:
@@ -288,10 +288,10 @@
<div class="grow bg-split-right"></div>
- <script src="https://f003.backblazeb2.com/file/sayana-static/libs/htmx/2.0.6/htmx.min.js"></script>
- <script src="https://f003.backblazeb2.com/file/sayana-static/libs/leaflet/1.9.4/leaflet.js"></script>
- <script src="https://f003.backblazeb2.com/file/sayana-static/libs/imagesloaded/5.0.0/imagesloaded.pkgd.min.js"></script>
- <script src="https://f003.backblazeb2.com/file/sayana-static/libs/packery/3.0.0/dist/packery.pkgd.min.js"></script>
+ <script src="{{ .StaticStorageBaseUrl }}/libs/htmx/2.0.6/htmx.min.js"></script>
+ <script src="{{ .StaticStorageBaseUrl }}/libs/leaflet/1.9.4/leaflet.js"></script>
+ <script src="{{ .StaticStorageBaseUrl }}/libs/imagesloaded/5.0.0/imagesloaded.pkgd.min.js"></script>
+ <script src="{{ .StaticStorageBaseUrl }}/libs/packery/3.0.0/dist/packery.pkgd.min.js"></script>
<script>
// Enable fitWidth-like attribute for Packery. Source: https://codepen.io/desandro/pen/kVmLYz
diff --git a/views/messages/new-post.html b/views/messages/new-post.html
index f1338f7..98f0b52 100644
--- a/views/messages/new-post.html
+++ b/views/messages/new-post.html
@@ -2,7 +2,7 @@
<p>{{ .L.Mail.NewPost.Intro }}</p>
<table>
<tr>
- <td rowspan="3"><a href="https://{{ .ClientHost }}/{{ .Lang }}/blog/{{ .Post.FileName }}"><img src="https://f003.backblazeb2.com/file/sayana-photos/webp-320p/{{ .Post.Metadata.Thumbnail }}.webp"></a></td>
+ <td rowspan="3"><a href="https://{{ .ClientHost }}/{{ .Lang }}/blog/{{ .Post.FileName }}"><img src="{{ printf .ThumbnailBaseUrl .Post.Metadata.Thumbnail }}"></a></td>
<td class="darkened" style="font-size: 24px"><a style="color: #273de1 !important;" href="https://{{ .ClientHost }}/{{ .Lang }}/blog/{{ .Post.FileName }}">{{ .Post.Metadata.Title }}</a></td>
</tr>
<tr>
diff --git a/views/pages/global-map.html b/views/pages/global-map.html
index 9a0d752..1547ada 100644
--- a/views/pages/global-map.html
+++ b/views/pages/global-map.html
@@ -13,9 +13,9 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css">
{{ block "header" . }}{{ end }}
<link href="/output.css" rel="stylesheet">
- <link rel="stylesheet" href="https://f003.backblazeb2.com/file/sayana-static/libs/leaflet/1.9.4/leaflet.css">
- <link rel="stylesheet" href="https://f003.backblazeb2.com/file/sayana-static/libs/leaflet.markercluster/1.4.1/MarkerCluster.css">
- <link rel="stylesheet" href="https://f003.backblazeb2.com/file/sayana-static/libs/leaflet.markercluster/1.4.1/MarkerCluster.Default.css">
+ <link rel="stylesheet" href="{{ .StaticStorageBaseUrl }}/libs/leaflet/1.9.4/leaflet.css">
+ <link rel="stylesheet" href="{{ .StaticStorageBaseUrl }}/libs/leaflet.markercluster/1.4.1/MarkerCluster.css">
+ <link rel="stylesheet" href="{{ .StaticStorageBaseUrl }}/libs/leaflet.markercluster/1.4.1/MarkerCluster.Default.css">
</head>
<body data-theme="ram" class="font-m-plus text-main-hard overflow-hidden bg-interlocked-hexagons h-dvh">
@@ -81,9 +81,9 @@
<div id="map-container" class="bg-paper bg-background-dark flex z-10 w-full h-full"></div>
- <script src="https://f003.backblazeb2.com/file/sayana-static/libs/htmx/2.0.6/htmx.min.js"></script>
- <script src="https://f003.backblazeb2.com/file/sayana-static/libs/leaflet/1.9.4/leaflet.js"></script>
- <script src="https://f003.backblazeb2.com/file/sayana-static/libs/leaflet.markercluster/1.4.1/leaflet.markercluster.js"></script>
+ <script src="{{ .StaticStorageBaseUrl }}/libs/htmx/2.0.6/htmx.min.js"></script>
+ <script src="{{ .StaticStorageBaseUrl }}/libs/leaflet/1.9.4/leaflet.js"></script>
+ <script src="{{ .StaticStorageBaseUrl }}/libs/leaflet.markercluster/1.4.1/leaflet.markercluster.js"></script>
<script>
const themeWheel = document.getElementById('theme-wheel');
@@ -278,7 +278,7 @@
title: title,
}).bindPopup(`
<div class="flex flex-row justify-center justify-items-center">
- <img onclick="location.href='${link}';" class="cursor-pointer object-cover rounded-[10%] select-none w-12 h-12 mr-1" src="https://f003.backblazeb2.com/file/sayana-photos/webp-320p/${thumbnail}.webp">
+ <img onclick="location.href='${link}';" class="cursor-pointer object-cover rounded-[10%] select-none w-12 h-12 mr-1" src='{{ printf .ThumbnailBaseUrl "${thumbnail}" }}'>
<span><b><a href="${link}">${title}</a></b><br><a href="https://www.openstreetmap.org/#map=13/${x}/${y}">${x}, ${y}</a></span>
</div>`);
diff --git a/views/pages/home-page.html b/views/pages/home-page.html
index 63259c8..8f74b8e 100644
--- a/views/pages/home-page.html
+++ b/views/pages/home-page.html
@@ -55,7 +55,7 @@
{{- range $_ := iterate .OutlineHeartCount }}
<div class="home-page-heart z-50">♡</div>
{{- end }}
- <img src="https://f003.backblazeb2.com/file/sayana-static/home-page-gifs/{{ .GifName }}"
+ <img src="{{ .GifUrl }}"
class="home-page-gif z-49 -rotate-12 max-w-[70%] max-h-[70%] border-4 border-background-dark border-inset">
</div>
diff --git a/views/partials/catalogue-blog-cards.html b/views/partials/catalogue-blog-cards.html
index 7096c0d..0492c38 100644
--- a/views/partials/catalogue-blog-cards.html
+++ b/views/partials/catalogue-blog-cards.html
@@ -2,7 +2,7 @@
<hr class="first-of-type:hidden border-t-2 border-dotted border-main-hard">
<div class="w-full flex flex-row items-stretch">
<div class="relative min-h-24 flex flex-col w-28 overflow-hidden shrink-0 mask-r-from-70% mask-r-to-100%">
- <img onclick="return changeUrl('{{ .ArticleLink }}');" class="h-full min-h-24 w-full cursor-pointer select-none object-cover block absolute" src="https://f003.backblazeb2.com/file/sayana-photos/webp-320p/{{ .Thumbnail }}.webp">
+ <img onclick="return changeUrl('{{ .ArticleLink }}');" class="h-full min-h-24 w-full cursor-pointer select-none object-cover block absolute" src="{{ printf $.ThumbnailBaseUrl .Thumbnail }}">
<div class="w-full h-6 flex flex-row mt-auto relative">
<div class="flex-1/2 flex flex-row justify-center select-none bg-linear-180 {{ if .Liked }}from-accent-deep/40 to-accent-deep/80 text-background-dark{{ else }}from-accent-light/40 to-accent-light/80 text-main-hard{{ end }}">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="-2 -2 28 28" id="Smiley-Thumbs-Up--Streamline-Freehand">