Commit graph

696 commits

Author SHA1 Message Date
Till-JS
d7236d61fa debug: add detailed logging for gift redemption 2026-02-14 14:28:37 +01:00
Till-JS
79f1155dfd feat(nutriphi-bot): auto-analyze text meal descriptions
- Add looksLikeMealDescription() heuristic to detect meal descriptions
- Add autoAnalyzeText() to handle automatic text analysis
- Text messages with food keywords or numbers are now auto-analyzed
- Skip greetings and questions to avoid false positives
2026-02-14 14:18:10 +01:00
Till-JS
97264cd849 🔧 chore(clock-bot): add detailed topic update logging 2026-02-14 14:03:04 +01:00
Till-JS
ab677b28c8 🐛 fix(gifts): explicitly set nullable fields to null in DB inserts
Drizzle ORM requires explicit null values for optional fields instead of
leaving them undefined. Added explicit null for organizationId,
idempotencyKey, portionNumber, and creditTransactionId.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 14:02:46 +01:00
Till-JS
102f0df518 🔧 chore(clock-bot): improve room topic error logging 2026-02-14 13:52:20 +01:00
Till-JS
72b162524c 🐛 fix(gifts): convert undefined sourceAppId to null for Drizzle
Drizzle ORM throws "UNDEFINED_VALUE" error when inserting undefined values.
Convert dto.sourceAppId to null using nullish coalescing operator.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 13:50:01 +01:00
Till-JS
ba818ef256 fix(clock-bot): improve room topic error logging
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 13:47:15 +01:00
Till-JS
992181cc87 feat(clock-bot): add timer status to room topic (Phase 3)
- Store original room topic when timer starts
- Update room topic with timer progress every 10 seconds
- Show status icon, remaining time, percentage, and label
- Restore original topic when timer finishes or is deleted

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 13:36:08 +01:00
Till-JS
5025bfa883 fix(clock-bot): optimize widget styling for Element info panel
- Use transparent background to adapt to Element theme
- Remove min-height and centering (content starts at top)
- Reduce font sizes and spacing for compact display
- Use semi-transparent backgrounds for theme compatibility
- Add flex-wrap for narrow panels

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 12:46:19 +01:00
Till-JS
0a41640c19 chore(onboarding-bot): add bot user creation script
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 12:43:29 +01:00
Till-JS
a6fc1cb66e feat(onboarding): add Matrix onboarding bot for profile setup
- Add matrix-onboarding-bot service that guides users through profile setup
- Extend mana-core-auth GlobalSettings with displayName, interests, onboardingCompleted fields
- Implement state machine for onboarding flow (NAME → INTERESTS → LANGUAGE → SUMMARY)
- Support commands: !start, !profile, !edit, !skip, !help
- Add German and English localization
- Integrate with mana-core-auth Settings API for profile persistence

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 12:42:41 +01:00
Till-JS
c13c313886 🐛 fix(gifts): reorder controller routes to fix 'me/*' matching
NestJS matches routes in declaration order. The dynamic :code route was
matching before me/created and me/received, treating 'me' as a gift code.
Moved specific routes before the dynamic parameter route.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 12:38:23 +01:00
Till-JS
b1eaa88e6e 📝 docs(stats-bot): add Redis and Matrix-SSO-Link environment variables
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 12:35:15 +01:00
Till-JS
139c04040d refactor(stats-bot): swap commands - !stats for personal, !global for global
- !stats now shows personal stats (requires login)
- !global now shows global Umami analytics
- Update keywords and help text accordingly

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 12:26:52 +01:00
Till-JS
12451092f1 📝 docs(tts): document German voice support (Piper/Kerstin)
- Add Piper TTS section to mana-tts CLAUDE.md
- Document available German voices (local and cloud)
- Update matrix-tts-bot CLAUDE.md with new default voice
- Add language auto-detection documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 12:21:40 +01:00
Till-JS
209a474f17 🩹 fix(gifts): add duplicate claim check to first_come type
Users can now only redeem first_come gift codes once, making it
suitable for promo codes that should be unlimited but once per user.
2026-02-14 12:19:43 +01:00
Till-JS
acf4512e90 fix(session): add auto-refresh for expired JWT tokens
- Add isTokenValid() to decode JWT and check exp claim
- Refresh tokens 60 seconds before expiry (buffer)
- Auto-fetch fresh token via SSO-Link when cached token expires
- Clear invalid sessions when refresh fails
- Prevents "exp claim timestamp check failed" errors

