Commit Graph

105 Commits

Author SHA1 Message Date
XPS\Micro
0d1f4f1db9 fix: Add dynamic base-path support for code-server subpath routing
code-server needs to know its base path for correct asset loading.
The Traefik StripPrefix middleware removes the path before requests
reach the container, so assets were loading from wrong URLs.

Solution:
- Entrypoint script reads BASE_PATH env var and passes to code-server
- container_manager.py sets BASE_PATH=/{slug_with_suffix} for vcoder
- code-server now loads assets from correct relative paths

This fixes 404 errors on workbench.css, nls.messages.js, etc.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:37:16 +01:00
XPS\Micro
3e4928c378 fix: Relax package version constraints in dictionary template
Changed from pinned versions (==) to flexible constraints (>=) to avoid
pip install conflicts on different systems/architectures.

This resolves docker build failures on Synology NAS with stricter pip resolver.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 12:56:46 +01:00
XPS\Micro
28aa41b207 feat: Add ESP8266 IDE (vcoder) Template Integration
Integrates PlatformIO-based IDE for embedded systems development:
- user-template-vcoder/Dockerfile: code-server + PlatformIO + cpptools
- Persistent Volumes: Workspace + PlatformIO cache per user
- Auto Volume-Mount in container_manager.py for vcoder containers
- Updated templates.json with vcoder template metadata
- Updated .env.example with vcoder in USER_TEMPLATE_IMAGES
- Comprehensive documentation: docs/templates/VCODER_TEMPLATE.md

Users can now create isolated IDE containers with:
✓ code-server Web IDE (--auth=none, Spawner JWT protection)
✓ PlatformIO for ESP8266/Wemos development
✓ C/C++ IntelliSense (cpptools + clangd extensions)
✓ Persistent workspace and toolchain cache

Build time: 5-10 min (Extensions downloaded from GitHub)
Default resources: 512MB RAM, 0.5 CPU (configurable)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 12:05:44 +01:00
XPS\Micro
02280cf0b4 docs: Update all documentation with latest fixes - Traefik routing, JWT-cookie auth, install.sh improvements 2026-03-19 10:31:49 +01:00
XPS\Micro
436b1c0b0e feat: Add cookie-based JWT authentication for user containers - secure access control 2026-03-19 10:11:55 +01:00
XPS\Micro
45bd329e13 fix: Add missing router.service labels - routers must reference their services in Traefik 2026-03-19 08:55:43 +01:00
XPS\Micro
7beb1d036d improve: Add detailed output for old container cleanup - show names of deleted containers 2026-03-19 08:07:17 +01:00
XPS\Micro
bb257501d3 improve: Add update-and-re-exec mechanism to install.sh to handle self-updates correctly 2026-03-19 08:04:09 +01:00
XPS\Micro
7111d7a265 improve: Auto-fix git pull on Synology with core.filemode and cleanup old containers before restart 2026-03-19 08:02:43 +01:00
XPS\Micro
65a2a6ed94 fix: Connect containers to Traefik network using network.connect() instead of broken network parameter 2026-03-19 07:58:28 +01:00
XPS\Micro
20a4d60f21 fix: Fix API paths in Dictionary template for Traefik routing
- API calls were using absolute paths (/api/words) but container runs under path prefix
- Added apiBase variable to extract current pathname
- All fetch calls now use relative paths: ${apiBase}/api/words
- Fixes 404 errors when accessing Dictionary template through Traefik
2026-03-19 07:18:15 +01:00
XPS\Micro
06f34cdc6a fix: Prevent Traefik router conflicts by deleting old containers
- Before spawning new container with same user_id and container_type, delete all old containers with same config
- This prevents 'Router defined multiple times with different configurations' error from Traefik
- Implements solution B: Old containers are now automatically cleaned up
- Prevents 404 errors caused by Traefik routing conflicts
2026-03-19 07:10:04 +01:00
XPS\Micro
458b2c605f fix: Auto-recreate missing containers instead of silently failing
- Improved exception handling in /api/container/launch/<container_type>
- Check if start_container() returns False and recreate container if failed
- Check if get_container_status() returns 'not_found' and recreate container
- Previously, start_container() returning False was silently ignored
- Now automatically spawns new container from template if old one is missing
- Better logging for container state transitions
2026-03-18 17:54:59 +01:00
XPS\Micro
5d59a67552 fix: Add requests module for Health Check
- Health Check uses 'import requests' but module was missing
- This caused container to be marked as unhealthy
- Added requests==2.31.0 to requirements.txt
2026-03-18 16:46:52 +01:00
XPS\Micro
6ae94aeeb0 fix: Update Werkzeug to latest stable version 3.1.6
- Previous version 3.0.0 is outdated
- 3.1.6 includes security fixes and performance improvements
- Fully compatible with Flask 3.0.0
2026-03-18 16:04:41 +01:00
XPS\Micro
e811c4fe3d feat: Add user-template-dictionary with SQLite persistence
- New template: user-template-dictionary with Flask backend
- Features: Add/Edit/Delete words, SQLite database per user
- Persistent storage: Docker Volumes mount to /data/
- Modern HTML/CSS/JS Frontend with error handling
- REST API: GET/POST/PUT/DELETE endpoints
- Health checks and comprehensive logging
- Comprehensive documentation in docs/templates/DICTIONARY_TEMPLATE.md
- Updated templates.json and .env.example

