feat: add Goldfish Recap YouTube summary PWA

YouTube subtitles via OpenRouter become persistent, shareable recaps
with timestamp jump links, PIN-protected creation, and Traefik deploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Frank Schwenk
2026-06-16 15:49:24 +02:00
commit 3f1da92cf4
27 changed files with 2070 additions and 0 deletions
+77
View File
@@ -0,0 +1,77 @@
const TOKEN_KEY = "goldfish_token";
export function getToken() {
return localStorage.getItem(TOKEN_KEY);
}
export function setToken(token) {
localStorage.setItem(TOKEN_KEY, token);
}
export function clearToken() {
localStorage.removeItem(TOKEN_KEY);
}
export function isLoggedIn() {
return Boolean(getToken());
}
async function request(path, options = {}) {
const headers = { ...(options.headers || {}) };
if (options.body && !headers["Content-Type"]) {
headers["Content-Type"] = "application/json";
}
const token = getToken();
if (token) headers.Authorization = `Bearer ${token}`;
const resp = await fetch(path, { ...options, headers });
let data = null;
const ct = resp.headers.get("content-type") || "";
if (ct.includes("application/json")) {
data = await resp.json();
}
if (!resp.ok) {
const detail = data?.detail;
const msg = typeof detail === "string" ? detail : detail?.msg || resp.statusText;
throw new Error(msg || "Request failed");
}
return data;
}
export const api = {
login(pin) {
return request("/api/auth/pin", { method: "POST", body: JSON.stringify({ pin }) });
},
listRecaps(limit = 20, offset = 0) {
return request(`/api/recaps?limit=${limit}&offset=${offset}`);
},
getRecap(videoId) {
return request(`/api/recaps/${encodeURIComponent(videoId)}`);
},
createRecap(url, force = false) {
return request("/api/recaps", { method: "POST", body: JSON.stringify({ url, force }) });
},
regenerateRecap(videoId) {
return request(`/api/recaps/${encodeURIComponent(videoId)}/regenerate`, { method: "POST" });
},
};
export function formatTimestamp(seconds) {
const s = Math.max(0, Math.floor(seconds));
const h = Math.floor(s / 3600);
const m = Math.floor((s % 3600) / 60);
const sec = s % 60;
if (h > 0) return `${h}:${String(m).padStart(2, "0")}:${String(sec).padStart(2, "0")}`;
return `${m}:${String(sec).padStart(2, "0")}`;
}
export function youtubeUrl(videoId, seconds) {
const base = `https://www.youtube.com/watch?v=${videoId}`;
return seconds != null ? `${base}&t=${Math.floor(seconds)}s` : base;
}
export const VERDICT_LABELS = {
watch: { text: "Lohnt sich", emoji: "🎬", className: "verdict-watch" },
skim: { text: "Nur Stellen", emoji: "🐟", className: "verdict-skim" },
skip: { text: "Skip it", emoji: "💤", className: "verdict-skip" },
};
+165
View File
@@ -0,0 +1,165 @@
import {
api,
VERDICT_LABELS,
formatTimestamp,
getToken,
setToken,
isLoggedIn,
} from "./api.js";
const createModal = document.getElementById("createModal");
const pinModal = document.getElementById("pinModal");
const recapList = document.getElementById("recapList");
const emptyState = document.getElementById("emptyState");
const listError = document.getElementById("listError");
function escapeHtml(text) {
const div = document.createElement("div");
div.textContent = text;
return div.innerHTML;
}
function renderRecapCard(item) {
const verdict = VERDICT_LABELS[item.watch_verdict] || VERDICT_LABELS.skim;
const href = `/r/${encodeURIComponent(item.video_id)}`;
return `
<a class="recapCard" href="${href}">
<img class="recapThumb" src="${escapeHtml(item.thumbnail_url || "")}" alt="" loading="lazy">
<div class="recapCardBody">
<span class="verdictBadge ${verdict.className}">${verdict.emoji} ${verdict.text}</span>
<h3>${escapeHtml(item.title)}</h3>
<p class="recapTldr">${escapeHtml(item.tldr)}</p>
<span class="recapMeta">${escapeHtml(item.channel || "")}</span>
</div>
</a>
`;
}
async function loadRecaps() {
listError.hidden = true;
try {
const data = await api.listRecaps(30);
const items = data.items || [];
if (!items.length) {
recapList.innerHTML = "";
emptyState.hidden = false;
return;
}
emptyState.hidden = true;
recapList.innerHTML = items.map(renderRecapCard).join("");
} catch (err) {
listError.textContent = err.message || "Liste konnte nicht geladen werden.";
listError.hidden = false;
}
}
function openPinModal() {
document.getElementById("pinError").hidden = true;
document.getElementById("pinInput").value = "";
pinModal.showModal();
document.getElementById("pinInput").focus();
}
function waitForPinLogin() {
return new Promise((resolve, reject) => {
if (isLoggedIn()) {
resolve();
return;
}
openPinModal();
pinModal.addEventListener(
"close",
() => {
if (isLoggedIn()) resolve();
else reject(new Error("Abgebrochen"));
},
{ once: true }
);
});
}
function openCreateModal() {
document.getElementById("createError").hidden = true;
document.getElementById("createProgress").hidden = true;
document.getElementById("urlInput").value = "";
document.getElementById("forceCheckbox").checked = false;
document.getElementById("createSubmit").disabled = false;
createModal.showModal();
document.getElementById("urlInput").focus();
}
async function handleCreate(e) {
e.preventDefault();
const url = document.getElementById("urlInput").value.trim();
const force = document.getElementById("forceCheckbox").checked;
const errEl = document.getElementById("createError");
const progress = document.getElementById("createProgress");
const submit = document.getElementById("createSubmit");
errEl.hidden = true;
progress.hidden = false;
submit.disabled = true;
try {
const result = await api.createRecap(url, force);
createModal.close();
window.location.href = `/r/${encodeURIComponent(result.recap.video_id)}`;
} catch (err) {
errEl.textContent = err.message || "Recap fehlgeschlagen.";
errEl.hidden = false;
progress.hidden = true;
submit.disabled = false;
}
}
function wirePinForm() {
document.getElementById("pinCancel").addEventListener("click", () => pinModal.close());
document.getElementById("pinForm").addEventListener("submit", async (e) => {
e.preventDefault();
const pin = document.getElementById("pinInput").value.trim();
const errEl = document.getElementById("pinError");
errEl.hidden = true;
try {
const { token } = await api.login(pin);
setToken(token);
pinModal.close();
} catch {
errEl.textContent = "Falscher PIN. Dein Goldfisch auch.";
errEl.hidden = false;
}
});
}
function wireCreate() {
document.getElementById("newRecapBtn").addEventListener("click", async () => {
try {
await waitForPinLogin();
openCreateModal();
} catch {
/* cancelled */
}
});
document.getElementById("createCancel").addEventListener("click", () => createModal.close());
document.getElementById("createForm").addEventListener("submit", async (e) => {
e.preventDefault();
if (!isLoggedIn()) {
try {
await waitForPinLogin();
} catch {
return;
}
}
await handleCreate(e);
});
}
function registerSw() {
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("/sw.js").catch(() => {});
}
}
wirePinForm();
wireCreate();
loadRecaps();
registerSw();
Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

