Changeset 053bf51 in Klonkt
- Timestamp:
- 07/22/2026 07:12:11 AM (7 weeks ago)
- Branches:
- main
- Children:
- 8240e80
- Parents:
- ad10715
- git-author:
- Robin <roboburr@…> (07/22/2026 07:05:42 AM)
- git-committer:
- Robin <roboburr@…> (07/22/2026 07:12:11 AM)
- Location:
- src
- Files:
-
- 3 added
- 2 edited
-
routes/admin-push.js (added)
-
routes/push.js (added)
-
server.js (modified) (5 diffs)
-
views/pages/admin-push.ejs (added)
-
views/pages/admin.ejs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/server.js
rad10715 r053bf51 47 47 import adminStatsRoutes from './routes/admin-stats.js'; 48 48 import adminPaidRoutes from './routes/admin-paid.js'; 49 import adminPushRoutes from './routes/admin-push.js'; 50 import pushRoutes from './routes/push.js'; 49 51 import adminMediaRoutes from './routes/admin-media.js'; 50 52 import circleRoutes from './routes/circle.js'; … … 381 383 app.use('/admin/stats', adminStatsRoutes); 382 384 app.use('/admin/paid', adminPaidRoutes); 385 app.use('/admin/push', adminPushRoutes); 383 386 app.use('/admin/newsletter', adminNewsletterRoutes); 384 387 app.use('/admin/shows', adminShowsRoutes); … … 402 405 app.use('/', langRoutes); // /lang/:code — interface-taal kiezen (vóór de catch-all) 403 406 app.use('/paid', paidRoutes); // paid-posts patron/passkey flow (before the /:slug catch-all) 407 app.use('/push', pushRoutes); // web-push subscribe/test (before the /:slug catch-all) 404 408 app.use('/', postsRoutes); 405 409 … … 478 482 res.set('Cache-Control', 'no-cache'); 479 483 res.send(` 480 const CACHE_VERSION = 'pcms-v1 8-' + new Date().toISOString().split('T')[0];484 const CACHE_VERSION = 'pcms-v19-' + new Date().toISOString().split('T')[0]; 481 485 self.addEventListener('install', e => { 482 486 e.waitUntil(caches.open(CACHE_VERSION).then(c => c.addAll(['/']))); … … 522 526 ); 523 527 }); 528 // Web push (docs/webpush-design.md): payload is JSON {type,title,body,url}, 529 // encrypted end-to-end to this browser (RFC 8291). Show it; click opens url. 530 self.addEventListener('push', e => { 531 let d = {}; 532 try { d = e.data ? e.data.json() : {}; } catch (err) { /* non-JSON push */ } 533 const title = d.title || 'Klonkt'; 534 e.waitUntil(self.registration.showNotification(title, { 535 body: d.body || '', 536 icon: '/favicon.svg', 537 badge: '/favicon.svg', 538 tag: d.type ? ('klonkt-' + d.type) : undefined, // collapse same-type bursts 539 data: { url: d.url || '/' }, 540 })); 541 }); 542 self.addEventListener('notificationclick', e => { 543 e.notification.close(); 544 const url = (e.notification.data && e.notification.data.url) || '/'; 545 e.waitUntil(clients.matchAll({ type: 'window', includeUncontrolled: true }).then(list => { 546 for (const c of list) { 547 if (new URL(c.url).origin === self.location.origin && 'focus' in c) { c.navigate(url); return c.focus(); } 548 } 549 return clients.openWindow(url); 550 })); 551 }); 524 552 `); 525 553 }); -
src/views/pages/admin.ejs
rad10715 r053bf51 55 55 <%# Fediverse pages (News / Notifications / My replies / Blocking) are reached via the 56 56 "Fediverse" nav button + the bell + the tabbed section — not duplicated here. %> 57 <a href="/admin/push" class="btn">Notificaties</a> 57 58 <a href="/admin/updates" class="btn"><%= t('admin.b_updates') %></a> 58 59 <a href="/admin/handleiding" class="btn"><%= t('admin.b_help') %></a>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)