JWT tokens from mana-core-auth expire after 15 minutes, but sessions
were cached for 7 days. Now tokens are transparently refreshed when
they expire, keeping users authenticated.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 12:19:08 +01:00
Till-JS
4b950b7083 feat(tts): add de_kerstin female German voice and set as default
- Download and configure Kerstin Piper voice (63MB, local)
- Update piper_service.py to support multiple voice models
- Set de_kerstin as default voice for TTS bot
- Update help text with new voice options

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 12:16:58 +01:00
Till-JS
01b011235f 🩹 fix(mana-tts): add Piper/German voice support to /synthesize/auto endpoint
The auto endpoint now properly routes German voices (de_thorsten, de_katja, etc.)
to Piper TTS instead of falling back to English Kokoro voices.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 12:08:17 +01:00
Till-JS
5af965ea90 feat(clock-bot): add live timer progress with message editing
- Add editMessage() method to BaseMatrixService for Matrix message editing
- Implement live timer updates every 10 seconds using background interval
- Display progress bar using Unicode block characters (█░)
- Track active timers and update messages with current state
- Show percentage completion and remaining time
- Handle timer pause/resume/finish states
- Clean up tracking on timer completion or errors

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 12:07:28 +01:00
Till-JS
0099e1eebc chore(matrix-tts-bot): set German (de_thorsten) as default voice
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:55:47 +01:00
Till-JS
67f3d3020a fix(matrix-tts-bot): use /synthesize/auto endpoint for German voices
The /synthesize/piper endpoint doesn't exist - use /synthesize/auto
which automatically routes to the correct TTS backend based on voice.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:30:37 +01:00
Till-JS
2521a1ea73 feat(matrix): sync recent emojis across apps via mana-core-auth
- Add recentEmojis field to GlobalSettings in shared-theme
- Create userSettings store for Matrix app with JWT token management
- Exchange session cookie for JWT after SSO login
- Update MessageInput to use userSettings instead of localStorage
- Add recentEmojis support to mana-core-auth settings API

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:30:17 +01:00
Till-JS
83c75ce90e 🩹 fix(nutriphi-bot): use correct API field name for image analysis
Change 'image' to 'imageBase64' to match the NutriPhi backend API spec.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:28:46 +01:00
Till-JS
d81b8aebf2 🔒 refactor(bots): remove !login command and enforce OIDC-only auth
- Remove !login and !logout commands from all 16+ Matrix bots
- Remove login/logout references from all help/welcome messages
- Disable password login in Synapse (password_config.enabled: false)
- System is now OIDC-only via Mana Core authentication

Users must authenticate via "Sign in with Mana Core" in Element.
Existing bot access tokens remain valid.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:26:58 +01:00
Till-JS
bd7f19718c feat(stats-bot): add infrastructure monitoring commands
Add 5 new commands powered by Prometheus/VictoriaMetrics:
- !system: Mac Mini status (CPU, RAM, Disk, Uptime, Load)
- !services: Backend service health (UP/DOWN)
- !traffic: HTTP traffic & latency per service
- !db: PostgreSQL & Redis status
- !growth: User growth statistics

New modules:
- PrometheusService: Query Prometheus/VictoriaMetrics API
- InfrastructureService: Generate infrastructure reports

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:24:31 +01:00
Till-JS
4a26926fae 🩹 fix(bot-services): export LOGIN_MESSAGES and auth error helpers
Export the following from @manacore/bot-services:
- LOGIN_MESSAGES: Pre-defined auth error messages for all bot types
- AUTH_ERROR_MESSAGES: Same as LOGIN_MESSAGES (preferred name)
- formatAuthErrorMessage(): Helper to create custom auth error messages

These are used by bots to show consistent error messages when token
refresh fails and the user needs to re-authenticate.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:19:55 +01:00
Till-JS
ff1affb268 🩹 fix(nutriphi-bot): add automatic token refresh on JWT expiration
When the JWT token expires (15 min), the bot now automatically:
1. Detects the 401 "exp claim" error
2. Clears the expired session
3. Attempts to fetch a new token via Matrix-SSO-Link
4. Retries the failed operation with the new token

