/** * Render helper — THE pattern for the entire app. * * Two modes: * 1. HTMX request → render just the page content (no shell) * 2. Full page request → render content, then embed in shell * * Usage: * renderPage(req, res, 'pages/home', { posts, ...data }) */ import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; import ejs from 'ejs'; import db from '../config/database.js'; import PermissionsService from '../services/PermissionsService.js'; import { isViewer } from './auth.js'; import { getSetting, apEnabled } from '../services/SettingsService.js'; import { isPremium as isPremiumInstance, premiumEnabled, premiumUnlocked } from '../services/PatreonService.js'; import ActivityPubService from '../services/ActivityPubService.js'; import { imgProxyUrl } from '../services/ThumbnailService.js'; import { audioEnabled as audioFeatureEnabled } from '../config/features.js'; // Add the per-request CSP nonce to every