Files
healthchat-web/apps/desktop/element.io/healthchat/README
T

63 lines
3.2 KiB
Plaintext

HealthChat desktop variant
===========================
This directory is the `--cfgdir` / build config for HealthChat desktop builds:
config.json Element Web runtime config baked into webapp.asar. Mirrors
apps/web/config.json (HealthChat homeserver, theme, branding) and
loads the HealthChat plugin:
- "modules": ["/modules/healthchat-module.js"]
- "ch.healthchat.elements_base_url": "/webapp/modules/elements"
build.json electron-builder variant (appId, productName "HealthChat", protocols).
Why the paths differ from web
-----------------------------
The desktop app serves the webapp from `vector://vector/webapp/`, so root-relative
paths need a `/webapp` prefix:
- The `modules` array is rewritten automatically by apps/desktop/src/electron-main.ts
(`/modules/x` -> `/webapp/modules/x`), so it stays as `/modules/healthchat-module.js`.
- `ch.healthchat.elements_base_url` is NOT auto-rewritten (the elements bundle is loaded
by a <script> tag the plugin injects, not by the module loader), so it is set explicitly
to `/webapp/modules/elements` here. On web it is `/modules/elements`.
The plugin artifacts must live inside the asar at `modules/healthchat-module.js` and
`modules/elements/healthchat-elements.js`.
Building locally
----------------
# 1. Build the element-plugin (from the healthchat-workspace checkout) and stage it:
(cd ../healthchat-workspace/element-plugin && npm ci && npm run build)
(cd ../healthchat-workspace/element-plugin/module && npm ci && npm run build)
mkdir -p plugin-dist/elements
cp ../healthchat-workspace/element-plugin/module/dist/healthchat-module.js plugin-dist/healthchat-module.js
cp ../healthchat-workspace/element-plugin/dist/elements/browser/main.js plugin-dist/elements/healthchat-elements.js
# 2. Build the fork webapp with the plugin injected:
./apps/desktop/scripts/build-healthchat-webapp.sh
# 3. Pack and run:
cp apps/desktop/element.io/healthchat/config.json apps/desktop/webapp/config.json
pnpm --dir apps/desktop run asar-webapp
pnpm --dir apps/desktop start
CI
--
.github/workflows/build-healthchat-desktop.yaml builds the plugin + webapp artifact and
feeds it into build_desktop_prepare.yaml (`config: element.io/healthchat`,
`webapp-artifact: healthchat-webapp`) and build_desktop_linux.yaml.
Open items before a production release
--------------------------------------
- api_base_url: confirm the production API origin in config.json (currently assumed
https://healthchat.ch). On desktop this MUST be absolute (vector:// origin can't reach
a relative /api).
- Fork vs upstream shell: build_desktop_prepare.yaml / build_desktop_linux.yaml check out
element-hq/element-web (upstream). The webapp + variant are HealthChat's, but the Electron
shell (electron-main, icons) is upstream. Point those workflows at this fork to fully brand
the shell, and to guarantee the `/modules` -> `/webapp/modules` rewrite is present.
- macOS/Windows: need signing/notarization secrets; add the macos/windows reusable workflows
once configured.
- Deploy target: the upstream deploy job pushes to packages.element.io / Cloudflare R2 — wire
up a HealthChat distribution target instead.