From a3c298f617840be5a0d0a7b510d154a1746a4b1b Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Sat, 11 Oct 2025 12:48:30 +0200 Subject: [PATCH] Frontend: Add browser capabilities check #5047 Signed-off-by: Michael Mayer --- AGENTS.md | 9 +++- CODEMAP.md | 8 +++- assets/static/js/app-loader.js | 84 +++++++++++++++++++++++++++++++++ assets/templates/app.js.gohtml | 1 + assets/templates/index.gohtml | 2 +- assets/templates/minimal.gohtml | 2 +- assets/templates/share.gohtml | 2 +- frontend/CODEMAP.md | 8 ++++ frontend/src/css/splash.css | 10 +++- 9 files changed, 120 insertions(+), 6 deletions(-) create mode 100644 assets/static/js/app-loader.js create mode 100644 assets/templates/app.js.gohtml diff --git a/AGENTS.md b/AGENTS.md index fabf63f93..685b68258 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,6 +1,6 @@ # PhotoPrism® Repository Guidelines -**Last Updated:** October 10, 2025 +**Last Updated:** October 11, 2025 ## Purpose @@ -41,6 +41,13 @@ Learn more: https://agents.md/ - Frontend: Vue 3 + Vuetify 3 (`frontend/`) - Docker/compose for dev/CI; Traefik is used for local TLS (`*.localssl.dev`) +### Web Templates & Shared Assets + +- HTML entrypoints live under `assets/templates/`; key files are `index.gohtml`, `app.gohtml`, `app.js.gohtml`, and `splash.gohtml`. The SPA loader logic resides in `assets/static/js/app-loader.js` and is included via `app.js.gohtml`; it performs capability checks (Promise, fetch, AbortController, `script.noModule`, etc.) before appending `window.__CONFIG__.jsUri`. +- The same loader partial is reused in private packages (`pro/assets/templates/index.gohtml`, `plus/assets/templates/index.gohtml`). Whenever you touch `app.js.gohtml` or change how we load the bundle, mirror the update by running commands such as `cd pro && sed -n '1,160p' assets/templates/index.gohtml` (and similarly for `plus`) to confirm they include the shared partial instead of hard-coding ` \ No newline at end of file diff --git a/assets/templates/index.gohtml b/assets/templates/index.gohtml index ba33e91ed..18fc58f7f 100644 --- a/assets/templates/index.gohtml +++ b/assets/templates/index.gohtml @@ -36,6 +36,6 @@ {{template "app.gohtml" .}} - +{{template "app.js.gohtml" .}} diff --git a/assets/templates/minimal.gohtml b/assets/templates/minimal.gohtml index 042df166f..0c407b96f 100644 --- a/assets/templates/minimal.gohtml +++ b/assets/templates/minimal.gohtml @@ -19,6 +19,6 @@ {{template "app.gohtml" .}} - +{{template "app.js.gohtml" .}} diff --git a/assets/templates/share.gohtml b/assets/templates/share.gohtml index b40ed6400..4978104b7 100644 --- a/assets/templates/share.gohtml +++ b/assets/templates/share.gohtml @@ -32,6 +32,6 @@ {{template "app.gohtml" .}} - +{{template "app.js.gohtml" .}} diff --git a/frontend/CODEMAP.md b/frontend/CODEMAP.md index 96b0aebdf..8dbf943c2 100644 --- a/frontend/CODEMAP.md +++ b/frontend/CODEMAP.md @@ -1,5 +1,7 @@ PhotoPrism — Frontend CODEMAP +**Last Updated:** October 11, 2025 + Purpose - Help agents and contributors navigate the Vue 3 + Vuetify 3 app quickly and make safe changes. - Use Makefile targets and scripts in `frontend/package.json` as sources of truth. @@ -24,6 +26,12 @@ Directory Map (src) - `src/css/*` — styles loaded by Webpack - `src/locales/*` — gettext catalogs; extraction/compile scripts in `package.json` +Startup Templates & Splash Screen +- The HTML shell is rendered from `assets/templates/index.gohtml` (and `pro/assets/templates/index.gohtml` / `plus/...`). Each template includes `app.gohtml` for the splash markup and `app.js.gohtml` to inject the bundle. +- The loader script lives in `assets/static/js/app-loader.js` (included via `app.js.gohtml`) and checks for modern browser features (Promise, fetch, AbortController, `script.noModule`, etc.) before loading `window.__CONFIG__.jsUri`. Update the same files in private repos whenever the loader logic changes. +- Splash styles, including the `.splash-warning` fallback banner, live in `frontend/src/css/splash.css`. Keep styling changes there so public and private editions stay aligned. +- Baseline support: Safari 13 / iOS 13 or current Chrome, Edge, or Firefox. If the support matrix changes, revise the warning text in `app.js.gohtml` and the CSS message accordingly. + Runtime & Plugins - Vue 3 + Vuetify 3 (`createVuetify`) with MDI icons; themes from `src/options/themes.js` - Router: Vue Router 4, history base at `$config.baseUri + "/library/"` diff --git a/frontend/src/css/splash.css b/frontend/src/css/splash.css index e255ec74d..98fd80ee3 100644 --- a/frontend/src/css/splash.css +++ b/frontend/src/css/splash.css @@ -221,6 +221,15 @@ a.logo-large { color: #bbbbb5; } +.splash-warning { + display: block; + font-weight: 600; + color: #bbbbb5; + margin: 0 auto; + max-width: 520px; + line-height: 1.5; +} + #noscript-info.splash-info, #noscript-info.splash-info a { font-weight: 500; @@ -286,4 +295,3 @@ div.loading-bar { right: 10%; left: 10%; } -