Comprehensive documentation of today's work including: - Matrix SSO/OIDC integration with Better Auth - 9 new Matrix bots for app integration - LLM Playground UI - Demo mode removal from all apps - Docker and build fixes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
13 KiB
Daily Report - 30. Januar 2026
Zeitraum: 10:00 - 19:00 Uhr Commits: 41 Hauptthemen: Matrix SSO/OIDC Integration, 9 neue Matrix Bots, LLM Playground, Demo Mode Removal
Zusammenfassung
Ein intensiver Tag mit Fokus auf Matrix-Integration und Bot-Infrastruktur:
- Matrix SSO/OIDC - Mana Core Auth als OIDC Provider für Matrix Synapse (mchat.mana.how)
- 9 Matrix Bots - Neue Bots für Picture, Contacts, ManaDeck, Planta, Questions, Presi, Skilltree, Chat
- LLM Playground - SvelteKit UI für lokale Ollama-Modelle
- Demo Mode entfernt - Login jetzt erforderlich für alle Apps
- Docker Fixes - shared-vite-config und shared-stores Kompatibilität
1. Matrix SSO/OIDC Integration (Hauptfeature)
Problem
Matrix Synapse auf mchat.mana.how sollte Mana Core Auth als OIDC Provider nutzen, um SSO zu ermöglichen. User sollten sich mit ihrem Mana-Account bei Matrix anmelden können.
Herausforderungen & Lösungen
1.1 CSP blockiert Inline-Scripts (10:00)
Commit: 3d4402ad - fix(mana-core-auth): allow inline scripts in CSP for OIDC login page
Problem: Die OIDC Login-Seite nutzt Inline-JavaScript, aber die Content Security Policy (CSP) blockierte dies.
Lösung: CSP um 'unsafe-inline' erweitert für die Login-Seite:
// main.ts - Helmet configuration
scriptSrc: ["'self'", "'unsafe-inline'"],
1.2 Client-Name "Unknown" auf Login-Seite (10:30)
Commit: 4a66341e - fix(mana-core-auth): extract client_id from returnUrl for OIDC login
Problem: Die Login-Seite zeigte "Unknown" statt "Matrix Chat" als Client-Name.
Lösung: client_id aus dem returnUrl-Parameter extrahieren:
// oidc-login.controller.ts
const returnUrlObj = new URL(returnUrl, 'http://localhost');
const clientIdFromUrl = returnUrlObj.searchParams.get('client_id');
const clientId = req.query.client_id || clientIdFromUrl || 'unknown';
1.3 Session Cookies fehlen nach Login (12:00)
Commits:
edbe7502- fix(mana-core-auth): use Better Auth native sign-in for OIDC loginf59b6596- fix(mana-core-auth): add dedicated Better Auth handler for sign-in
Problem: Nach dem Login wurde kein Authorization Code generiert, weil /api/v1/auth/login keine Session-Cookies setzt.
Lösung: Wechsel zu Better Auth's nativem /api/auth/sign-in/email Endpoint:
// oidc.controller.ts - Neuer Handler
@Post('api/auth/sign-in/email')
async signInEmail(@Req() req: Request, @Res() res: Response) {
return this.handleBetterAuthRequest(req, res);
}
private async handleBetterAuthRequest(req: Request, res: Response) {
const handler = this.betterAuthService.getHandler();
const response = await handler(fetchRequest);
// Copy Set-Cookie headers for session
response.headers.forEach((value, key) => {
if (key.toLowerCase() === 'set-cookie') {
res.append(key, value);
}
});
}
1.4 INVALID_REDIRECT_URI Error (14:00)
Commits:
8207d38c- fix(mana-core-auth): use comma-separated redirect_urls for Better Auth OIDCee05b6c3- fix(mana-core-auth): use correct property name 'redirectUrls' for Better Auth
Problem: Better Auth's OIDC Provider gab INVALID_REDIRECT_URI zurück, obwohl die URL korrekt in der Datenbank war.
Ursachen & Lösungen:
-
Format-Problem: Better Auth erwartet Komma-separierte Strings, nicht JSON-Arrays:
-- FALSCH (JSON Array) redirect_urls: '["https://matrix.mana.how/_synapse/client/oidc/callback"]' -- RICHTIG (Komma-separiert) redirect_urls: 'https://matrix.mana.how/_synapse/client/oidc/callback' -
Property-Name: Better Auth erwartet
redirectUrls(lowercase 'urls'), nichtredirectURLs(uppercase 'URLs'):// auth.schema.ts - VORHER redirectURLs: text('redirect_urls').notNull(), // auth.schema.ts - NACHHER redirectUrls: text('redirect_urls').notNull(),
1.5 Consent-Screen überspringen (17:00)
Commits:
bb428d4b- fix(mana-core-auth): add Matrix Synapse as trusted OIDC client01a2c78e- fix(mana-core-auth): add all required fields to trusted client configc949f5d0- fix(mana-core-auth): fix type compatibility for trusted client config744d0c9c- fix(mana-core-auth): remove non-existent id field from trusted client
Problem: Nach erfolgreichem Login wurde zum Consent-Screen weitergeleitet, der nicht implementiert war.
Lösung: Matrix Synapse als trusted client konfigurieren mit skipConsent: true:
// better-auth.config.ts
oidcProvider({
loginPage: '/login',
consentPage: '/consent',
trustedClients: [
{
clientId: 'matrix-synapse',
clientSecret: process.env.SYNAPSE_OIDC_CLIENT_SECRET || '',
name: 'Matrix Synapse',
type: 'web',
disabled: false,
metadata: {},
redirectUrls: ['https://matrix.mana.how/_synapse/client/oidc/callback'],
skipConsent: true,
},
],
}),
Ergebnis
Der OIDC-Flow funktioniert nun vollständig:
- User klickt "Sign in with Mana Core" auf mchat.mana.how
- Redirect zu auth.mana.how/login mit Client-Info
- User sieht "Signing in to Matrix Chat"
- Nach Login: Session-Cookie wird gesetzt
- Redirect zurück mit Authorization Code
- Token-Exchange für Access Token
- User ist in Matrix eingeloggt
2. Matrix Bots (9 neue Bots)
Implementierung von 9 spezialisierten Matrix-Bots für die Integration mit ManaCore Apps.
Neue Bots
| Bot | Commit | Beschreibung |
|---|---|---|
| matrix-picture-bot | 8950692c |
AI-Bildgenerierung via Flux |
| matrix-contacts-bot | 64535373 |
Kontaktverwaltung |
| matrix-manadeck-bot | ad7f875c |
Kartendecks verwalten |
| matrix-planta-bot | 3f336de1 |
Pflanzenpflege-Management |
| matrix-questions-bot | c5476447 |
Q&A Research |
| matrix-presi-bot | e3cfafe5 |
Präsentationsverwaltung |
| matrix-skilltree-bot | 3ed1453f |
Skill Tree & XP |
| matrix-chat-bot | 68219a01 |
AI Chat Conversations |
Standardisierung
Commit: df47dafe - chore(matrix-bots): standardize package.json across all 9 bots
Alle Bots nutzen nun:
- Einheitliche Dependency-Versionen
- Standard Scripts:
dev,build,start - Konsistente NestJS-Struktur
- TypeScript strict mode
TypeScript Fixes
Commit: 004fe857 - fix(matrix-bots): resolve TypeScript strict null check errors
Behebung von null-check Fehlern in allen Bot-Services.
3. LLM Playground
Neue SvelteKit UI
Commits:
f880ef2b- feat(llm-playground): add SvelteKit LLM playground UIfdba0e34- feat(llm-playground): add production deployment with auth5d5e42c7- feat(chat): add all Mac Mini Ollama models to playground
Neues Web-Interface zum Testen lokaler Ollama-Modelle:
Features:
- Model-Auswahl (alle Mac Mini Ollama-Modelle)
- Chat-Interface mit Streaming
- System Prompt Konfiguration
- Temperature/Max Tokens Settings
Verfügbare Modelle:
| Modell | Beschreibung |
|---|---|
| gemma3:4b | Everyday tasks (default) |
| qwen2.5-coder:7b | Code generation |
| llava:7b | Image analysis |
| qwen3-vl:4b | Fast vision |
| deepseek-ocr | OCR/Text recognition |
| phi3.5 | Compact, efficient |
| ministral:3b | Very fast |
URLs:
- https://llm.mana.how (Production)
- http://localhost:5191 (Development)
4. Demo Mode Removal
Entfernung aus allen Apps
Commits:
f07387d1- 🔥 remove: demo mode from todo, contacts, clock, questions, chat apps82da95b8- 🔥 remove(calendar-web): remove demo mode, enforce login
Betroffene Apps:
- Todo
- Contacts
- Clock
- Questions
- Chat
- Calendar
Änderungen:
DEMO_MODEEnvironment Variable entfernt- Login jetzt obligatorisch
- Redirect zu
/loginfür nicht-authentifizierte User - Session-Storage für Guest-Daten entfernt
5. Docker & Build Fixes
shared-vite-config Kompatibilität
Commits:
359b8706- 🔧 chore: add shared-vite-config to web Dockerfilesd09ea061- 🔧 chore: add shared-vite-config as devDependency to web apps36941552/90f9f2c9- 🔧 chore(shared-vite-config): add build step for Docker compatibilityeb475ace- 🔧 chore(calendar-web): add shared-vite-config to devDependencies
Problem: Docker Builds fehlgeschlagen wegen fehlendem shared-vite-config.
Lösung:
- Package als devDependency zu allen Web-Apps hinzugefügt
- Build-Step in shared-vite-config für TypeScript-Kompilierung
- Expliziter Build im Dockerfile vor App-Build
shared-stores und shared-api-client
Commits:
4526123b- 🔧 chore: add shared-stores and shared-api-client to web apps8779d047- 🔧 chore(calendar-web): add shared-stores to Dockerfile
Fehlende Shared Packages zu Dockerfiles hinzugefügt.
6. Calendar Web Fixes
Commits:
8da676ff- 🐛 fix(calendar-web): initialize auth store on mount017891b1- 🐛 fix(calendar-web): use client URL in browser for API callse5a5e968- 🐛 fix(calendar-web): add missing packages to Dockerfile
Fixes:
- Auth Store wird jetzt beim Mount initialisiert (nicht nur im Browser)
- API-Calls nutzen Browser-URL statt Server-URL
- Fehlende Packages im Dockerfile ergänzt
7. Sonstige Änderungen
Matrix Web SSR Fix
Commit: 3b745cf0 - fix(matrix-web): disable SSR for app routes to fix $state error
SSR deaktiviert für App-Routes wegen Svelte 5 $state Kompatibilitätsproblemen.
Mana Notify
Commit: b8ecdb8e - 🔧 chore(mana-notify): disable email notifications by default
Email-Benachrichtigungen standardmäßig deaktiviert (nur Push-Notifications aktiv).
Dependencies Update
Commit: 3edbd0cb - chore: update dependencies and mana-llm improvements
Allgemeine Dependency-Updates und mana-llm Verbesserungen.
Syntax Fix
Commit: 2daaee74 - 🐛 fix: syntax error in contacts-web +layout.svelte
Syntax-Fehler in Contacts Web Layout behoben.
Technische Details
OIDC Flow Architektur
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Matrix/Synapse │────>│ Mana Core Auth │────>│ Database │
│ mchat.mana.how │ │ auth.mana.how │ │ oauth_apps │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│ │
│ 1. SSO Click │ 2. /api/auth/oauth2/authorize
│ │
▼ ▼
┌─────────────────┐ ┌──────────────────┐
│ Login Page │────>│ Better Auth │
│ /login │ │ Session Cookie │
└─────────────────┘ └──────────────────┘
│ │
│ 3. POST sign-in │ 4. Set-Cookie
│ │
▼ ▼
┌─────────────────┐ ┌──────────────────┐
│ Redirect with │<────│ Auth Code Gen │
│ ?code=xxx │ │ (trusted client)│
└─────────────────┘ └──────────────────┘
Better Auth OIDC Provider Konfiguration
oidcProvider({
loginPage: '/login',
consentPage: '/consent',
metadata: {
issuer: process.env.BASE_URL,
},
trustedClients: [{
clientId: 'matrix-synapse',
clientSecret: process.env.SYNAPSE_OIDC_CLIENT_SECRET,
name: 'Matrix Synapse',
type: 'web',
disabled: false,
metadata: {},
redirectUrls: ['https://matrix.mana.how/_synapse/client/oidc/callback'],
skipConsent: true,
}],
}),
Datenbank-Schema Änderung
// VORHER (Breaking)
export const oauthApplications = authSchema.table('oauth_applications', {
redirectURLs: text('redirect_urls').notNull(), // Capital 'URLs'
});
// NACHHER (Working)
export const oauthApplications = authSchema.table('oauth_applications', {
redirectUrls: text('redirect_urls').notNull(), // Lowercase 'urls'
});
Statistiken
| Metrik | Wert |
|---|---|
| Commits | 41 |
| Neue Matrix Bots | 9 |
| Bearbeitete Dateien | ~100+ |
| Hauptfeature | Matrix SSO/OIDC |
| Gelöste Bugs | 12+ |
| Build Zeit | ~3 Minuten pro mana-core-auth Build |
Bekannte Issues
- Token Exchange: Das client_secret in der Datenbank muss mit dem Environment-Variable übereinstimmen
- SSH Tunnel: Cloudflare Tunnel zeitweise instabil (Websocket Handshake Fehler)
Nächste Schritte
- Token Endpoint Fix - Sicherstellen dass DB-Secret und ENV-Secret übereinstimmen
- Matrix Bot Deployment - Alle 9 Bots auf Mac Mini deployen
- LLM Playground - Production Deployment finalisieren
- Monitoring - OIDC-Metriken zu Grafana hinzufügen
- Documentation - Matrix SSO Setup Guide erstellen
Bericht erstellt am 30. Januar 2026, 19:00 Uhr