Commit Graph

12 Commits

Author SHA1 Message Date
XPS\Micro
5f6b06a66a fix: Remove unsupported --base-path flag from code-server
code-server 4.111.0 does not support --base-path option.
Traefik StripPrefix middleware handles path removal instead.

This fixes the 'Unknown option --base-path' crash loop.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 14:28:54 +01:00
XPS\Micro
24afef32e4 fix: Add container readiness wait after spawn
After spawning a new container, wait until it's fully started and services
are ready before returning to the frontend. This prevents race conditions
where the frontend opens the container URL before the service is ready.

Solution: Wait loop (max 30s) for container.status == 'running',
then additional 2s for service startup (code-server, PlatformIO, etc).

This fixes the 404 error when opening a freshly spawned container.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:39:52 +01:00
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
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
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
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
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
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
79cf304ccf feat: implement multi-container MVP with dev and prod templates
Add full support for 2 container types (development and production):

Backend Changes:
- New UserContainer model with unique constraint on (user_id, container_type)
- Removed single-container fields from User model (container_id, container_port)
- Added CONTAINER_TEMPLATES config with dev and prod templates
- Implemented spawn_multi_container() method in ContainerManager
- Added 2 new API endpoints:
  * GET /api/user/containers - list all containers with status
  * POST /api/container/launch/<type> - on-demand container creation
- Multi-container container names and Traefik routing with type suffix

Frontend Changes:
- New Container, ContainersResponse, LaunchResponse types
- Implemented getUserContainers() and launchContainer() API functions
- Completely redesigned dashboard with 2 container cards
- Status display with icons for each container type
- "Create & Open" and "Open Service" buttons based on container status
- Responsive grid layout

Templates:
- user-template-next already configured with Tailwind CSS and Shadcn/UI

Documentation:
- Added IMPLEMENTATION_SUMMARY.md with complete feature list
- Added TEST_VERIFICATION.md with detailed testing guide
- Updated .env.example with USER_TEMPLATE_IMAGE_DEV/PROD variables

This MVP allows each user to manage 2 distinct containers with:
- On-demand lazy creation
- Status tracking per container
- Unique URLs: /{slug}-dev and /{slug}-prod
- Proper Traefik routing with StripPrefix middleware

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-31 20:33:07 +01:00
XPS\Micro
20a0f3d6af feat: Implement passwordless authentication with Magic Links
Major changes:
- Remove username and password_hash from User model
- Add MagicLinkToken table for one-time-use email authentication
- Implement Magic Link email sending with 15-minute expiration
- Update all auth endpoints (/login, /signup) to use email only
- Create verify-signup and verify-login pages for token verification
- Container URLs now use slug instead of username (e.g., /u-a3f9c2d1)
- Add rate limiting: max 3 Magic Links per email per hour
- Remove password reset functionality (no passwords to reset)

Backend changes:
- api.py: Complete rewrite of auth routes (magic link based)
- models.py: Remove username/password, add slug and MagicLinkToken
- email_service.py: Add Magic Link generation and email sending
- admin_api.py: Remove password reset, update to use email identifiers
- container_manager.py: Use slug instead of username for routing
- config.py: Add MAGIC_LINK_TOKEN_EXPIRY and MAGIC_LINK_RATE_LIMIT

Frontend changes:
- src/lib/api.ts: Update auth functions and User interface
- src/hooks/use-auth.tsx: Implement verifySignup/verifyLogin
- src/app/login/page.tsx: Email-only login form
- src/app/signup/page.tsx: Email-only signup form
- src/app/verify-signup/page.tsx: NEW - Signup token verification
- src/app/verify-login/page.tsx: NEW - Login token verification
- src/app/dashboard/page.tsx: Display slug instead of username

Infrastructure:
- install.sh: Simplified, no migration needed (db.create_all handles it)
- .env.example: Add MAGIC_LINK_TOKEN_EXPIRY and MAGIC_LINK_RATE_LIMIT
- Add IMPLEMENTATION-GUIDE.md with detailed setup instructions

Security improvements:
- No password storage = no password breaches
- One-time-use tokens prevent replay attacks
- 15-minute token expiration limits attack window
- Rate limiting prevents email flooding

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-31 16:19:22 +01:00
XPS\Micro
c363351483 Initial project structure with documentation 2026-01-30 18:00:41 +01:00