Add Logbuch: project update blog with admin, media and API

Public archive with sidebar navigation, project pages, month archive,
search and entry pages with image blocks. Admin area for brands,
projects, post types, users, api clients, media and the entry editor
with drag and drop images, preview per audience, scheduling and
publish checks. Read and write API with bearer tokens, audience
scoping, idempotent creation, OpenAPI document and editorial guide.
Magic link login with configurable allowed domains, whole app behind
the session gate. 456 tests including design rule checks.
This commit is contained in:
Matthias Giesselmann
2026-07-31 21:33:42 +02:00
commit b90ff252d1
291 changed files with 43671 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
import { describe, expect, it } from 'vitest'
import { emailDomain, isAllowedDomain, normaliseEmail, parseDomains } from '~/domain/email-domains'
const domains = parseDomains('nyo.de, pocketrocket.de,pocket-rocket.io')
describe('parseDomains', () => {
it('trennt an Kommas, schneidet Leerraum und macht klein', () => {
expect(parseDomains(' NYO.de , Pocket-Rocket.io ')).toEqual(['nyo.de', 'pocket-rocket.io'])
})
it('entfernt ein führendes At-Zeichen', () => {
expect(parseDomains('@nyo.de')).toEqual(['nyo.de'])
})
it('liefert für leere Angaben eine leere Liste', () => {
expect(parseDomains(undefined)).toEqual([])
expect(parseDomains(' , ')).toEqual([])
})
})
describe('emailDomain', () => {
it('liest die Domain hinter dem letzten At-Zeichen', () => {
expect(emailDomain('Vorname.Nachname@NYO.de')).toBe('nyo.de')
})
it('liefert für eine Adresse ohne At-Zeichen nichts', () => {
expect(emailDomain('keine-adresse')).toBe('')
})
})
describe('isAllowedDomain', () => {
it('lässt die freigegebenen Domains durch', () => {
expect(isAllowedDomain('paul@nyo.de', domains)).toBe(true)
expect(isAllowedDomain('paul@pocketrocket.de', domains)).toBe(true)
expect(isAllowedDomain('paul@pocket-rocket.io', domains)).toBe(true)
})
it('lässt Unterdomains der freigegebenen Domains durch', () => {
expect(isAllowedDomain('paul@mail.nyo.de', domains)).toBe(true)
})
it('weist fremde Domains ab', () => {
expect(isAllowedDomain('paul@gmail.com', domains)).toBe(false)
expect(isAllowedDomain('paul@nyo.de.angreifer.example', domains)).toBe(false)
expect(isAllowedDomain('paul@xnyo.de', domains)).toBe(false)
})
it('weist Eingaben ohne Domain ab', () => {
expect(isAllowedDomain('paul', domains)).toBe(false)
})
it('lässt ohne konfigurierte Liste alles durch', () => {
expect(isAllowedDomain('paul@gmail.com', [])).toBe(true)
})
it('ist unabhängig von Gross- und Kleinschreibung', () => {
expect(isAllowedDomain('Paul@NYO.DE', domains)).toBe(true)
})
})
describe('normaliseEmail', () => {
it('schneidet Leerraum und macht klein', () => {
expect(normaliseEmail(' Paul@NYO.de ')).toBe('paul@nyo.de')
})
})