Skip to content

Commit e099355

Browse files
dorlugasigalCopilot
andcommitted
fix(pwa): serve icons from landing page to bypass DevTunnel auth
Safari/Edge fetch PWA icons without auth cookies, which fails through private DevTunnels. Host icons on termbeam.pages.dev (public, no auth) and point apple-touch-icon + manifest icon URLs there. Also added termbeam.pages.dev to CSP img-src. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 340099e commit e099355

7 files changed

Lines changed: 17 additions & 9 deletions

File tree

17.2 KB
Loading
13.7 KB
Loading
51.2 KB
Loading

src/frontend/index.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,16 @@
1111
<meta name="mobile-web-app-capable" content="yes" />
1212
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
1313
<link rel="icon" type="image/png" href="/icons/icon-192.png" />
14-
<link rel="apple-touch-icon" sizes="180x180" href="/icons/icon-180.png" />
15-
<link rel="apple-touch-icon" sizes="192x192" href="/icons/icon-192.png" />
14+
<link
15+
rel="apple-touch-icon"
16+
sizes="180x180"
17+
href="https://termbeam.pages.dev/icons/icon-180.png"
18+
/>
19+
<link
20+
rel="apple-touch-icon"
21+
sizes="192x192"
22+
href="https://termbeam.pages.dev/icons/icon-192.png"
23+
/>
1624
<link rel="manifest" href="/manifest.webmanifest" />
1725
<title>TermBeam</title>
1826
<script>

src/frontend/vite.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ export default defineConfig({
2323
background_color: '#1e1e1e',
2424
theme_color: '#1e1e1e',
2525
icons: [
26-
{ src: '/icons/icon-180.png', sizes: '180x180', type: 'image/png' },
27-
{ src: '/icons/icon-192.png', sizes: '192x192', type: 'image/png' },
28-
{ src: '/icons/icon-512.png', sizes: '512x512', type: 'image/png' },
26+
{ src: 'https://termbeam.pages.dev/icons/icon-180.png', sizes: '180x180', type: 'image/png' },
27+
{ src: 'https://termbeam.pages.dev/icons/icon-192.png', sizes: '192x192', type: 'image/png' },
28+
{ src: 'https://termbeam.pages.dev/icons/icon-512.png', sizes: '512x512', type: 'image/png' },
2929
{
30-
src: '/icons/icon-512.png',
30+
src: 'https://termbeam.pages.dev/icons/icon-512.png',
3131
sizes: '512x512',
3232
type: 'image/png',
3333
purpose: 'any maskable',

src/server/auth.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const LOGIN_HTML = `<!DOCTYPE html>
1010
<meta name="mobile-web-app-capable" content="yes" />
1111
<meta name="theme-color" content="#1e1e1e" />
1212
<link rel="icon" type="image/png" href="/icons/icon-192.png" />
13-
<link rel="apple-touch-icon" sizes="180x180" href="/icons/icon-180.png" />
14-
<link rel="apple-touch-icon" sizes="192x192" href="/icons/icon-192.png" />
13+
<link rel="apple-touch-icon" sizes="180x180" href="https://termbeam.pages.dev/icons/icon-180.png" />
14+
<link rel="apple-touch-icon" sizes="192x192" href="https://termbeam.pages.dev/icons/icon-192.png" />
1515
<link rel="manifest" href="/manifest.webmanifest" />
1616
<title>TermBeam — Login</title>
1717
<style>

src/server/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function createTermBeamServer(overrides = {}) {
6969
res.setHeader('Cache-Control', isPwaAsset ? 'public, max-age=86400' : 'no-store');
7070
res.setHeader(
7171
'Content-Security-Policy',
72-
"default-src 'self'; script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net; img-src 'self' data:; connect-src 'self' ws: wss: https://cdn.jsdelivr.net; font-src 'self' https://cdn.jsdelivr.net",
72+
"default-src 'self'; script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net; img-src 'self' data: https://termbeam.pages.dev; connect-src 'self' ws: wss: https://cdn.jsdelivr.net; font-src 'self' https://cdn.jsdelivr.net",
7373
);
7474
next();
7575
});

0 commit comments

Comments
 (0)