A simple, clean, fast browser for the AtmosphereConf(2026) VODs
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: refresh stale sw clients and tighten embedding reuse

jack 6b8b14a1 0fdcddf8

+25 -3
+3
.gitignore
··· 22 22 *.njsproj 23 23 *.sln 24 24 *.sw? 25 + 26 + # Local debug scripts (not committed) 27 + tmp/
+18 -2
scripts/generate-video-embeddings.mjs
··· 1 1 import { readFile, writeFile } from 'node:fs/promises' 2 2 import { existsSync } from 'node:fs' 3 + import { createHash } from 'node:crypto' 3 4 import path from 'node:path' 4 5 5 6 const PLC_DIRECTORY_URL = 'https://plc.directory' ··· 293 294 } 294 295 295 296 function computeContentSignature(record) { 296 - return toEmbeddingInput(record) 297 + return createHash('sha256').update(toEmbeddingInput(record)).digest('hex') 297 298 } 298 299 299 300 async function embedBatch(inputs) { ··· 444 445 const orderedRecords = orderedUris.map((uri) => recordsByUri.get(uri)) 445 446 446 447 const reuseCandidates = [] 448 + const legacyReuseCandidates = [] 447 449 const missingRecords = [] 448 450 449 451 for (const record of orderedRecords) { 450 452 const existingEntry = existingByUri.get(record.uri) 453 + if (!existingEntry) { 454 + missingRecords.push(record) 455 + continue 456 + } 457 + 451 458 const nextContentSignature = computeContentSignature(record) 452 - if (existingEntry?.contentSignature === nextContentSignature) { 459 + if (!existingEntry.contentSignature) { 460 + legacyReuseCandidates.push({ record, existingEntry }) 461 + reuseCandidates.push({ record, existingEntry }) 462 + continue 463 + } 464 + 465 + if (existingEntry.contentSignature === nextContentSignature) { 453 466 reuseCandidates.push({ record, existingEntry }) 454 467 } else { 455 468 missingRecords.push(record) ··· 509 522 510 523 await writeFile(OUTPUT_PATH, `${JSON.stringify(output, null, 2)}\n`, 'utf8') 511 524 console.log(`Reused embeddings: ${reuseCandidates.length}`) 525 + if (legacyReuseCandidates.length > 0) { 526 + console.log(`Legacy reused without re-embed: ${legacyReuseCandidates.length}`) 527 + } 512 528 console.log(`New embeddings: ${missingRecords.length}`) 513 529 console.log(`Wrote embeddings to ${OUTPUT_PATH}`) 514 530 }
+4 -1
src/main.tsx
··· 9 9 10 10 initializeTheme() 11 11 12 - registerSW({ 12 + const updateServiceWorker = registerSW({ 13 13 immediate: true, 14 + onNeedRefresh: () => { 15 + updateServiceWorker(true) 16 + }, 14 17 onRegisterError: (error) => { 15 18 if (import.meta.env.DEV) { 16 19 console.error('Service worker registration failed', error)