-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
59 lines (55 loc) · 2.39 KB
/
Copy pathindex.html
File metadata and controls
59 lines (55 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, viewport-fit=cover"
/>
<title>Podcasts</title>
<link data-trunk rel="rust" data-wasm-opt="z" />
<link data-trunk rel="copy-file" href="feeds.json" />
<link data-trunk rel="css" href="styles.css" />
<!-- PWA assets: copy-file/copy-dir copy verbatim (no content hashing), so
sw.js / manifest / icons keep stable URLs the manifest & SW can rely on. -->
<link data-trunk rel="copy-file" href="sw.js" />
<link data-trunk rel="copy-file" href="manifest.webmanifest" />
<link data-trunk rel="copy-dir" href="icons" />
<!-- Relative hrefs so the one build works at both / (trunk serve) and
/audio-player/ (GitHub Pages). -->
<link rel="manifest" href="manifest.webmanifest" />
<link rel="icon" href="icons/icon-192.png" />
<meta name="theme-color" content="#111111" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="Podcasts" />
<link rel="apple-touch-icon" href="icons/apple-touch-icon-180.png" />
</head>
<body>
<script>
// Register the app-shell service worker. Page-relative './sw.js' resolves
// to /audio-player/sw.js in prod and /sw.js in dev — same code, both right.
if ("serviceWorker" in navigator) {
window.addEventListener("load", () => {
navigator.serviceWorker
.register("./sw.js")
.catch((e) => console.warn("SW registration failed:", e));
});
// Warm the runtime cache with THIS page's same-origin assets so the very
// first visit is already offline-capable (see sw.js "warm-up").
const warm = () => {
const ctrl = navigator.serviceWorker.controller;
if (!ctrl) return;
const urls = performance
.getEntriesByType("resource")
.map((e) => e.name)
.filter((u) => u.startsWith(location.origin));
ctrl.postMessage({ type: "warm", urls });
};
navigator.serviceWorker.addEventListener("controllerchange", warm);
navigator.serviceWorker.ready.then(warm);
}
</script>
</body>
</html>