+10
View File
@@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" fill="none">
<rect width="128" height="128" rx="28" fill="#0B3D5C"/>
<ellipse cx="64" cy="68" rx="38" ry="28" fill="#FF9F43"/>
<ellipse cx="64" cy="68" rx="30" ry="22" fill="#FFB366"/>
<circle cx="78" cy="58" r="6" fill="#0B3D5C"/>
<circle cx="80" cy="56" r="2" fill="#FFF"/>
<path d="M26 68 Q18 58 22 48 Q28 52 30 62" fill="#FF9F43"/>
<path d="M38 88 Q64 98 90 88" stroke="#E8892E" stroke-width="3" fill="none" stroke-linecap="round"/>
<text x="64" y="118" text-anchor="middle" fill="#FFF8F0" font-family="sans-serif" font-size="10" font-weight="bold">3s</text>
</svg>

After

Width:  |  Height:  |  Size: 648 B

+85
View File
@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<meta name="theme-color" content="#0B3D5C">
<meta name="description" content="Goldfish Recap — YouTube-Zusammenfassungen für Second-Screen-Survivors">
<link rel="manifest" href="/manifest.json">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/icon-192.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/styles.css">
<title>Goldfish Recap</title>
</head>
<body>
<div id="app">
<header class="hero">
<div class="heroInner">
<div class="logoRow">
<img src="/icon.svg" alt="" class="logo" width="56" height="56">
<div>
<h1>Goldfish Recap</h1>
<p class="tagline">Second Screen? Kein Problem. Dein Gehirn hat abgespeichert: nein. Wir: ja.</p>
</div>
</div>
<button type="button" class="btn btn-primary" id="newRecapBtn">+ Neues Recap</button>
</div>
</header>
<main class="main">
<section id="recapListSection">
<h2 class="sectionTitle">Zuletzt gerettet</h2>
<div id="recapList" class="recapGrid"></div>
<p id="emptyState" class="emptyState" hidden>
Noch keine Recaps. Paste eine YouTube-URL — der Goldfisch erinnert sich für dich.
</p>
<p id="listError" class="errorText" hidden></p>
</section>
</main>
<footer class="footer">
<span>🐟 3-Sekunden-Gedächtnis? Nicht mehr.</span>
</footer>
</div>
<!-- Create modal -->
<dialog id="createModal" class="modal">
<form method="dialog" id="createForm" class="modalBody">
<h2>Neues Recap</h2>
<p class="modalHint">YouTube-URL rein, Goldfisch macht den Rest.</p>
<input type="url" id="urlInput" class="textInput" placeholder="https://youtube.com/watch?v=…" required>
<label class="checkboxRow">
<input type="checkbox" id="forceCheckbox">
<span>Neu generieren, falls schon vorhanden</span>
</label>
<p id="createError" class="errorText" hidden></p>
<div class="modalActions">
<button type="button" class="btn btn-ghost" id="createCancel">Abbrechen</button>
<button type="submit" class="btn btn-primary" id="createSubmit">Recap starten</button>
</div>
<div id="createProgress" class="progressBox" hidden>
<div class="spinner"></div>
<p>Untertitel fischen… KI denkt nach… Goldfisch schwimmt im Kreis…</p>
</div>
</form>
</dialog>
<!-- PIN modal -->
<dialog id="pinModal" class="modal">
<form method="dialog" id="pinForm" class="modalBody">
<h2>PIN bitte</h2>
<p class="modalHint">Recaps erstellen ist nur für eingeweihte Goldfische.</p>
<input type="password" id="pinInput" class="textInput pinInput" inputmode="numeric" autocomplete="off" placeholder="PIN" required>
<p id="pinError" class="errorText" hidden></p>
<div class="modalActions">
<button type="button" class="btn btn-ghost" id="pinCancel">Abbrechen</button>
<button type="submit" class="btn btn-primary">Anmelden</button>
</div>
</form>
</dialog>
<script type="module" src="/app.js"></script>
</body>
</html>
+22
View File
@@ -0,0 +1,22 @@
{
"name": "Goldfish Recap",
"short_name": "Goldfish",
"description": "YouTube-Recaps für Second-Screen-Survivors",
"start_url": "/",
"display": "standalone",
"background_color": "#FFF8F0",
"theme_color": "#0B3D5C",
"icons": [
{
"src": "/icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/icon.svg",
"sizes": "any",
"type": "image/svg+xml",
"purpose": "any"
}
]
}
+83
View File
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<meta name="theme-color" content="#0B3D5C">
<meta id="metaDescription" name="description" content="Goldfish Recap">
<meta id="ogTitle" property="og:title" content="Goldfish Recap">
<meta id="ogDescription" property="og:description" content="">
<meta id="ogImage" property="og:image" content="">
<link rel="manifest" href="/manifest.json">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/styles.css">
<title>Goldfish Recap</title>
</head>
<body>
<div id="app" class="recapPage">
<header class="topBar">
<a href="/" class="backLink">← Alle Recaps</a>
<button type="button" class="btn btn-ghost btn-sm" id="copyLinkBtn">Link kopieren</button>
</header>
<main id="recapMain" class="recapMain" hidden>
<div class="videoHero">
<a id="thumbLink" href="#" target="_blank" rel="noopener">
<img id="thumbImg" src="" alt="" class="thumb">
</a>
<div class="videoMeta">
<span id="verdictBadge" class="verdictBadge"></span>
<h1 id="videoTitle"></h1>
<p id="channelName" class="channelName"></p>
</div>
</div>
<section class="card tldrCard">
<h2>TL;DR</h2>
<p id="tldrText"></p>
<p id="vibeText" class="vibeText"></p>
</section>
<section class="card">
<h2>Sprungmarken</h2>
<p class="sectionHint">Klick = direkt zur Stelle auf YouTube. Für dein Goldfisch-Gehirn optimiert.</p>
<div id="sectionsList" class="sectionsList"></div>
</section>
<section class="card goldfishCard">
<p id="goldfishNote"></p>
</section>
<div class="adminRow" id="adminRow" hidden>
<button type="button" class="btn btn-ghost" id="regenerateBtn">Neu generieren</button>
</div>
</main>
<div id="loadingState" class="loadingState">
<div class="spinner"></div>
<p>Goldfisch lädt dein Recap…</p>
</div>
<div id="errorState" class="errorState" hidden>
<p id="errorText"></p>
<a href="/" class="btn btn-primary">Zurück</a>
</div>
</div>
<dialog id="pinModal" class="modal">
<form method="dialog" id="pinForm" class="modalBody">
<h2>PIN bitte</h2>
<input type="password" id="pinInput" class="textInput pinInput" inputmode="numeric" autocomplete="off" placeholder="PIN" required>
<p id="pinError" class="errorText" hidden></p>
<div class="modalActions">
<button type="button" class="btn btn-ghost" id="pinCancel">Abbrechen</button>
<button type="submit" class="btn btn-primary">Anmelden</button>
</div>
</form>
</dialog>
<script type="module" src="/recap.js"></script>
</body>
</html>
+148
View File
@@ -0,0 +1,148 @@
import {
api,
VERDICT_LABELS,
formatTimestamp,
youtubeUrl,
getToken,
setToken,
isLoggedIn,
} from "./api.js";
function getVideoIdFromPath() {
const parts = window.location.pathname.split("/").filter(Boolean);
if (parts[0] === "r" && parts[1]) return decodeURIComponent(parts[1]);
const params = new URLSearchParams(window.location.search);
return params.get("v") || "";
}
function escapeHtml(text) {
const div = document.createElement("div");
div.textContent = text;
return div.innerHTML;
}
function setMeta(recap) {
document.title = `${recap.title} — Goldfish Recap`;
document.getElementById("metaDescription").content = recap.tldr;
document.getElementById("ogTitle").content = recap.title;
document.getElementById("ogDescription").content = recap.tldr;
document.getElementById("ogImage").content = recap.thumbnail_url || "";
}
function renderRecap(recap) {
const verdict = VERDICT_LABELS[recap.watch_verdict] || VERDICT_LABELS.skim;
document.getElementById("verdictBadge").className = `verdictBadge ${verdict.className}`;
document.getElementById("verdictBadge").textContent = `${verdict.emoji} ${verdict.text}`;
document.getElementById("videoTitle").textContent = recap.title;
document.getElementById("channelName").textContent = recap.channel || "";
document.getElementById("thumbImg").src = recap.thumbnail_url || "";
document.getElementById("thumbImg").alt = recap.title;
document.getElementById("thumbLink").href = youtubeUrl(recap.video_id);
document.getElementById("tldrText").textContent = recap.tldr;
document.getElementById("vibeText").textContent = recap.vibe_check || "";
document.getElementById("goldfishNote").textContent = recap.goldfish_note || "";
const sections = recap.sections || [];
document.getElementById("sectionsList").innerHTML = sections
.map(
(s) => `
<a class="sectionCard" href="${youtubeUrl(recap.video_id, s.timestamp_seconds)}" target="_blank" rel="noopener">
<span class="sectionTime">${formatTimestamp(s.timestamp_seconds)}</span>
<span class="sectionEmoji">${escapeHtml(s.emoji || "🐟")}</span>
<div>
<h3>${escapeHtml(s.title)}</h3>
<p>${escapeHtml(s.summary)}</p>
</div>
</a>
`
)
.join("");
setMeta(recap);
}
function showError(msg) {
document.getElementById("loadingState").hidden = true;
document.getElementById("recapMain").hidden = true;
document.getElementById("errorState").hidden = false;
document.getElementById("errorText").textContent = msg;
}
async function loadRecap() {
const videoId = getVideoIdFromPath();
if (!videoId) {
showError("Keine Video-ID in der URL.");
return;
}
try {
const recap = await api.getRecap(videoId);
document.getElementById("loadingState").hidden = true;
document.getElementById("recapMain").hidden = false;
renderRecap(recap);
if (isLoggedIn()) {
document.getElementById("adminRow").hidden = false;
}
document.getElementById("copyLinkBtn").addEventListener("click", async () => {
const url = `${window.location.origin}/r/${encodeURIComponent(videoId)}`;
try {
await navigator.clipboard.writeText(url);
document.getElementById("copyLinkBtn").textContent = "Kopiert!";
setTimeout(() => {
document.getElementById("copyLinkBtn").textContent = "Link kopieren";
}, 2000);
} catch {
window.prompt("Link kopieren:", url);
}
});
} catch (err) {
showError(err.message || "Recap nicht gefunden.");
}
}
function wireRegenerate() {
document.getElementById("regenerateBtn").addEventListener("click", async () => {
const videoId = getVideoIdFromPath();
const btn = document.getElementById("regenerateBtn");
btn.disabled = true;
btn.textContent = "Generiere…";
try {
const result = await api.regenerateRecap(videoId);
renderRecap(result.recap);
} catch (err) {
alert(err.message || "Regenerieren fehlgeschlagen.");
} finally {
btn.disabled = false;
btn.textContent = "Neu generieren";
}
});
}
function wirePinModal() {
const pinModal = document.getElementById("pinModal");
document.getElementById("pinCancel").addEventListener("click", () => pinModal.close());
document.getElementById("pinForm").addEventListener("submit", async (e) => {
e.preventDefault();
const errEl = document.getElementById("pinError");
errEl.hidden = true;
try {
const { token } = await api.login(document.getElementById("pinInput").value.trim());
setToken(token);
pinModal.close();
document.getElementById("adminRow").hidden = false;
} catch {
errEl.textContent = "Falscher PIN.";
errEl.hidden = false;
}
});
}
wireRegenerate();
wirePinModal();
loadRecap();
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("/sw.js").catch(() => {});
}
+446
View File
@@ -0,0 +1,446 @@
:root {
--blue-deep: #0B3D5C;
--blue-mid: #145374;
--orange: #FF9F43;
--orange-dark: #E8892E;
--cream: #FFF8F0;
--cream-dark: #F5EDE3;
--text: #1A2B3C;
--text-muted: #5A6B7C;
--radius: 16px;
--shadow: 0 8px 32px rgba(11, 61, 92, 0.12);
}
* {
box-sizing: border-box;
}
html, body {
margin: 0;
min-height: 100%;
font-family: "Fredoka", system-ui, sans-serif;
background: linear-gradient(160deg, var(--cream) 0%, #E8F4FC 50%, var(--cream-dark) 100%);
color: var(--text);
}
a {
color: inherit;
text-decoration: none;
}
#app {
min-height: 100vh;
display: flex;
flex-direction: column;
}
.hero {
background: var(--blue-deep);
color: white;
padding: 1.5rem 1rem 2rem;
}
.heroInner {
max-width: 960px;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 1rem;
}
.logoRow {
display: flex;
align-items: center;
gap: 1rem;
}
.logo {
filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}
.hero h1 {
margin: 0;
font-size: 1.75rem;
font-weight: 700;
}
.tagline {
margin: 0.25rem 0 0;
opacity: 0.9;
font-size: 0.95rem;
max-width: 28rem;
}
.main {
flex: 1;
max-width: 960px;
margin: 0 auto;
padding: 1.5rem 1rem 3rem;
width: 100%;
}
.sectionTitle {
margin: 0 0 1rem;
font-size: 1.25rem;
color: var(--blue-deep);
}
.recapGrid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 1rem;
}
.recapCard {
background: white;
border-radius: var(--radius);
overflow: hidden;
box-shadow: var(--shadow);
transition: transform 0.15s, box-shadow 0.15s;
display: flex;
flex-direction: column;
}
.recapCard:hover {
transform: translateY(-3px);
box-shadow: 0 12px 40px rgba(11, 61, 92, 0.18);
}
.recapThumb {
width: 100%;
aspect-ratio: 16 / 9;
object-fit: cover;
background: var(--cream-dark);
}
.recapCardBody {
padding: 1rem;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.recapCardBody h3 {
margin: 0;
font-size: 1rem;
line-height: 1.3;
}
.recapTldr {
margin: 0;
font-size: 0.9rem;
color: var(--text-muted);
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
.recapMeta {
font-size: 0.8rem;
color: var(--text-muted);
}
.verdictBadge {
display: inline-block;
font-size: 0.75rem;
font-weight: 600;
padding: 0.25rem 0.6rem;
border-radius: 999px;
width: fit-content;
}
.verdict-watch { background: #D4EDDA; color: #155724; }
.verdict-skim { background: #FFF3CD; color: #856404; }
.verdict-skip { background: #E2E3E5; color: #383D41; }
.btn {
font-family: inherit;
font-weight: 600;
font-size: 0.95rem;
border: none;
border-radius: 999px;
padding: 0.65rem 1.25rem;
cursor: pointer;
transition: transform 0.1s, opacity 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary {
background: var(--orange);
color: var(--blue-deep);
}
.btn-primary:hover { background: var(--orange-dark); }
.btn-ghost {
background: transparent;
color: inherit;
border: 2px solid rgba(255,255,255,0.4);
}
.recapPage .btn-ghost {
border-color: var(--blue-mid);
color: var(--blue-deep);
}
.btn-sm {
font-size: 0.85rem;
padding: 0.4rem 0.9rem;
}
.footer {
text-align: center;
padding: 1.5rem;
color: var(--text-muted);
font-size: 0.9rem;
}
.emptyState, .errorText {
color: var(--text-muted);
text-align: center;
padding: 2rem;
}
.errorText { color: #C0392B; }
.modal {
border: none;
border-radius: var(--radius);
padding: 0;
max-width: 420px;
width: calc(100% - 2rem);
box-shadow: var(--shadow);
}
.modal::backdrop {
background: rgba(11, 61, 92, 0.5);
}
.modalBody {
padding: 1.5rem;
margin: 0;
}
.modalBody h2 {
margin: 0 0 0.5rem;
color: var(--blue-deep);
}
.modalHint {
margin: 0 0 1rem;
color: var(--text-muted);
font-size: 0.9rem;
}
.textInput {
width: 100%;
font-family: inherit;
font-size: 1rem;
padding: 0.75rem 1rem;
border: 2px solid var(--cream-dark);
border-radius: 12px;
margin-bottom: 0.75rem;
}
.textInput:focus {
outline: none;
border-color: var(--orange);
}
.checkboxRow {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.9rem;
margin-bottom: 1rem;
cursor: pointer;
}
.modalActions {
display: flex;
gap: 0.75rem;
justify-content: flex-end;
}
.progressBox {
margin-top: 1rem;
text-align: center;
color: var(--text-muted);
font-size: 0.9rem;
}
.spinner {
width: 36px;
height: 36px;
border: 3px solid var(--cream-dark);
border-top-color: var(--orange);
border-radius: 50%;
animation: spin 0.8s linear infinite;
margin: 0 auto 0.75rem;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* Recap detail page */
.recapPage .topBar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem;
max-width: 720px;
margin: 0 auto;
width: 100%;
}
.backLink {
color: var(--blue-deep);
font-weight: 600;
}
.recapMain {
max-width: 720px;
margin: 0 auto;
padding: 0 1rem 3rem;
width: 100%;
}
.videoHero {
margin-bottom: 1.25rem;
}
.thumb {
width: 100%;
border-radius: var(--radius);
aspect-ratio: 16 / 9;
object-fit: cover;
box-shadow: var(--shadow);
}
.videoMeta {
margin-top: 1rem;
}
.videoMeta h1 {
margin: 0.5rem 0 0.25rem;
font-size: 1.5rem;
line-height: 1.25;
}
.channelName {
margin: 0;
color: var(--text-muted);
}
.card {
background: white;
border-radius: var(--radius);
padding: 1.25rem;
margin-bottom: 1rem;
box-shadow: var(--shadow);
}
.card h2 {
margin: 0 0 0.75rem;
font-size: 1.1rem;
color: var(--blue-deep);
}
.tldrCard p {
margin: 0;
line-height: 1.5;
}
.vibeText {
margin-top: 0.75rem !important;
font-style: italic;
color: var(--text-muted);
}
.sectionHint {
margin: -0.5rem 0 1rem;
font-size: 0.85rem;
color: var(--text-muted);
}
.sectionsList {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.sectionCard {
display: grid;
grid-template-columns: auto auto 1fr;
gap: 0.75rem;
align-items: start;
padding: 1rem;
background: var(--cream);
border-radius: 12px;
transition: background 0.15s, transform 0.1s;
}
.sectionCard:hover {
background: var(--cream-dark);
transform: translateX(4px);
}
.sectionTime {
font-family: "JetBrains Mono", monospace;
font-size: 0.85rem;
font-weight: 500;
color: var(--orange-dark);
white-space: nowrap;
}
.sectionEmoji {
font-size: 1.25rem;
}
.sectionCard h3 {
margin: 0 0 0.25rem;
font-size: 0.95rem;
}
.sectionCard p {
margin: 0;
font-size: 0.9rem;
color: var(--text-muted);
line-height: 1.4;
}
.goldfishCard {
background: linear-gradient(135deg, var(--blue-deep), var(--blue-mid));
color: white;
text-align: center;
}
.goldfishCard p {
margin: 0;
font-size: 1.05rem;
line-height: 1.5;
}
.adminRow {
text-align: center;
margin-top: 1rem;
}
.loadingState, .errorState {
text-align: center;
padding: 4rem 1rem;
color: var(--text-muted);
}
@media (max-width: 480px) {
.hero h1 { font-size: 1.4rem; }
.sectionCard { grid-template-columns: 1fr; }
.sectionTime { order: -1; }
}
+34
View File
@@ -0,0 +1,34 @@
const CACHE = "goldfish-v1";
const ASSETS = ["/", "/index.html", "/r.html", "/styles.css", "/app.js", "/recap.js", "/api.js", "/manifest.json", "/icon.svg"];
self.addEventListener("install", (event) => {
event.waitUntil(caches.open(CACHE).then((cache) => cache.addAll(ASSETS)));
self.skipWaiting();
});
self.addEventListener("activate", (event) => {
event.waitUntil(
caches.keys().then((keys) =>
Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k)))
)
);
self.clients.claim();
});
self.addEventListener("fetch", (event) => {
const url = new URL(event.request.url);
if (url.pathname.startsWith("/api/")) return;
event.respondWith(
caches.match(event.request).then((cached) => {
if (cached) return cached;
return fetch(event.request).then((resp) => {
if (resp.ok && event.request.method === "GET" && url.origin === self.location.origin) {
const clone = resp.clone();
caches.open(CACHE).then((cache) => cache.put(event.request, clone));
}
return resp;
});
})
);
});