| [90259da] | 1 | /**
|
|---|
| [834bcc3] | 2 | * Public changelog / release page.
|
|---|
| [90259da] | 3 | *
|
|---|
| [834bcc3] | 4 | * GET /changelog -> renders CHANGELOG.md (the source of truth for releases).
|
|---|
| [90259da] | 5 | *
|
|---|
| [834bcc3] | 6 | * The app version (footer, package.json) is intentionally decoupled from the
|
|---|
| 7 | * circle federation proto (KLONKT_PROTO): a version bump is cosmetic and does not
|
|---|
| 8 | * affect federation. We show the proto here explicitly so that each release
|
|---|
| 9 | * makes visible which federation version this instance speaks (circles = lockstep per proto).
|
|---|
| [90259da] | 10 | */
|
|---|
| 11 |
|
|---|
| 12 | import express from 'express';
|
|---|
| 13 | import fs from 'fs';
|
|---|
| 14 | import path from 'path';
|
|---|
| 15 | import { fileURLToPath } from 'url';
|
|---|
| 16 | import { renderPage } from '../middleware/render.js';
|
|---|
| 17 | import { MarkdownService } from '../services/MarkdownService.js';
|
|---|
| 18 | import { KLONKT_PROTO } from '../services/CircleFederation.js';
|
|---|
| 19 |
|
|---|
| 20 | const router = express.Router();
|
|---|
| 21 | const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|---|
| 22 | const CHANGELOG_PATH = path.join(__dirname, '..', '..', 'CHANGELOG.md');
|
|---|
| 23 |
|
|---|
| 24 | router.get('/changelog', (req, res) => {
|
|---|
| 25 | let html;
|
|---|
| 26 | try {
|
|---|
| 27 | html = MarkdownService.render(fs.readFileSync(CHANGELOG_PATH, 'utf8'));
|
|---|
| 28 | } catch {
|
|---|
| 29 | html = '<p>Geen wijzigingenoverzicht beschikbaar.</p>';
|
|---|
| 30 | }
|
|---|
| 31 | renderPage(req, res, 'pages/changelog', {
|
|---|
| 32 | pageTitle: 'Wijzigingen',
|
|---|
| 33 | bodyClass: 'on-changelog',
|
|---|
| 34 | changelogHtml: html,
|
|---|
| 35 | proto: KLONKT_PROTO,
|
|---|
| 36 | });
|
|---|
| 37 | });
|
|---|
| 38 |
|
|---|
| 39 | export default router;
|
|---|