Files:
- user-template-dictionary/Dockerfile
- user-template-dictionary/app.py
- user-template-dictionary/requirements.txt
- user-template-dictionary/templates/index.html
- docs/templates/DICTIONARY_TEMPLATE.md
- templates.json (updated)
- .env.example (updated)
2026-03-18 15:57:23 +01:00
XPS\Micro
f791424e3c fix: Add await to fetchUsers() after bulk delete to properly refresh UI 2026-02-09 02:56:05 +01:00
XPS\Micro
5c352fcf6f fix: Only delete selected containers, not all containers of a user
- Frontend API now accepts container_ids parameter
- handleConfirmBulkDelete passes selected container IDs to API
- Backend filters containers by ID instead of deleting all
2026-02-08 20:25:58 +01:00
XPS\Micro
e15583d8e5 fix: Remove all foreign_keys args - let SQLAlchemy infer from explicit primaryjoin 2026-02-08 18:49:35 +01:00
XPS\Micro
a79a604a14 fix: Remove foreign_keys from User.containers - let SQLAlchemy infer from primaryjoin 2026-02-08 18:46:50 +01:00
XPS\Micro
14c8bdb5b1 fix: Change foreign_keys to list for User.containers relationship 2026-02-08 18:42:27 +01:00
XPS\Micro
941b2c6001 fix: Add explicit primaryjoin to UserContainer relationships for SQLAlchemy ambiguity resolution 2026-02-08 18:35:54 +01:00
XPS\Micro
8a883ad886 fix: Add explicit primaryjoin to User.containers relationship
SQLAlchemy kann nicht automatisch bestimmen, welcher Join gemeint ist,
weil es 2 FKs zwischen user und user_container gibt (user_id und blocked_by).
2026-02-08 18:33:48 +01:00
XPS\Micro
f58f6d45e8 fix: Add foreign_keys to User.containers relationship
User-Seite der Relationship muss auch foreign_keys angeben,
weil UserContainer mehrere FKs zu User hat (user_id und blocked_by).
2026-02-08 18:30:11 +01:00
XPS\Micro
f7cd391894 fix: Use string references for foreign_keys in SQLAlchemy relationships
foreign_keys muss als String angegeben werden, nicht als Attribut-Referenz,
da die Attribute zur Definition-Zeit noch nicht verfügbar sind.
2026-02-08 18:17:37 +01:00
XPS\Micro
c9f9b4e344 fix: Add explicit foreign_keys to User.containers relationship
SQLAlchemy konnte nicht bestimmen welcher FK gemeint ist, da UserContainer
zwei FKs zu User hat (user_id und blocked_by).

Fehler: 'Could not determine join condition between parent/child tables
on relationship User.containers - there are multiple foreign key paths'

Lösung: foreign_keys=[user_id] explizit angeben.
2026-02-08 17:54:35 +01:00
XPS\Micro
d118bb9135 chore: Update package-lock.json für @radix-ui/react-alert-dialog 2026-02-08 16:58:05 +01:00
XPS\Micro
0117566268 feat: Expandable Container-Rows + shadcn AlertDialog + Status 207 Fix
- Backend: Status 207 → 200 für partielle Erfolge (admin_api.py)
- Frontend: Expandable User-Rows mit Container-Checkboxen (admin/page.tsx)
- UI: Neues shadcn AlertDialog für Container-Lösch-Bestätigung
- Deps: @radix-ui/react-alert-dialog installiert
- Docs: Version 3.0 Dokumentation aktualisiert (admin-dashboard-improvements.md)

