Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
docs(flatpak): record that the sandboxed data dir is a review condition
Elian Doran9c69e3799381
diff --git a/.claude/skills/packaging-for-flathub/SKILL.md b/.claude/skills/packaging-for-flathub/SKILL.mdindex c7729ada2a..be9e8a0d3b 100644--- a/.claude/skills/packaging-for-flathub/SKILL.md+++ b/.claude/skills/packaging-for-flathub/SKILL.md@@ -48,8 +48,9 @@ that SHA.if reviewers ever balk at build cost.- **App ID `org.triliumnotes.Trilium`**, CamelCase last element. The old`com.github.zadam.trilium` gets an `end-of-life-rebase` to the new ID — still pending,- Elian can merge it himself; `<provides>`/`<replaces>` are already in the metainfo. User- data survives either way (notes live in `trilium-data`, not `~/.var/app`).+ Elian can merge it himself; `<provides>`/`<replaces>` are already in the metainfo. The+ rebase renames `~/.var/app/<id>`, which the old app never used, so it moves no notes —+ see "What remains" for the migration that does.- **No asar, no Forge.** Payload proven byte-identical to the Forge flatpak; the +11 MBis compression granularity (ostree per file vs. one asar stream). Tamper-sealing comesfrom content-addressed ostree, so asar integrity fuses buy nothing.@@ -81,6 +82,21 @@ that SHA.back to host `~/.local/share/trilium-data` when that exists; a `flatpak override` wins.`--filesystem=home` is **gone** — four read-only XDG dirs cover drag-&-drop import(electron#30650), so the linter exception that was pending at submission is moot.++ **Do not grant the legacy path back**, in any form. The reviewer struck+ `--filesystem=home` ([#10014](https://github.com/flathub/flathub/pull/10014#discussion_r3903751184)),+ then struck the narrowed `--filesystem=~/.local/share/trilium-data:create` as well+ ([here](https://github.com/flathub/flathub/pull/10014#discussion_r3904573174)) — "you+ have your sandboxed folder" — when told it would blank out the old app's users:+ migration is upstream's job, the permission set is Flathub's. Re-adding either gets the+ next packaging PR rejected. A review bot that reads `trilium.sh` alone flags this as a+ data-loss bug (PR #11629); it is a known deferred cost, not a defect.++ `$HOME` inside the sandbox is the real path (`/home/user`) whatever is mounted, so the+ fallback branch turns purely on what the manifest or an override exposes. Verify with+ `flatpak run --nofilesystem=home --command=sh <id> -c '…'` against an installed build.+ Since the guard is `[ ! -d "$XDG_DATA_HOME/trilium-data" ]`, an override added *after*+ the first launch no longer reaches the legacy notes — the sandbox dir already exists.- **pnpm 12 ships as a native binary per platform.** The manifest stages`@pnpm/exe.linux-x64` / `-arm64` tarballs with `only-arches`, because the `pnpm`wrapper package's `postinstall` (which picks one) cannot run offline. `append-path`@@ -187,11 +203,20 @@ build adjudicates it).prerelease skipping. Dispatch-only today.3. **The packaging repo's README**, which still describes staged scripts and the oldpnpm/ASAR reasoning.-4. **EOL-rebase the old app**: PR `flathub.json` with+4. **The data migration for existing users**, which the EOL-rebase does not perform and+ which no permission can substitute for (see "Sandboxed data dir"). The old Flathub app,+ the Forge `.flatpak` and every `.deb`/AppImage keep notes at host+ `~/.local/share/trilium-data`; the new app starts on an empty+ `$XDG_DATA_HOME/trilium-data` and says nothing about why. Options not yet weighed: a+ first-run prompt that asks for the directory through the file portal, a documented+ `flatpak override --filesystem=…` in the release notes, or exposing the legacy+ database read-only for a one-time import. Settle it **before** the rebase — after it,+ the old app is gone and the surprise is the user's.+5. **EOL-rebase the old app**: PR `flathub.json` with`end-of-life-rebase: org.triliumnotes.Trilium` to `flathub/com.github.zadam.trilium`(needs `end-of-life` too, or the linter errors). Old app ships 0.63.7/2024 on EOL23.08 to ~71k installs.-5. Parked polish: carousel-spec screenshots (window ≤1000×700 or 2× at ≤2000×1400, shadow+6. Parked polish: carousel-spec screenshots (window ≤1000×700 or 2× at ≤2000×1400, shadow+ rounded corners), `<branding>` colors (leaf-green `#cfe8c0` light / `#254d18` dark;compare peers via `flathub.org/api/v2/appstream/<id>` → `.branding`), metainfodescription refresh, per-release `<release>` entries (latest-only, never backfill),diff --git a/CLAUDE.md b/CLAUDE.mdindex e4c5bf887d..8e40a3e712 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -139,7 +139,7 @@ Shared components live in `apps/client/src/widgets/react/` — **always** reuse`apps/desktop` runs server + client in one Electron process; the renderer loads over the `trilium-app://` custom protocol and talks to main only through the preload bridge (`window.electronApi`, typed by `packages/commons/src/lib/electron_api_interface.ts`). The main process bundles to **ESM with code splitting** (`dist/main.mjs` + lazy `chunks/`, via `buildBackend(..., { format: "esm" })`); the preload and `image_worker.cjs` stay CJS. `nodeIntegration` is off, `contextIsolation` is on, `@electron/remote` is gone — never `require("electron")` in client code. Adding an API means interface + `preload.ts` + an `ipcMain` handler in the owning service + a spec. Load the **`developing-electron-desktop` skill** for the recipe, the security model, running/launch errors and testing.### Flathub packaging-`apps/desktop/flatpak/` holds the whole recipe — manifest, `trilium.sh`, `flathub.json`, `.desktop`, metainfo — and `scripts/flatpak/` writes it into the Flathub repo (`update-repo.mts` pins the ref and the pnpm sources, `generate-sources.mts` rebuilds the offline `generated-sources.json`); `.github/workflows/release-flathub.yml` runs both and opens the PR. **Never hand-edit the packaging repo** — the next run overwrites it. The manifest runs the checkout's own `apps/desktop/electron-forge/{flip-fuses,trim-locales}.ts` and `chore:update-build-info --from-commit`, each shared with the forge build, so **a change there lands in both the `.deb`/`.rpm`/Forge flatpak and Flathub** — keep the run-as-script guard and the argument the manifest passes. Load the **`packaging-for-flathub` skill** before touching any of it.+`apps/desktop/flatpak/` holds the whole recipe — manifest, `trilium.sh`, `flathub.json`, `.desktop`, metainfo — and `scripts/flatpak/` writes it into the Flathub repo (`update-repo.mts` pins the ref and the pnpm sources, `generate-sources.mts` rebuilds the offline `generated-sources.json`); `.github/workflows/release-flathub.yml` runs both and opens the PR. **Never hand-edit the packaging repo** — the next run overwrites it. The manifest runs the checkout's own `apps/desktop/electron-forge/{flip-fuses,trim-locales}.ts` and `chore:update-build-info --from-commit`, each shared with the forge build, so **a change there lands in both the `.deb`/`.rpm`/Forge flatpak and Flathub** — keep the run-as-script guard and the argument the manifest passes. The sandboxed data dir is a **review condition**: `trilium.sh` reads `$XDG_DATA_HOME/trilium-data` and the Flathub reviewer struck every grant for the legacy `~/.local/share/trilium-data`, so existing users' notes are unreachable by design until the migration is built — never "fix" that by adding a `--filesystem=` back. Load the **`packaging-for-flathub` skill** before touching any of it.### Standalone (in-browser) app`apps/standalone` runs the client on the page and `@triliumnext/core` — plain JS — in a dedicated Web Worker over `@sqlite.org/sqlite-wasm` persisted in OPFS; a Web Lock elects the one tab that owns the database, which answers its own API calls straight from the worker (`standaloneApi.localFetch`); the service worker forwards other tabs' calls to it and covers what the page still requests. Every core provider has a browser twin in `apps/standalone/src/lightweight/` — **a new provider or Node import in core breaks this build first.** Load the **`developing-standalone` skill** before touching `sw.ts`, `main.ts`, `local-server-worker.ts`, `lightweight/*` or `vite.config.mts`.