daef7ea190
Helper functions (matrix-mas capability group): - mas_client_register_bash_infra: register/sync OAuth clients via mas-cli - mas_syn2mas_migration_bash_infra: dry-run + apply user migration to MAS - synapse_msc3861_enable_go_infra: edit homeserver.yaml MSC3861 block (with diff) - wellknown_oidc_patch_go_infra: patch well-known JSON with msc2965.authentication - synapse_login_flows_check_go_infra: health-check post-migration login flows Flows + issues for custom Matrix clients (PC + Android): - 0010 matrix-client-pc: Wails + React+Mantine (issues 0147-0153) - 0011 matrix-client-android: Kotlin + Compose (issues 0154-0161) - 0162 enable MAS as auth provider (Synapse delegate) — EXECUTED on VPS - 0163 custom admin panel propio (sustituye synapse-admin) Production state (organic-machine.com): - Synapse migrated SQLite -> Postgres - MSC3861 active, password_config disabled - 21 users + 41 access_tokens migrated via syn2mas - 4 MAS clients registered (element, matrix_pc, matrix_android, admin_panel) - synapse-admin container removed + Coolify route deleted - well-known patched with org.matrix.msc2965.authentication Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
55 lines
2.9 KiB
Markdown
55 lines
2.9 KiB
Markdown
---
|
|
id: "0147"
|
|
title: "matrix-client-pc scaffold: Wails + React+Mantine + login MAS"
|
|
status: pending
|
|
priority: high
|
|
created: 2026-05-24
|
|
related_flows: ["0010"]
|
|
related_issues: ["0148", "0162"]
|
|
dependencies: ["0162"]
|
|
tags: [matrix, wails, react, mantine, mas, oidc, scaffold]
|
|
---
|
|
|
|
## Objetivo
|
|
|
|
Crear el esqueleto de la app `projects/element_agents/apps/matrix_client_pc/` con Wails v2 (Go) + React+Vite+Mantine+`@fn_library` y dejar funcionando el login MAS OIDC contra `mas-...organic-machine.com`. Resultado: arrancar binario -> redirect navegador a MAS -> volver con token -> mostrar perfil del usuario.
|
|
|
|
## Tareas
|
|
|
|
1. `wails init -n matrix_client_pc -t react-ts` dentro de `projects/element_agents/apps/`.
|
|
2. Sub-repo Gitea: `git init -b master` + crear repo `dataforge/matrix_client_pc` + push inicial.
|
|
3. `app.md` con frontmatter (lang=go, framework=wails, tags incluyen `matrix` + `service`? — NO, es app cliente, sin tag service).
|
|
4. `go.mod` con deps: `wails/v2`, `mautrix-go`, `keyring`.
|
|
5. Reemplazar template frontend por React+Mantine+`@fn_library`. Symlink `frontend/src/fn_library` -> `../../../../../frontend/functions/ui/` (o copia si symlink no funciona en build).
|
|
6. Backend Go (`backend/`):
|
|
- `wails.json` con `bindings` para `MatrixService`.
|
|
- `MatrixService.Login() -> URL` (devuelve URL MAS OIDC).
|
|
- `MatrixService.HandleCallback(code) -> User`.
|
|
- `MatrixService.GetSession() -> *Session` (lee de keyring).
|
|
- `MatrixService.Logout()`.
|
|
7. Frontend React: layout `AppShell` Mantine, pagina `Login.tsx` con boton "Sign in with Matrix" -> abre URL MAS en navegador del SO.
|
|
8. Persistencia tokens en keyring SO (`github.com/zalando/go-keyring`).
|
|
9. Loopback HTTP local (`127.0.0.1:0`, puerto libre aleatorio) para recibir callback OIDC.
|
|
10. Test e2e basico: arrancar app, login con `@dev-pc:matrix-af2f3d.organic-machine.com`, ver perfil.
|
|
|
|
## Funciones del registry a crear (delegar a fn-constructor)
|
|
|
|
- `matrix_client_init_go_infra` — `mautrix.NewClient(homeserver, userID, accessToken) -> *Client, error`. Wrapper que configura SQLite store + crypto store.
|
|
- `mas_oidc_flow_go_infra` — `StartFlow(masURL) -> authURL, codeVerifier, state`. `ExchangeCode(code, codeVerifier) -> *Token`.
|
|
- `keyring_save_token_go_infra` / `keyring_load_token_go_infra` — wrappers `go-keyring`.
|
|
|
|
## Acceptance
|
|
|
|
- [ ] Binario Wails compila para linux/amd64 + windows/amd64.
|
|
- [ ] `wails dev` arranca con hot-reload.
|
|
- [ ] Login MAS OIDC end-to-end: boton -> navegador -> consent -> callback -> perfil visible.
|
|
- [ ] Token persistido entre re-arranques (no re-login si token vigente).
|
|
- [ ] `app.md` con `uses_functions` que apunta a las 3 funciones nuevas.
|
|
- [ ] Sub-repo `dataforge/matrix_client_pc` creado con commit inicial.
|
|
|
|
## Notas
|
|
|
|
- MAS URL: leerla de `.well-known/matrix/client` del homeserver para no hardcodear.
|
|
- Refresh token: MAS usa OAuth 2.0 estandar — implementar refresh proactivo (~5min antes de expiry).
|
|
- Gotcha: en Windows, `wails dev` requiere WebView2 instalado.
|