refactor(assets): PWA improvements and app config snake_case migration (#790)

- Service worker: versioned cache name, navigation preload, stale-while-revalidate for images
- New PWAModule extracted from MiscModule with async registration and update detection
- SW update notification toast in Hugo template with i18n support (16 languages)
- Web app manifest template (site.webmanifest) generated from [params.app] config
- [params.app] keys migrated to snake_case: name, short_name, pwa, no_favicon, svg_favicon, mask_color, tile_color, theme_color
- enablePWA moved from [params] to [params.app].pwa
- theme_color no longer accepts single-value, only {light, dark} map
- EventBus: new fixit:sw-update event
- SCSS: new _sw-toast.scss widget for update notification
This commit is contained in:
Cell
2026-06-24 12:43:37 +08:00
committed by GitHub
parent 47247e01c5
commit 5cad4d3df9
31 changed files with 450 additions and 91 deletions
+11
View File
@@ -135,6 +135,17 @@
{{- /* Custom widgets */ -}}
{{- block "custom-widgets" . }}{{ end -}}
{{- /* Service Worker Update Notification */ -}}
{{- if .Site.Params.app.pwa -}}
<div class="sw-update-notification">
<div class="sw-update-content">
<p class="sw-update-title">{{ T "serviceWorker.updateTitle" }}</p>
<p class="sw-update-text">{{ T "serviceWorker.updateText" }}</p>
</div>
<button type="button" class="sw-update-btn">{{ T "assets.refresh" }}</button>
</div>
{{- end -}}
<noscript>
<div class="noscript-warning">{{ T "baseof.noscript" }}</div>
</noscript>