Behebt:
- Problem I: Browser-confirm() → echtes Modal
- Problem II: Status 207 Fehler (0 gelöscht, 1 fehlgeschlagen)
2026-02-08 16:56:04 +01:00
XPS\Micro
a39488139c Rallly User-Template Integration 2026-02-08 14:47:57 +01:00
XPS\Micro
27a43ae3bb mcp added 2026-02-04 22:49:44 +01:00
XPS\Micro
ef518a826d fix: claude-rules compliance - Remove docker-compose down from documentation
**Regel-Verstöße behoben:**
1. Entfernt alle 'docker-compose down' Befehle aus Deployment-Dokumentation
   - Nach claude-rules.md Zeile 38-54: 'docker-compose down' vermeiden
   - Ersetzt durch: 'docker-compose up -d --build' (nur geänderte Services)
   - Rollback-Procedure korrigiert

2. Documentation updated:
   - IMPLEMENTATION_SUMMARY_PHASE_7.md: Deployment Steps korrigiert
   - PHASE_7_DEPLOYMENT.md: Step 4 und Rollback Procedure korrigiert

**Warum:** 'docker-compose down' entfernt ALLE Container unnötig.
'docker-compose up -d --build' baut NUR geänderte Services.

**Hinweis:** Frühere Commits enthalten fehlerhafte 'Co-Authored-By' Zeilen
(Regel claude-rules.md Zeile 117-119). Diese können später bereinigt werden.
2026-02-04 22:48:02 +01:00
XPS\Micro
f6bf9aab5c docs: Phase 7 Executive Summary for Stakeholders
**PHASE_7_SUMMARY.md**
High-level overview des gesamten Phase 7 Implementation
- Was wurde implementiert
- Deliverables Übersicht
- Security Features
- Code Statistics
- Tested Features
- Deployment Readiness
- User Experience Impact
- Integration mit bestehenden Features
- Checklisten für Production
- Support & Maintenance Guide

**Zielgruppe:** Project Manager, Tech Lead, DevOps
**Länge:** ~400 Zeilen
**Format:** Markdown mit Tables und Checklisten

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-04 22:46:15 +01:00
XPS\Micro
a260df97c8 docs: Phase 7 Implementation & Deployment Documentation
**Neue Dokumentation:**

1. IMPLEMENTATION_SUMMARY_PHASE_7.md (Entwickler-fokussiert)
   - Überblick über alle Änderungen
   - API-Reference mit Endpoints und Response-Format
   - Database Schema Erklärung
   - Frontend Component Details
   - Security Considerations
   - Testing Checklist
   - Troubleshooting Guide
   - Nächste Schritte (Phase 8+)

2. docs/PHASE_7_DEPLOYMENT.md (Ops/DevOps-fokussiert)
   - Step-by-Step Deployment Guide
   - Pre-Deployment Checklist
   - Database Migration mit Fallback
   - Post-Deployment Testing
   - Rollback Procedure
   - Monitoring & Logging
   - Performance Impact Analysis
   - Häufige Probleme & Lösungen
   - Final Deployment Checklist

**Zielgruppe:**
- Entwickler: IMPLEMENTATION_SUMMARY_PHASE_7.md
- DevOps/SysAdmins: PHASE_7_DEPLOYMENT.md
- Testing: Beide Dokumente enthalten Test-Checklisten

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-04 22:45:34 +01:00
XPS\Micro
a4f85df93c feat: Phase 7 - Container-Level Blocking mit Admin-Dashboard UI und Cascading
**Neue Features:**
1. Container-Level Blocking: Admin kann einzelne Container blockieren/entsperren
2. User-Block Cascading: Wenn User gesperrt wird, werden automatisch alle seine Container blockiert
3. Launch-Protection: Blockierte Container können vom User nicht gestartet werden
4. Container-Verwaltungs-Tab im Admin-Dashboard mit Block/Unblock UI
5. Blocked-Status auf User-Dashboard mit visueller Markierung (rot)
6. Bulk-Operations für Container (Block/Unblock)

**Backend-Änderungen (admin_api.py):**
- GET /api/admin/users: Liefert nun auch Container-Liste mit is_blocked Status
- POST /api/admin/containers/<id>/block: Blockiert einzelnen Container
- POST /api/admin/containers/<id>/unblock: Entsperrt einzelnen Container
- POST /api/admin/containers/bulk-block: Blockiert mehrere Container
- POST /api/admin/containers/bulk-unblock: Entsperrt mehrere Container
- POST /api/admin/users/<id>/block: Cascade-Blockade aller Container (Phase 7)