This prevents users from getting authentication errors after 15 minutes
of inactivity.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:18:19 +01:00
Till-JS
0f234a0ce6 fix(matrix-tts-bot): use WAV format for better Matrix compatibility
MP3 format was causing "no supported sources" error in Element.
Switch to WAV which has broader browser/client support.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:09:56 +01:00
Till-JS
fa7fb3c294 🩹 fix(matrix-bots): use authenticated media download for all bots
The Matrix Media API now requires authentication (spec v1.11+). Updated
all 5 affected bots to use downloadMedia() from BaseMatrixService which
handles authenticated downloads via /_matrix/client/v1/media/download/.

Affected bots:
- matrix-nutriphi-bot (images + audio)
- matrix-zitare-bot (audio)
- matrix-todo-bot (audio)
- matrix-ollama-bot (images)
- matrix-project-doc-bot (images + audio)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:04:13 +01:00
Till-JS
70e45ed82e fix(matrix-stats-bot): adapt to Umami v2 API response format
The Umami API returns stats in a different format than expected:
- Before: { pageviews: { value, change } }
- After: { pageviews: number, comparison: { pageviews: number } }

Transform the raw API response to the expected format and calculate
percentage change from comparison values.

Also update URL_SCHEMA.md with complete list of all mana.how services.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 11:03:03 +01:00
Till-JS
1c9c2301a5 fix(matrix-tts-bot): add API key authentication for mana-tts service
- Add TTS_API_KEY config option to configuration.ts
- Send X-API-Key header in TtsService requests
- Update docker-compose.macmini.yml with TTS_INTERNAL_API_KEY env var
- Update .env.example and CLAUDE.md documentation

The mana-tts service requires authentication, but the TTS bot was not
sending the required X-API-Key header, causing 401 errors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 10:59:08 +01:00
Till-JS
284cd004aa 🩹 fix(auth): fix gift code route prefix and JWT issuer validation
- Remove duplicate route prefix in GiftsController (was /api/v1/api/v1/gifts)
- Fix JwtAuthGuard to use JWT_ISSUER as fallback when BASE_URL is not set
- Add comprehensive GIFT_CODES.md documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 23:54:36 +01:00
Till-JS
0485ce4b07 🩹 fix(auth): correct healthcheck endpoint path
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 23:48:45 +01:00
Till-JS
9d7768495d 🔧 fix(auth): add build tools for bcrypt native module 2026-02-13 23:41:35 +01:00
Till-JS
0701635edb 🔧 fix(auth): update Dockerfile for workspace dependencies
Add shared-storage package to Docker build context to resolve
workspace dependency.
2026-02-13 23:36:56 +01:00
Till-JS
087d34c552 feat(matrix-bots): enhance stats and todo bots
- Add credit commands to todo-bot
- Enhance stats-bot with improved metrics
- Add Umami analytics improvements
2026-02-13 23:29:36 +01:00
Till-JS
e8c3b97f8f feat(auth): add gift codes and enhanced credit system
- Add gift code creation, redemption, and refund endpoints
- Add Stripe payment link generation for credits
- Add gifts database schema
- Enhance credits controller with new operations
2026-02-13 23:29:30 +01:00
Till-JS
92c6dc83ee fix(nutriphi-bot): remove missing media-client dependency 2026-02-13 23:22:29 +01:00
Till-JS
c2842e2546 feat(auth): add avatar upload with S3/MinIO and subscription plans seed
- Add StorageModule for avatar uploads via S3/MinIO
- Create presigned URL endpoint for direct browser uploads
- Create direct upload endpoint (multipart/form-data)
- Add manacore-storage bucket to shared-storage package
- Add manacore-storage bucket to docker-compose.dev.yml
- Create subscription plans seed script (pnpm db:seed:plans)
- Plans: Free (150 credits), Pro (2000/€9.99/mo), Enterprise (10000/€49/mo)
- Update TODO list with completed tasks
2026-02-13 23:06:24 +01:00
Till-JS
ce4e982651 feat(auth): add profile management endpoints
Add backend endpoints for user profile management:
- GET /auth/profile - retrieve user profile data
- POST /auth/profile - update name and profile image
- POST /auth/change-password - change password (requires current)
- DELETE /auth/account - soft-delete account (requires password)

