Skip to content

add(tldraw offline): package the official Linux build as extra-data - #131

Merged
jing2uo merged 1 commit into
mainfrom
add/com.tldraw.Offline
Jul 19, 2026
Merged

jing2uo merged 1 commit into
mainfrom
add/com.tldraw.Offline

Conversation

@jing2uo

@jing2uo jing2uo commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Closes #130.

tldraw offline is an Electron whiteboard and diagramming app built on tldraw's infinite canvas. There are no accounts and no servers — documents are portable .tldraw files on disk and the app works without an internet connection. It is not on Flathub, and upstream publishes an official amd64 .deb on every release.

Packaging

Standard registry Electron pattern:

  • org.electronjs.Electron2.BaseApp for zypak, so Chromium keeps its internal sandbox instead of running --no-sandbox.
  • The vendor .deb (v1.11.0) is fetched as pinned extra-data from the upstream release, straight from github.com/tldraw/tldraw-offline.
  • apply_extra unpacks the .deb data member with bsdtar (--no-same-owner, per the system-install path) and stages the app tree. Upstream puts it under /opt/tldraw offline — the directory is renamed to a space-free /app/extra/tldraw-offline, and nothing inside it is touched, including the @tldesktop binary name.
  • The wrapper execs that binary through zypak-wrapper with --ozone-platform-hint=auto, and defensively unsets ELECTRON_RUN_AS_NODE.

The desktop file, icons, AppStream metainfo and a shared-mime-info file for application/x-tldraw are shipped at build time, since Flatpak exports those from the build rather than from extra-data fetched later on the user's machine. The MIME file mirrors the definition upstream ships in the .deb, merged into one <mime-type> so both the .tldraw and .tldr globs live under a single type.

resolve-update.sh matches the version-independent asset name tldraw-offline-linux-amd64.deb exactly and re-checks the resolved URL against the expected release path, so the AppImages, the macOS/Windows builds and the electron-updater latest*.yml metadata are all excluded.

Sandbox

Granted:

Permission Why
--share=ipc, --socket=wayland, --socket=fallback-x11, --device=dri Electron/Chromium GPU-composited canvas
--share=network the update check the app runs at startup and from its menu; nothing else — the app is offline by design
--filesystem=xdg-documents a document editor whose whole point is .tldraw files on disk: saving, reopening from the Home screen's recent list, and keeping working copies all need to survive restarts
--unset-env=ELECTRON_RUN_AS_NODE reaches zypak's spawned zygote children, which the wrapper's own unset cannot

--filesystem=xdg-documents is the narrowest grant that makes the core feature work; the rest of $HOME stays invisible. Files kept elsewhere go through the desktop portal's file chooser, and files passed on the command line arrive through the document portal rather than as raw host paths — the .desktop Exec ends in %U, so flatpak exports it with --file-forwarding.

Not granted, documented as opt-in flatpak override commands in the metainfo:

  • --filesystem=home — for .tldraw files kept outside ~/Documents, or to let a local coding agent reach the same paths the app does
  • --socket=pulseaudio — audio in media embedded on a canvas

No sandbox-escape permission is used, so policy.dangerous_permissions is empty.

Note for reviewers

.tldraw files can embed document scripts that run when the file is opened, and tldraw offline can be connected to a local coding agent that reads and edits documents. That is upstream's designed behavior, not something packaging adds — the payload is the vendor's own build, unmodified. It is called out in the metainfo description so it shows on the app page. The default sandbox keeps both confined to ~/Documents plus whatever the user picks through the portal.

Upstream is closed source ("tldraw offline is not open source. All rights reserved."), which policy.proprietary: true and the metainfo project_license reflect.

Testing

  • node scripts/read-descriptor.mjs and scripts/audit-descriptor.mjs — clean
  • ./scripts/publish.sh --verify com.tldraw.Offline — builds and installs from the signed local repo
  • ./scripts/check-apply-extra.sh com.tldraw.Offline — passes the system-install path (uid 0, all capabilities dropped, offline)
  • ./tests/run-tests.sh — 16/16 pass; ./scripts/check-links.sh com.tldraw.Offline — all links OK
  • Installed from the built repo and launched: starts under zypak with its internal sandbox intact, renders the home screen, and the startup update check works. Drawing on a new canvas, saving a .tldraw file and reopening it were exercised by hand and behave normally.

Not exercised: the arm64 build (upstream ships arm64 as an AppImage only, which is not an accepted artifact, so this package is only-arches: x86_64).

Requested in #130. tldraw offline is an Electron whiteboard/diagramming app
that stores documents as portable .tldraw files and works without a network
connection. It is not on Flathub and upstream ships an official amd64 .deb.

Packaging follows the registry's Electron pattern: the Electron base app for
zypak (so Chromium keeps its internal sandbox), the vendor .deb fetched as
pinned extra-data and unpacked by apply_extra, and a wrapper that execs the
upstream binary unmodified. The .deb stages the app under "/opt/tldraw
offline"; apply_extra renames only that directory, to a space-free path, and
leaves its contents — including the `@tldesktop` binary name — untouched.

The desktop file, icons, AppStream metainfo and a shared-mime-info file for
application/x-tldraw are shipped at build time, since Flatpak exports those
from the build rather than from extra-data fetched later on the user's machine.

Sandbox: display, GPU, network (for the startup update check) and
--filesystem=xdg-documents, which is what a document editor needs to save and
reopen .tldraw files across restarts. The rest of $HOME is not granted; files
kept elsewhere go through the portal file chooser, and .tldraw files opened
from a file manager arrive through the document portal (the Exec ends in %U,
so flatpak exports it with --file-forwarding). --filesystem=home and
--socket=pulseaudio are documented as opt-in overrides in the metainfo.

Verified locally: publish.sh --verify builds and installs from the signed
local repo, check-apply-extra.sh passes the system-install path (root, no
capabilities), and the app launches under zypak and renders its home screen.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@jing2uo
jing2uo merged commit 9e1b80d into main Jul 19, 2026
@jing2uo
jing2uo deleted the add/com.tldraw.Offline branch July 19, 2026 03:03
jing2uo pushed a commit that referenced this pull request Oct 11, 2026
131 of the 154 resolvers reach the GitHub API and every one of them already
reads GITHUB_TOKEN, but neither workflow step that runs check-updates.sh sets
it, so the calls go out anonymously against a 60-per-hour per-IP budget shared
with everything else on the runner's egress address. A full sweep needs 131.

In update-check #131 the 403s begin at app 47 of 154 and from there every
resolver that reaches the API fails, 89 in all; the 19 that still resolve are
the ones that never call it. None of the 89 are held back, so they keep their
current pins, stay out of the held-back alert, and the run goes green.
jing2uo added a commit that referenced this pull request Oct 11, 2026
A resolver or pin rewrite that failed only logged a warning: the app kept its
pin, was in neither `changed` nor `held`, and the run went green. Update-check
#131 lost 89 apps to the GitHub API rate limit that way without anyone seeing.

check-updates.sh now appends each failure to $FAILED_OUT with its last stderr
line. update-check turns that list into a single ci-alert issue for the whole
batch, rewritten every run (new `ci-alert.sh sync`) so it always shows that
day's failures and they can be fixed together in one PR; it closes once a
sweep finishes with none. The run also goes red on resolver failures, like it
already does for held-back pins.
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.

Add tldraw offline desktop app to the repo

1 participant