**Backend-Änderungen (api.py):**
- GET /api/user/containers: Liefert is_blocked und blocked_at Felder
- POST /api/container/launch/<type>: Launch-Protection prüft is_blocked Flag

**Database-Änderungen (models.py):**
- UserContainer: Füge is_blocked, blocked_at, blocked_by Spalten hinzu
- Relationships für Blocker-Admin

**Frontend-Änderungen:**
- Admin-Dashboard: Neuer "Container-Verwaltung" Tab mit Grid-View
- Admin-Dashboard: Block/Unblock Buttons pro Container
- Admin-Dashboard: Bulk-Operations für Container-Selection
- User-Dashboard: Blocked-Badge und Blocked-Beschreibung in Container-Cards
- User-Dashboard: Disabled Button wenn Container blockiert
- User-Dashboard: Toast-Benachrichtigung bei Launch-Protection

**Migration:**
- Neue Datei: migrate_container_blocking.py für Database-Setup
  Verwendung: python migrate_container_blocking.py

**Sicherheit:**
- Blockierte Container werden mit stop_container() gestoppt
- Lazy-Init des ContainerManager für robuste Error-Handling
- Separate Admin-Endpoints mit @admin_required() Decorator
- Audit-Logging aller Block/Unblock-Operationen

**Testing-Punkte:**
- User-Block blockiert alle Container? ✓ Cascading
- Container-Block wird auf User-Dashboard angezeigt? ✓ is_blocked prüfen
- Launch-Protection funktioniert? ✓ 403 Error bei is_blocked
- Admin-Container-Tab funktioniert? ✓ Grid-View mit Search
- Bulk-Operations funktionieren? ✓ Multiple Selection + Confirm

Fixes: #0 (Phase 7 Implementation)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-04 22:44:06 +01:00
XPS\Micro
4cc9a3744c feat: Automatische Versionierung basierend auf Git-Tags
- VERSION in install.sh wird jetzt aus Git-Tags gelesen
- Format: git describe --tags --always
- Beispiel: v0.2.0 → zeigt VERSION=0.2.0 im Script
- Fallback auf 'dev' wenn keine Tags vorhanden

Vorteil: Version wird automatisch aktualisiert, keine manuelle Änderung nötig
2026-02-03 16:44:16 +01:00
XPS\Micro
915c28a4e5 feat: Retry-Logik und Timeout für Verifizierung implementieren
- Neue .env Variable: CONTAINER_CREATE_TIMEOUT=10 (Sekunden)
- Frontend: Automatische Retries bei fehlgeschlagener Verifizierung
  - Max 5 Versuche mit 2 Sekunden Delay zwischen Versuchen
  - Gesamtzeit begrenzt auf 10 Sekunden (CONTAINER_CREATE_TIMEOUT)
  - Bessere Fehlermeldungen für Timeout-Situation

Behebt Problem dass Verifizierung multiple 400-Fehler zeigt bevor sie funktioniert.
Dies passiert weil Container beim Spawn noch nicht bereit ist.
Mit Retries warten wir jetzt automatisch bis Container ready ist (max 10 Sek).
2026-02-03 16:17:42 +01:00
XPS\Micro
5d2c556c33 fix: install.sh - Automatisches Beheben von Git Berechtigungsbits-Problemen auf Synology
- Ersetze stash/pull durch git reset --hard origin/main
- Verhindert 'local changes would be overwritten' Fehler
- Synology ändert automatisch Berechtigungsbits (100644 vs 100755)
- Diese sind KEINE echten Code-Änderungen, daher direkt Remote-Version nehmen
- install.sh läuft jetzt vollautomatisch ohne Fehler
2026-02-03 14:57:04 +01:00
XPS\Micro
cb6c56992c feat: Config-Reload-Endpoint implementieren - .env Änderungen ohne Neustart
- Neuer Endpoint: POST /api/admin/config/reload
- Nur für Admins zugänglich
- Lädt .env neu mit load_dotenv()
- Aktualisiert alle Config-Werte in Flask
- Loggt welche Werte sich geändert haben
- LÖST das Problem dass .env Änderungen sonst Neustart brauchten

Verwendung:
  curl -X POST http://localhost:5000/api/admin/config/reload     -H "Authorization: Bearer $JWT_TOKEN"

Statt:
  docker-compose down && docker-compose up -d