Security features:
- Password verification before sensitive actions
- Soft-delete preserves data for retention
- Security events logged for audit trail
- Rate limiting on sensitive endpoints

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 22:29:32 +01:00
Till-JS
ae30ce3323 feat(auth): add Stripe credit purchases and subscription management
- Add StripeService for PaymentIntent creation and webhook verification
- Add credit purchase flow (POST /credits/purchase)
- Add stripe_customers table for Stripe customer mapping
- Add subscriptions schema (plans, subscriptions, invoices)
- Add SubscriptionsService with Checkout, Portal, Cancel, Reactivate
- Add subscription plans (Free: 150 Mana, Pro: €9.99, Enterprise: €49.99)
- Handle subscription and invoice webhooks
- Update roadmap with completed tasks

Credit pricing: 1 Mana = 1 Cent (no volume discounts)
2026-02-13 22:21:23 +01:00
Till-JS
c8b1e92655 💄 style(matrix-todo-bot): clean up task response messages
- Remove credit display from responses (credits still charged)
- Remove "Synchronisiert" text (sync still works)
- Use sendMessage instead of sendReply to avoid quoting user ID
- Simplify status output
- Use cleaner formatting with dots instead of pipes
2026-02-13 22:09:31 +01:00
Till-JS
ab15c2367b feat(gdpr): add DSGVO improvements for self-service data page
- Add account deletion confirmation email
- Extend data export with sessions, security events, transactions
- Add DSGVO info banner with privacy policy link
- Add data retention periods section
- Add cookie info (no tracking cookies)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 13:43:23 +01:00
Till-JS
742aa0e046 feat(zitare): add multilingual support and expanded quote metadata
- Add 6-language support: original, de, en, it, fr, es
- Add quote metadata: source, year, tags, imageUrl, authorBio, verified
- Add originalLanguage field to preserve original quote language (la, el, zh, sa, etc.)
- Update all 50 quotes with full translations and metadata
- Add new utility functions: getQuoteText, getQuotesByTag, getAllTags,
  getQuotesByAuthor, getVerifiedQuotes, getQuotesByYearRange,
  getQuotesByOriginalLanguage
- Update matrix-zitare-bot to use new multilingual schema
2026-02-13 12:42:50 +01:00
Till-JS
74c1cfed4f feat(zitare): add @zitare/content package for shared quotes
- Create new @zitare/content package with 50 German quotes
- Include 10 categories: motivation, weisheit, liebe, leben, erfolg,
  glueck, freundschaft, mut, hoffnung, natur
- Add utility functions: getRandomQuote, getDailyQuote, searchQuotes,
  getQuotesByCategory, formatQuote, etc.
- Migrate matrix-zitare-bot to use the shared package
- Remove hardcoded quotes from bot configuration
2026-02-13 12:30:41 +01:00
Till-JS
b9f0d841df ♻️ refactor(matrix-bots): remove offline mode, require login for all operations
- Remove local JSON storage from matrix-todo-bot and matrix-calendar-bot
- Delete TodoService, CalendarService and their modules
- Add requireLogin() helper that prompts users to authenticate
- All bot commands now require login before any operation
- Data is always synced with respective backends (todo-backend, calendar-backend)
- Update CLAUDE.md documentation for both bots

BREAKING CHANGE: Bots no longer work without authentication

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 12:18:11 +01:00
Till-JS
02a5172c7c feat(admin): add GDPR user-data endpoints to photos, clock, storage backends
- Add admin modules with GET/DELETE /api/v1/admin/user-data/:userId
- Photos: albums, favorites, tags counting and deletion
- Clock: alarms, timers, world clocks, presets counting and deletion
- Storage: files, folders, shares, tags counting and deletion
- Update UserDataService to include photos, clock, storage backends
- Add ADMIN_SERVICE_KEY env var to all backends in docker-compose
- Build storage-backend locally instead of using GHCR image

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 13:43:16 +01:00
Till-JS
d5e18c9c27 🔧 fix(mac-mini): update health checks and disable missing services
- Disable api-gateway and skilltree-web (no working images/Dockerfiles)
- Fix mana-search Dockerfile healthcheck port and endpoint
- Update health-check.sh to skip disabled services
- Fix search service health endpoint (/api/v1/health)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 13:28:55 +01:00
Till-JS
6548d83e18 🐛 fix(mana-search): use pnpm deploy to fix symlink issue in Docker
pnpm creates symlinks in node_modules that point to ../../node_modules/.pnpm/
These symlinks break when only the service node_modules are copied.

Using pnpm deploy creates a standalone version with all dependencies
copied (no symlinks), which works correctly in Docker.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 13:24:55 +01:00