source: Klonkt/src/server.js@ 3d37c67

main
Last change on this file since 3d37c67 was 9327a85, checked in by Robin Genis <roboburr@…>, 2 months ago

fix(ios-pwa): drop the top safe-area inset in landscape (island is on the side)

Portrait path is unchanged (standalone?59:47). In landscape the notch/island moves to
the side so the top inset is ~0 — key off orientation and use 0 there, leaving only the
masthead's base padding. SW cache -> v15.

  • Property mode set to 100644
File size: 20.6 KB
RevLine 
[7bc636b]1/**
[83faa57]2 * Klonkt Beta — server bootstrap
[7bc636b]3 *
[834bcc3]4 * Personal multi-site platform — Node + SQLite + htmx.
[7bc636b]5 * Stack: Express + better-sqlite3 + EJS + htmx + ws.
6 */
7
8import 'dotenv/config';
9import express from 'express';
10import helmet from 'helmet';
11import session from 'express-session';
12import bodyParser from 'body-parser';
13import path from 'path';
14import fs from 'fs';
[09ee2bd]15import crypto from 'crypto';
[7bc636b]16import { fileURLToPath } from 'url';
17import http from 'http';
18import db, { initializeDatabase } from './config/database.js';
[b9dc94c]19import { startScheduler } from './services/Scheduler.js';
[7bc636b]20import { SqliteSessionStore } from './services/SqliteSessionStore.js';
[bdc3c1e]21import { ensurePrimarySite } from './services/ensurePrimarySite.js';
[7bc636b]22import { resolveSite, loadAudioTracks, loadTheme } from './middleware/site.js';
[8afbdd6]23import { isViewer } from './middleware/auth.js';
24import { renderPage } from './middleware/render.js';
[cb01666]25import { audioEnabled } from './config/features.js';
[7bc636b]26import authRoutes from './routes/auth.js';
27import accountRoutes from './routes/account.js';
28import adminRoutes from './routes/admin.js';
29import adminAudioRoutes from './routes/admin-audio.js';
30import adminPlaylistsRoutes from './routes/admin-playlists.js';
31import adminSitesRoutes from './routes/admin-sites.js';
32import adminUsersRoutes from './routes/admin-users.js';
[6351545]33import adminSettingsRoutes from './routes/admin-settings.js';
[6623453]34import adminSeoRoutes from './routes/admin-seo.js';
[7bc636b]35import audioRoutes from './routes/audio.js';
36import searchRoutes from './routes/search.js';
37import tagsRoutes from './routes/tags.js';
38import typesRoutes from './routes/types.js';
39import usersRoutes from './routes/users.js';
40import feedRoutes from './routes/feed.js';
41import postsRoutes from './routes/posts.js';
[03fa548]42import langRoutes from './routes/lang.js';
[ff08153]43import adminUpdatesRoutes from './routes/admin-updates.js';
[1b4d5dd]44import adminPatreonRoutes from './routes/admin-patreon.js';
[d549549]45import adminStatsRoutes from './routes/admin-stats.js';
[0091cb7]46import circleRoutes from './routes/circle.js';
[255e3d3]47import epkRoutes from './routes/epk.js';
[2e247e4]48import newsletterRoutes from './routes/newsletter.js';
49import adminNewsletterRoutes from './routes/admin-newsletter.js';
[91094a4]50import downloadRoutes from './routes/download.js';
[37edecd]51import linkbioRoutes from './routes/linkbio.js';
[6be57b4]52import embedRoutes from './routes/embed.js';
[8d32dcf]53import showsRoutes from './routes/shows.js';
54import adminShowsRoutes from './routes/admin-shows.js';
[9d9f3c1]55import adminEpkRoutes from './routes/admin-epk.js';
[90259da]56import changelogRoutes from './routes/changelog.js';
[69815b2]57import ogRoutes from './routes/og.js';
[6bd25d1]58import apRoutes from './routes/activitypub.js';
[4c47eff]59import { apWants, startDeliveryWorker, selfHealTimeline } from './services/ActivityPubService.js';
[7bc636b]60
[09ee2bd]61// SESSION_SECRET: use the env var if set. Otherwise auto-generate a strong one
62// and persist it next to the database, so it stays stable across restarts and
63// updates. This lets Docker / bare-Node installs run with zero manual config.
[7bc636b]64if (!process.env.SESSION_SECRET) {
[09ee2bd]65 const dataDir = path.dirname(process.env.DATABASE_PATH || './storage/database.sqlite');
66 const secretFile = path.join(dataDir, '.session-secret');
67 try { process.env.SESSION_SECRET = fs.readFileSync(secretFile, 'utf8').trim(); } catch { /* not yet generated */ }
68 if (!process.env.SESSION_SECRET) {
69 fs.mkdirSync(dataDir, { recursive: true });
70 process.env.SESSION_SECRET = crypto.randomBytes(32).toString('hex');
71 fs.writeFileSync(secretFile, process.env.SESSION_SECRET, { mode: 0o600 });
72 console.log(`🔑 Generated a SESSION_SECRET (stored in ${secretFile})`);
73 }
[7bc636b]74}
75
[09ee2bd]76// A SESSION_SECRET that was explicitly set in the env must still be strong in prod.
[7bc636b]77if (process.env.NODE_ENV === 'production' && process.env.SESSION_SECRET.length < 32) {
[09ee2bd]78 console.error('❌ FATAL: SESSION_SECRET is too weak for production (set a longer, random one in .env)');
[7bc636b]79 process.exit(1);
80}
81
82const __dirname = path.dirname(fileURLToPath(import.meta.url));
83const PORT = process.env.PORT || 3000;
[f99bbe8]84// Interface to bind. Default 0.0.0.0 (needed for Docker port-forwarding). Behind a
85// reverse proxy on the same host, set HOST=127.0.0.1 so the app is NOT reachable
86// directly from the internet (only via the proxy) — see README/install docs.
87const HOST = process.env.HOST || '0.0.0.0';
[7bc636b]88const isDev = process.env.NODE_ENV !== 'production';
89
90const app = express();
91const server = http.createServer(app);
92
93app.use(helmet({
94 contentSecurityPolicy: {
95 directives: {
96 defaultSrc: ["'self'"],
[4c9f29a]97 scriptSrc: [
98 "'self'",
99 "'unsafe-inline'",
[834bcc3]100 // Our custom embeds (embed-player.js) load the OFFICIAL player APIs
101 // from these hosts. Without this whitelist the CSP silently blocks them
102 // (only a console error) and the embed player fails.
[4c9f29a]103 "https://www.youtube.com", // YouTube IFrame Player API (+ www-widgetapi.js)
[834bcc3]104 "https://s.ytimg.com", // YouTube player assets
[4c9f29a]105 "https://w.soundcloud.com", // SoundCloud Widget API (api.js)
[16b0c00]106 "https://open.spotify.com", // Spotify iFrame API (loader)
[834bcc3]107 "https://*.spotifycdn.com", // Spotify iFrame API (real bundle: embed-cdn.spotifycdn.com)
[4c9f29a]108 ],
[834bcc3]109 // Helmet's default sets script-src-attr to 'none', which blocks ALL inline
110 // event handlers (onchange/onclick/onsubmit) — causing e.g. the avatar
111 // upload (<input onchange="this.form.submit()">) and the role dropdown to
112 // silently do nothing. We explicitly allow inline handlers, consistent with
113 // the already-allowed inline <script> above.
[c869272]114 scriptSrcAttr: ["'unsafe-inline'"],
[7bc636b]115 styleSrc: ["'self'", "'unsafe-inline'"],
[834bcc3]116 // blob: required for the image editor (Cropper) — it displays the chosen
117 // photo via URL.createObjectURL(blob:…). Without blob: the CSP silently
118 // blocks the <img> → empty edit window. (media-src already has blob: for audio.)
[9effb80]119 imgSrc: ["'self'", "data:", "https:", "blob:"],
[16b0c00]120 connectSrc: ["'self'", "wss:", "ws:", "https://*.spotifycdn.com", "https://*.scdn.co"],
[353c39c]121 // blob: is required for the audio player — it fetch()es track bytes and
122 // plays from a blob: object URL (Spotify-style). Without blob: here the
123 // CSP silently blocks <audio>.src = blob:… → the player fires 'error' and
124 // auto-skips every track. 'self'/https: do NOT imply blob:.
125 mediaSrc: ["'self'", "https:", "blob:"],
[7bc636b]126 fontSrc: ["'self'"],
127 frameSrc: [
128 "'self'",
129 "https://open.spotify.com",
130 "https://w.soundcloud.com",
131 "https://bandcamp.com",
132 "https://embed.music.apple.com",
133 "https://www.youtube-nocookie.com",
[834bcc3]134 "https://www.youtube.com", // YouTube IFrame API sometimes creates a www.youtube.com iframe
[7bc636b]135 "https://player.vimeo.com",
136 ],
137 },
138 },
139 hsts: { maxAge: 31536000, includeSubDomains: true, preload: true },
140 frameguard: { action: 'sameorigin' },
141 referrerPolicy: { policy: 'no-referrer-when-downgrade' },
142}));
143
144app.set('view engine', 'ejs');
145app.set('views', path.join(__dirname, 'views'));
146
147app.use(bodyParser.urlencoded({ extended: true, limit: '10mb' }));
148app.use(bodyParser.json({ limit: '10mb' }));
149
150// Trust one upstream proxy in production. NPM (or Caddy / nginx) terminates
151// HTTPS and forwards to us over plain HTTP, setting X-Forwarded-Proto: https.
152// Without this, Express sees req.protocol === 'http' and won't issue secure
153// cookies — sessions never persist past the redirect after login.
154if (!isDev) app.set('trust proxy', 1);
155
[834bcc3]156// Create/migrate the schema BEFORE anything touches the DB: the session store
157// queries the `sessions` table on construction, so on a fresh install the tables
158// must exist first (otherwise: "no such table: sessions" → crash loop on first boot).
[5f43245]159initializeDatabase();
[834bcc3]160startScheduler(); // release planning: publish scheduled posts when publish_at is reached
[5a6a457]161startDeliveryWorker(); // retry failed fediverse deliveries with backoff
[b79466e]162selfHealTimeline(); // once per SELFHEAL_VERSION bump: re-sync the fediverse cache (covers/edits) after a drastic update
[5f43245]163
[834bcc3]164// Safety net: guarantee that there is always a primary site (solo/hub/circle).
165// Idempotent — does nothing if a site already exists or there is no admin yet.
[bdc3c1e]166ensurePrimarySite();
167
[7bc636b]168// Session middleware extracted into a variable so the WebSocket upgrade
169// handler can reuse it (it needs req.session to authenticate sockets).
170const sessionMiddleware = session({
171 store: new SqliteSessionStore(),
172 secret: process.env.SESSION_SECRET,
173 resave: false,
174 saveUninitialized: false,
175 name: 'pcms.sid',
176 cookie: {
177 httpOnly: true,
178 secure: !isDev,
179 sameSite: 'lax',
180 maxAge: 30 * 24 * 60 * 60 * 1000,
181 },
182});
183app.use(sessionMiddleware);
184
185app.use('/assets', express.static(path.join(__dirname, 'assets'), { maxAge: isDev ? 0 : '1y' }));
[fb02cc0]186app.use('/media', express.static(process.env.MEDIA_PATH || './storage/media', {
[834bcc3]187 // Public media (post covers, avatars) must be cross-origin embeddable by other
188 // Klonkt sites in their CIRCLE. Helmet sets CORP=same-origin by default, which
189 // causes the browser to block those images (the file arrives, but the browser
190 // refuses to render it). Set cross-origin explicitly for /media.
[fb02cc0]191 setHeaders: (res) => res.setHeader('Cross-Origin-Resource-Policy', 'cross-origin'),
192}));
[7bc636b]193
[834bcc3]194// (Removed) TWA / digital-asset-links — only needed for the APK/TWA variant.
195// Klonkt is PWA-only; assetlinks.json is no longer served.
[7bc636b]196
197// Bundle HTMX: copy from node_modules into our own assets dir so we can serve
198// it locally (no third-party CDN). Idempotent — only copies if size differs.
199(function ensureLocalHtmx() {
200 const src = path.join(__dirname, '..', 'node_modules', 'htmx.org', 'dist', 'htmx.min.js');
201 const dest = path.join(__dirname, 'assets', 'js', 'htmx.min.js');
202 try {
203 const srcStat = fs.statSync(src);
204 const destStat = fs.existsSync(dest) ? fs.statSync(dest) : null;
205 if (!destStat || destStat.size !== srcStat.size) {
206 fs.copyFileSync(src, dest);
207 console.log(`📦 HTMX bundled locally: ${srcStat.size} bytes`);
208 }
209 } catch (e) {
210 console.warn('⚠️ Could not bundle HTMX:', e.message, '— run `npm install`');
211 }
212})();
213
[6bd25d1]214// ActivityPub: WebFinger + /ap/* (site-agnostic, resolves the site by slug).
215app.use(apRoutes);
216
[69815b2]217// Themed OG cards (/og/:slug.png) — resolve the site by slug themselves, so they
218// run before resolveSite and need no site context.
219app.use('/og', ogRoutes);
220
[7bc636b]221app.use(resolveSite);
222app.use(loadAudioTracks);
223app.use(loadTheme);
224
[dd1028a]225// ActivityPub content negotiation on the human URLs: an AP request (Accept:
226// application/activity+json) to a profile/post URL is redirected to its /ap/*
227// representation — same URL serves HTML to browsers, AP-JSON to servers (this is
228// how Mastodon resolves a pasted profile/post URL). Gated on apWants() so normal
229// browser requests pay nothing.
230app.use((req, res, next) => {
231 if (req.method !== 'GET' || !apWants(req)) return next();
232 const site = res.locals.site;
233 if (!site || !site.slug) return next();
234 const seg = req.path.replace(/^\/+|\/+$/g, '');
235 if (seg === '') return res.redirect(302, `/ap/users/${encodeURIComponent(site.slug)}`);
236 if (!seg.includes('/')) {
237 try {
238 const post = db.prepare(
239 "SELECT id FROM posts WHERE site_id = ? AND slug = ? AND status = 'published' AND (fan_only IS NULL OR fan_only = 0)"
240 ).get(site.id, seg);
241 if (post) return res.redirect(302, `/ap/notes/${post.id}`);
242 } catch { /* fall through to normal HTML handling */ }
243 }
244 return next();
245});
246
[834bcc3]247// Lightweight CSRF defense: reject cross-origin state-mutating requests.
248// Same-origin forms + HTMX send a matching Origin; missing Origin is allowed
249// through (non-browser clients). sameSite:'lax' on the session cookie is the
250// second layer. (Does not apply to GET/HEAD/OPTIONS.)
[9e27d64]251app.use((req, res, next) => {
252 if (req.method === 'GET' || req.method === 'HEAD' || req.method === 'OPTIONS') return next();
253 const origin = req.get('origin');
[834bcc3]254 if (!origin) return next(); // no Origin → no browser CSRF vector
[9e27d64]255 let originHost;
256 try { originHost = new URL(origin).host; } catch { return res.status(403).send('Ongeldige origin'); }
257 if (originHost !== req.get('host')) return res.status(403).send('Cross-origin request geweigerd');
258 next();
259});
260
[834bcc3]261// Viewer accounts: may view everything (including Admin), change nothing. This is
262// the ONLY write gate — fail-closed, before all route handlers. Every state-mutating
263// method is rejected (the login POST sets the session after this guard, so it is
264// not affected). Instead of raw 403 text we render a clean page (or, for HTMX,
265// a swapped-in message).
[640b39c]266app.use((req, res, next) => {
[8afbdd6]267 const mutating = req.method !== 'GET' && req.method !== 'HEAD' && req.method !== 'OPTIONS';
268 if (mutating && isViewer(req.session?.user)) {
269 if (req.headers['hx-request'] === 'true') {
[834bcc3]270 // htmx doesn't swap on 4xx; send 200 + retarget so the message appears in #pcms-main.
[8afbdd6]271 res.setHeader('HX-Retarget', '#pcms-main');
272 res.setHeader('HX-Reswap', 'innerHTML');
273 res.status(200);
274 } else {
275 res.status(403);
276 }
277 return renderPage(req, res, 'pages/viewer-blocked', {
278 pageTitle: 'Kijker-modus',
279 bodyClass: 'on-special',
280 });
[640b39c]281 }
282 next();
283});
284
[7bc636b]285app.use('/auth', authRoutes);
286app.use('/account', accountRoutes);
[79d1281]287// NB: /notifications is the fediverse notifications page (in postsRoutes). The old
288// user-notifications route was removed — it collided with the fedi route after the
289// /meldingen -> /notifications rename, and the user-notifications system is dead.
[cb01666]290if (audioEnabled()) {
291 app.use('/admin/audio', adminAudioRoutes);
292 app.use('/admin/playlists', adminPlaylistsRoutes);
293}
[7bc636b]294app.use('/admin/sites', adminSitesRoutes);
295app.use('/admin/users', adminUsersRoutes);
[6351545]296app.use('/admin/settings', adminSettingsRoutes);
[6623453]297app.use('/admin/seo', adminSeoRoutes);
[ff08153]298app.use('/admin/updates', adminUpdatesRoutes);
[1b4d5dd]299app.use('/admin/patreon', adminPatreonRoutes);
[d549549]300app.use('/admin/stats', adminStatsRoutes);
[2e247e4]301app.use('/admin/newsletter', adminNewsletterRoutes);
[8d32dcf]302app.use('/admin/shows', adminShowsRoutes);
[9d9f3c1]303app.use('/admin/epk', adminEpkRoutes);
[7bc636b]304app.use('/admin', adminRoutes);
[cb01666]305if (audioEnabled()) app.use('/audio', audioRoutes);
[7bc636b]306app.use('/search', searchRoutes);
307app.use('/tag', tagsRoutes);
308app.use('/type', typesRoutes);
309app.use('/users', usersRoutes);
310// Feed/sitemap routes are mounted at root because they're at well-known paths
311app.use('/', feedRoutes);
[48ca5fc]312app.use('/', circleRoutes); // /cirkel-feed (solo: next() -> postsRoutes)
[255e3d3]313app.use('/', epkRoutes); // /pers perskit (premium; niet-premium: next() -> 404)
[2e247e4]314app.use('/', newsletterRoutes); // /nieuwsbrief in/uitschrijven (premium; niet-premium: next())
[cb01666]315if (audioEnabled()) app.use('/', downloadRoutes); // /downloads + /download/:id (audio; lite: uit)
[37edecd]316app.use('/', linkbioRoutes); // /links link-in-bio + klikstats (premium)
[cb01666]317if (audioEnabled()) app.use('/', embedRoutes); // /embed inbedbare audiospeler (audio; lite: uit)
[8d32dcf]318app.use('/', showsRoutes); // /shows agenda + notify-me (premium)
[90259da]319app.use('/', changelogRoutes); // /changelog publieke release-/wijzigingen-pagina
[03fa548]320app.use('/', langRoutes); // /lang/:code — interface-taal kiezen (vóór de catch-all)
[7bc636b]321app.use('/', postsRoutes);
322
323app.get('/manifest.webmanifest', (req, res) => {
324 const site = res.locals.site;
325
326 // PWA scope: confines installed apps to ONE site. If a user is in the
327 // bedrijf1 PWA and clicks a link to /sites/bedrijf2/..., the browser will
328 // open it in a regular tab (out-of-scope) instead of within the PWA.
329 // Same applies to APK packaging — the WebView is locked to this scope.
330 //
331 // For path-mounted sites: scope = /sites/<slug>/
332 // For root/subdomain sites: scope = /
333 const base = res.locals.siteUrlBase || ''; // '' or '/sites/<slug>'
334 const scope = (base || '') + '/';
335 const startUrl = (base || '') + '/?source=pwa';
336
[7007d4c]337 // A stable identity per site so installs don't collide (Chromium uses `id`).
[834bcc3]338 // NB: changing the id orphans existing PWA installs (no migration carries an
339 // install across an id change) — anyone who already installed the site as a
340 // PWA will need to reinstall once. Data stays server-side, so nothing is lost.
[7007d4c]341 const idBase = site?.slug ? `klonkt-${site.slug}` : 'klonkt';
[7bc636b]342
343 res.set('Cache-Control', 'no-cache');
344 res.json({
345 id: idBase,
[7007d4c]346 name: site?.title || 'Klonkt',
[8afbdd6]347 short_name: (site?.title || 'Klonkt').slice(0, 12),
[7bc636b]348 description: site?.description || site?.tagline || '',
349 scope,
350 start_url: startUrl,
351 display: 'standalone',
352 display_override: ['standalone', 'minimal-ui'],
353 orientation: 'any',
354 background_color: '#1a1a17',
[dd7e2a2]355 theme_color: site?.accent || '#e8b04b',
[7bc636b]356 lang: site?.language || 'nl',
357 icons: [
358 { src: '/favicon.svg', sizes: 'any', type: 'image/svg+xml' },
359 { src: '/favicon.ico', sizes: '64x64', type: 'image/x-icon' },
360 ],
361 // Hint to capable browsers: capture all in-scope links inside the PWA
362 capture_links: 'existing-client-navigate',
363 });
364});
365
366// Favicon — served as SVG so it picks up the site's accent color dynamically.
367// Browsers also request /favicon.ico by convention; we serve the same SVG
368// content there with a forgiving content-type since modern browsers accept it.
369function _renderFavicon(res, accent) {
[9b851e7]370 const safeAccent = /^#[0-9a-fA-F]{3,8}$/.test(accent) ? accent : '#e8b04b';
[5e95aac]371 // Site mark: rounded square in the site accent + bold white 'K' (Klonkt)
[7bc636b]372 const svg = `<?xml version="1.0" encoding="UTF-8"?>
373<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
374 <rect width="64" height="64" rx="14" fill="${safeAccent}"/>
[5e95aac]375 <text x="50%" y="50%" dy="0.35em" text-anchor="middle"
[b5bae24]376 font-family="Arial, Helvetica, sans-serif"
[5e95aac]377 font-size="42" font-weight="800" fill="#fff">K</text>
[7bc636b]378</svg>`;
379 res.set('Content-Type', 'image/svg+xml');
380 res.set('Cache-Control', 'public, max-age=86400');
381 res.send(svg);
382}
383
384app.get('/favicon.svg', (req, res) => {
385 _renderFavicon(res, res.locals.site?.accent);
386});
387app.get('/favicon.ico', (req, res) => {
388 // Browsers requesting .ico will accept SVG content; chrome/firefox both fine.
389 // Keeping the route prevents 404 spam in the console.
390 _renderFavicon(res, res.locals.site?.accent);
391});
392
393app.get('/sw.js', (req, res) => {
394 res.set('Content-Type', 'application/javascript');
395 res.set('Cache-Control', 'no-cache');
396 res.send(`
[9327a85]397const CACHE_VERSION = 'pcms-v15-' + new Date().toISOString().split('T')[0];
[7bc636b]398self.addEventListener('install', e => {
399 e.waitUntil(caches.open(CACHE_VERSION).then(c => c.addAll(['/'])));
400 self.skipWaiting();
401});
402self.addEventListener('activate', e => {
403 e.waitUntil(caches.keys().then(keys => Promise.all(
404 keys.filter(k => k !== CACHE_VERSION).map(k => caches.delete(k))
405 )));
406 self.clients.claim();
407});
[834bcc3]408// ONLY intercept navigations (HTML pages) for an offline fallback.
409// Do NOT touch images, CSS, JS or /media — let the browser handle those natively.
410// Otherwise a failed network fetch could fall back to an empty cache match
411// (undefined) and "break" an image on a normal refresh (hard reload bypasses
412// the SW, which is why that case worked fine).
[7bc636b]413self.addEventListener('fetch', e => {
414 if (e.request.method !== 'GET') return;
[834bcc3]415 if (e.request.mode !== 'navigate') return; // page loads only
[b08b5bc]416 e.respondWith(
417 fetch(e.request).catch(() => caches.match('/').then(r => r || Response.error()))
418 );
[7bc636b]419});
420 `);
421});
422
423process.on('unhandledRejection', (reason) => {
424 console.error('⚠️ Unhandled Rejection:', reason);
425});
426
427app.use((err, req, res, next) => {
428 console.error('❌ Error:', err);
429 res.status(err.status || 500).send(
430 isDev ? `<pre>${err.stack || err.message}</pre>` : 'Internal Server Error'
431 );
432});
433
434app.use((req, res) => {
[3b6e04a]435 res.status(404);
[834bcc3]436 // Clean, mobile-friendly 404 via the shell (viewport + nav + site theme).
437 // Falls back to bare HTML if rendering unexpectedly fails.
[3b6e04a]438 try {
439 return renderPage(req, res, 'pages/404', {
440 pageTitle: '404 — niet gevonden',
441 bodyClass: 'on-special on-404',
442 });
443 } catch (e) {
444 return res.send('<!doctype html><meta name="viewport" content="width=device-width,initial-scale=1"><div style="font-family:system-ui;max-width:500px;margin:4rem auto;text-align:center;padding:2rem"><h1 style="font-size:4rem;margin:0">404</h1><p>Pagina niet gevonden</p><a href="/">← Home</a></div>');
445 }
[7bc636b]446});
447
[f99bbe8]448server.listen(PORT, HOST, () => {
[7bc636b]449 console.log('');
[83faa57]450 console.log('🪶 Klonkt Beta');
[7bc636b]451 console.log(` http://localhost:${PORT}`);
452 console.log('');
453 console.log(` ✓ Security: Helmet, CSP, secure sessions`);
454 console.log(` ✓ Privacy: Self-hosted fonts, no third-party requests`);
455 console.log(` ✓ Layout: v9 editorial feel (top nav, profile header)`);
[9e27d64]456 console.log(` ✓ Auth: wachtwoord (beheer) + Google (luisteraars) / logout`);
[7bc636b]457 console.log(` ✓ Posts: create / edit / view / archive`);
458 console.log('');
459 console.log(` Mode: ${isDev ? 'development' : 'PRODUCTION'}`);
460 console.log('');
461});
462
463export default app;
Note: See TracBrowser for help on using the repository browser.