diff --git a/admin-ui/src/test/sw.test.ts b/admin-ui/src/test/sw.test.ts index 1bb4d2ca..1a4cd72f 100644 --- a/admin-ui/src/test/sw.test.ts +++ b/admin-ui/src/test/sw.test.ts @@ -43,6 +43,19 @@ describe('service worker', () => { expect(network).toHaveBeenCalledTimes(1); }); + it("fetches the connect and setup pages' stylesheet and scripts from the network even when cached", async () => { + for (const path of ['/assets/style.css', '/assets/theme-init.js']) { + const { network, request } = loadWorker({ [path]: 'stale' }); + await expect(request(path)).resolves.toMatchObject({ body: 'network' }); + expect(network).toHaveBeenCalledTimes(1); + } + }); + + it('serves fonts and icons from the cache first', async () => { + const { request } = loadWorker({ '/assets/fonts/figtree-variable.woff2': 'cached' }); + await expect(request('/assets/fonts/figtree-variable.woff2')).resolves.toBe('cached'); + }); + it('serves hashed console assets from the cache first', async () => { const { request } = loadWorker({ '/admin/assets/index-abc.js': 'cached' }); await expect(request('/admin/assets/index-abc.js')).resolves.toBe('cached'); diff --git a/internal/web/adminui/adminui.go b/internal/web/adminui/adminui.go index 87a8ba3b..e0eef357 100644 --- a/internal/web/adminui/adminui.go +++ b/internal/web/adminui/adminui.go @@ -58,17 +58,22 @@ func Handler(fsys fs.FS, csp string) http.Handler { } // notBuiltPage is what a source build without the console serves at /admin. It -// is self-contained: no inline style or script, so the strict CSP holds. +// wears the connect page's stylesheet (internal/web/assets) and has no inline style +// or script, so the strict CSP holds. const notBuiltPage = ` -AudioSilo - admin console not built +AudioSilo - admin console not built + + +

The admin console isn't built

-

This server was compiled without the admin console. Build it, then rebuild the server:

+

This server was compiled without the admin console. Build it, then rebuild the server:

scripts/build-admin.sh
 go build ./cmd/audiosilo
-

Release binaries and the Docker image include it.

+

Release binaries and the Docker image include it.

+
` diff --git a/internal/web/assets/fonts/bricolage-grotesque-variable.woff2 b/internal/web/assets/fonts/bricolage-grotesque-variable.woff2 new file mode 100644 index 00000000..82152a40 Binary files /dev/null and b/internal/web/assets/fonts/bricolage-grotesque-variable.woff2 differ diff --git a/internal/web/assets/fonts/figtree-variable.woff2 b/internal/web/assets/fonts/figtree-variable.woff2 new file mode 100644 index 00000000..05ce657d Binary files /dev/null and b/internal/web/assets/fonts/figtree-variable.woff2 differ diff --git a/internal/web/assets/fonts/roboto-400.woff2 b/internal/web/assets/fonts/roboto-400.woff2 deleted file mode 100644 index 77e42594..00000000 Binary files a/internal/web/assets/fonts/roboto-400.woff2 and /dev/null differ diff --git a/internal/web/assets/fonts/roboto-500.woff2 b/internal/web/assets/fonts/roboto-500.woff2 deleted file mode 100644 index 171a2f6a..00000000 Binary files a/internal/web/assets/fonts/roboto-500.woff2 and /dev/null differ diff --git a/internal/web/assets/fonts/roboto-700.woff2 b/internal/web/assets/fonts/roboto-700.woff2 deleted file mode 100644 index 85b8ace2..00000000 Binary files a/internal/web/assets/fonts/roboto-700.woff2 and /dev/null differ diff --git a/internal/web/assets/index.html b/internal/web/assets/index.html index 3dccee5a..fd6f7198 100644 --- a/internal/web/assets/index.html +++ b/internal/web/assets/index.html @@ -5,39 +5,40 @@ AudioSilo - Connect +
-
+
- - AUDIOSILO + + AudioSilo
-
-

Connect a device

-

Enter the auth code from your server administrator.

+
+

Connect a device

+

Enter the auth code from your server administrator.

-
-
-
- - -
- -
+
+
+ + +
+ +
-
+ -