source: Klonkt/src/server.js@ 69815b2

main
Last change on this file since 69815b2 was 69815b2, checked in by Robin Genis <roboburr@…>, 3 months ago

feat: auto-generated per-site OG image from palette + accent

New OgImageService renders a themed 1200x630 social card (palette gradient +
accent + site title/tagline + klonkt wordmark) via @resvg/resvg-js, cached on
disk. Served at GET /og/:slug.png and used as the default og:image/twitter:image
when a site has no custom share image — so every site gets a branded preview.
Bundles a static Fraunces TTF for rendering; graceful no-op if resvg can't load.

Co-Authored-By: Claude <noreply@…>

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