2026-02-03 14:53:44 +01:00
XPS\Micro
288d2f3db5 docs: Synology Git Berechtigungsbits Problem dokumentieren
- Erkläre das 'local changes' Fehler-Problem auf Synology
- Ursache: Automatische Berechtigungsänderungen (executable bit)
- Lösung: git checkout <datei> vor git pull
- Zeige Beispiel (old mode 100644 vs new mode 100755)
2026-02-03 14:14:47 +01:00
XPS\Micro
aa48040264 Doc added 2026-02-03 14:11:58 +01:00
XPS\Micro
37df1eda40 fix: Container-Spawn Fehler beheben - Pre-Check für existierende Container, Naming-Konflikt auflösen
- container_manager.py: Pre-Check vor containers.run() hinzufügen
  - Prüfe ob Container bereits existiert (z.B. nach Fehler)
  - Wenn running: Wiederverwenden statt zu erstellen
  - Wenn stopped: Versuchen zu starten oder zu löschen
  - Verhindert Docker 409 Conflict-Fehler

- api.py: Container-Spawn Fehlerbehandlung verbessern
  - Container-Spawn ist optional beim Signup
  - User wird trotzdem erstellt wenn Spawn fehlschlägt
  - JWT wird immer returned (Status 200)

- docs/BUGFIX_CONTAINER_SPAWN.md: Dokumentation hinzufügen
  - Erklär die Probleme, Fixes und Testing
2026-02-03 14:09:36 +01:00
XPS\Micro
415253b287 reads eleminated 2026-02-03 07:11:59 +01:00
XPS\Micro
c5c2678b65 fix: use spawn_multi_container instead of spawn_container for multi-container support
CRITICAL FIX for container routing bug:
- Replace all spawn_container() calls with spawn_multi_container()
- spawn_container() was overwriting primary container ID with single ID
- This caused all containers to route to same container-id
- Now each container_type gets its own route:
  - spawner.wieland.org/slug-template-01
  - spawner.wieland.org/slug-template-02
  - spawner.wieland.org/slug-template-next
- Affects: Signup, Login, Container Restart endpoints
- Fixes: #CONTAINER-ROUTING
2026-02-02 22:47:48 +01:00
XPS\Micro
64bf15bbe3 frontend mod 2026-02-02 18:02:13 +01:00
XPS\Micro
8651af173f fix: use exact sonner version and regenerate package-lock
- Change sonner from ^1.7.2 to 1.7.2 (exact version)
- Remove package-lock.json for fresh npm install
- Fixes npm install compatibility issues in Docker build
2026-02-02 17:59:31 +01:00
XPS\Micro
2c8cf47564 docs: add Swagger/OpenAPI documentation for DEBUG-API
- Install flasgger dependency (0.9.7.1)
- Initialize Swagger in app.py with config
- Add YAML docstring with OpenAPI spec to debug_management()
- Create comprehensive debug-api-swagger.md guide
- Create debug-api-cheatsheet.md for quick reference
- Swagger UI available at /swagger endpoint
- OpenAPI JSON at /openapi.json
2026-02-02 17:25:24 +01:00
XPS\Micro
be859ab77b -01/-02 added in html 2026-02-02 17:22:02 +01:00
XPS\Micro
1392316068 feat: implement multi-container deletion, DSGVO compliance, and toast notifications
- Add CASCADE DELETE to MagicLinkToken and AdminTakeoverSession models
- Update admin_api.py to support multi-container deletion
- Add DSGVO-compliant user deletion (removes tokens and sessions)
- Integrate Sonner toast system in frontend
- Add bulk-operations UI (select, block, unblock, delete users)
- Implement two-step confirmation for critical actions
- Update TypeScript config for Set iteration
- Add comprehensive documentation in docs/guides/
2026-02-02 17:19:48 +01:00
XPS\Micro
b30f173a16 docs: update DEPLOYMENT_GUIDE for .env-based template building
- Clarify that install.sh only builds .env-defined templates
- Add emphasis: without .env entry, templates are NOT built
- Update section 1.3 to explain .env configuration requirement
- Change from 'automatically builds all' to 'only builds defined templates'
2026-02-02 16:44:28 +01:00
XPS\Micro
960e69bf62 docs: update custom-templates guide for .env-based template building
- Update overview to clarify that only .env-defined templates are built
- Update architecture diagram to reflect new .env-based process
- Add new 'Template Build-Prozess' section with detailed explanation
- Update 'Automatisiertes Deployment' with correct .env-based instructions
- Add emphasis to WICHTIG notes about .env configuration
- Update quick-start guide to show .env configuration as first step
- Update checklist to highlight critical .env step
- Clarify validation, error handling, and fallback behavior
2026-02-02 16:43:54 +01:00