Skip to content

feat: Cozy App integration for Token Manager#10

Open
mmaudet wants to merge 22 commits intofeat/token-managerfrom
feat/cozy-app
Open

feat: Cozy App integration for Token Manager#10
mmaudet wants to merge 22 commits intofeat/token-managerfrom
feat/cozy-app

Conversation

@mmaudet
Copy link
Copy Markdown
Member

@mmaudet mmaudet commented Apr 3, 2026

Summary

Converts the Token Manager frontend into a native Cozy App that runs inside Cozy Stack, alongside the existing Next.js standalone frontend (dual mode).

What's included

  • frontend-cozy/ — Cozy App with Webpack, React 18, React Router 6, cozy-bar
  • Auth: silent OIDC flow via hidden iframe + dev-token fallback
  • All components and pages adapted from Next.js
  • Cozy Stack integration: volume mount, ENABLE_APPS, Traefik routing
  • Dockerfile.cozy-app for CI build

Test plan

  • Build: cd token_manager/frontend-cozy && npm run build
  • Add /etc/hosts: 127.0.0.1 user1-token-manager.twake.local
  • Install: docker exec cozyt cozy-stack apps install --domain user1.twake.local token-manager file:///data/cozy-app/token-manager
  • Open: https://user1-token-manager.twake.local/

🤖 Generated with Claude Code

mmaudet and others added 22 commits April 3, 2026 18:20
Convert Token Manager frontend to native Cozy App:
- Dual mode (Next.js + Cozy App coexist)
- create-cozy-app with React Router hash routing
- Cozy token → silent OIDC exchange
- Deploy via patcher-cozy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Scaffolding (create-cozy-app + auth + router), component adaptation,
and Cozy Stack deployment integration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e React Router)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…onents

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Build output verified: build/index.html, build/app.597fa1ec.js, build/manifest.webapp
Webpack compiled with 3 warnings (only bundle size warnings, no errors).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comprehensive documentation covering:
- Functional overview (users, admins, developers)
- Architecture and data model
- Umbrella token concept and proxy flow
- Service connectors (OIDC, custom OAuth, Matrix SSO)
- Security model (encryption, hashing, PKCE, audit)
- Getting started guide with curl examples
- Full API reference

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…omain

- Webpack: use automatic JSX runtime (no need for import React)
- Auth: auto-detect username from hostname (user1-token-manager → dev-user1)
- Fallback to dev-token when iframe silent OIDC is blocked by CSP

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Without this, the Cozy App cannot fetch from the Token Manager API
due to Content Security Policy blocking cross-origin requests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace placeholder SVG with the API gear icon provided by user.
Update manifest.webapp and webpack to use icon.png.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nstances

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ger in Cozy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… template

Cozy Stack replaces these placeholders at serve time to inject the
cozy-bar scripts and theme CSS. This enables the top navigation bar
matching other Cozy apps like Drive.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cozy apps use SVG icons (like Drive's assets/app-icon.svg).
Converted PNG to SVG with embedded base64 image for compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Orange square now fills from (2,2) to (62,62) instead of (10,10) to (54,54).
Added width="256" height="256" for explicit size hint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…cozyURL

Match Twake Chat/Drive pattern: pass appNamePrefix='Twake', appSlug,
cozyURL, and token for proper bar rendering with app grid and user avatar.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ettings)

The cozy-bar needs GET access to io.cozy.apps (app grid), io.cozy.contacts
(user avatar), io.cozy.oauth.clients, and io.cozy.settings to render
the full navigation bar with app grid and user avatar like Drive/Chat.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…o-detect priority

- Auth: prioritize real Cozy token over dev-token
- Extract username from Cozy domain (user1.twake.local → user1) for API auth
- cozy-bar init: derive cozyURL from instance domain, add appEditor
- Remove aggressive dev-token auto-detect from hostname

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant