Analyse: geprüfte Rechtstexte Fassung 2026-10-02 veröffentlichen (HTML, PDF, Zusatzseiten-Vorlage, Archiv)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f401dc14d7
commit
ddb91a9950
16 files changed
+827
-138
No files matched your search
@@ -36,6 +36,7 @@ import adminPreviewOpenRoutes from './routes/admin/previewOpen.js'
|
||||
import newsRoutes from './routes/news.js'
|
||||
import publicNewsRoutes from './routes/publicNews.js'
|
||||
import adminAnalyseRoutes from './routes/admin/analyse.js'
|
||||
import { analyseLegalRouter } from './services/analyseLegal.js'
|
||||
import adminSwitchLinkRoutes from './routes/admin/switchLink.js'
|
||||
import adminFinanzenRoutes from './routes/admin/finanzen.js'
|
||||
|
||||
@@ -110,6 +111,8 @@ app.use('/embed/', (_req, res, next) => {
|
||||
res.set('Access-Control-Allow-Origin', '*')
|
||||
next()
|
||||
})
|
||||
// Adressen ohne Fassung: aktuelle geprüfte Fassung der Analyse-Rechtstexte (vor express.static)
|
||||
app.use('/rechtliches', analyseLegalRouter())
|
||||
app.use(express.static(publicDir))
|
||||
|
||||
app.get('/dashboard.html', (req, res, next) => {
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
// Veroeffentlichte Rechtstexte der Website-Analyse (je Fassung feste Dateien unter public/rechtliches/)
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { join } from 'node:path'
|
||||
import { Router } from 'express'
|
||||
import { config } from '../config.js'
|
||||
|
||||
const publicDir = fileURLToPath(new URL('../../public/', import.meta.url))
|
||||
const VERSION_RE = /^\d{4}-\d{2}-\d{2}$/
|
||||
|
||||
function checkVersion(version) {
|
||||
if (!VERSION_RE.test(String(version))) throw new Error('Analyse: ungültige Fassung')
|
||||
return String(version)
|
||||
}
|
||||
|
||||
export function legalPaths(version) {
|
||||
const v = checkVersion(version)
|
||||
return {
|
||||
avv: `/rechtliches/avv-website-analyse-${v}.html`,
|
||||
lb: `/rechtliches/leistungsbeschreibung-website-analyse-${v}.html`,
|
||||
}
|
||||
}
|
||||
|
||||
export function legalPdfFiles(version) {
|
||||
const v = checkVersion(version)
|
||||
return {
|
||||
avv: { filename: `AVV-Website-Analyse-${v}.pdf`, path: join(publicDir, 'rechtliches', `avv-website-analyse-${v}.pdf`) },
|
||||
lb: { filename: `Leistungsbeschreibung-Website-Analyse-${v}.pdf`, path: join(publicDir, 'rechtliches', `leistungsbeschreibung-website-analyse-${v}.pdf`) },
|
||||
}
|
||||
}
|
||||
|
||||
/** Beide PDFs als Mail-Anhaenge; wirft, wenn eine Datei fehlt oder nicht lesbar ist. */
|
||||
export async function legalPdfAttachments(version) {
|
||||
const files = legalPdfFiles(version)
|
||||
return Promise.all(
|
||||
[files.avv, files.lb].map(async (f) => ({
|
||||
filename: f.filename,
|
||||
content: await readFile(f.path),
|
||||
contentType: 'application/pdf',
|
||||
}))
|
||||
)
|
||||
}
|
||||
|
||||
/** Adressen ohne Fassung liefern immer die aktuelle geprüfte Fassung (config.analyse.avvVersion). */
|
||||
export function analyseLegalRouter() {
|
||||
const router = Router()
|
||||
const send = (key) => (_req, res, next) => {
|
||||
const file = join(publicDir, legalPaths(config.analyse.avvVersion)[key])
|
||||
res.sendFile(file, (err) => err && next(err.code === 'ENOENT' ? undefined : err))
|
||||
}
|
||||
router.get('/avv-website-analyse.html', send('avv'))
|
||||
router.get('/leistungsbeschreibung-website-analyse.html', send('lb'))
|
||||
return router
|
||||
}
|
||||
Reference in new issue
Block a user