Commit graph

3 commits

Author SHA1 Message Date
Huang Xin
2ce0522743
chore(linux): catch up the CEF runtime with upstream feat/cef, closes #6397 (#6487)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
Build with Nix / tests (push) Waiting to run
PR checks / nix_flake_check (push) Waiting to run
PR checks / rust_lint (push) Waiting to run
PR checks / koplugin_rust_lint (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / test_web_app (1) (push) Waiting to run
PR checks / test_web_app (2) (push) Waiting to run
PR checks / test_extensions (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
2026-09-30 04:07:58 +08:00
Huang Xin
010adb4879
fix(ci): bundle the audio libraries the CEF AppImage dlopens (#6108)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
Build with Nix / tests (push) Waiting to run
PR checks / nix_flake_check (push) Waiting to run
PR checks / rust_lint (push) Waiting to run
PR checks / koplugin_rust_lint (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / test_web_app (1) (push) Waiting to run
PR checks / test_web_app (2) (push) Waiting to run
PR checks / test_extensions (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
* fix(ci): bundle the audio libraries the CEF AppImage dlopens

TTS runs to completion in the AppImage but nothing is audible: Chromium
reaches its audio backend through dlopen, and the bundle carries none of
it. libpulse.so.0 resolves to the host copy and fails against the
bundled glibc 2.35 (host libpulsecommon needs GLIBC_2.38), and the ALSA
fallback dies the same way — its `default` PCM is a config hook that
loads the host's libasound_module_conf_pulse.so, so snd_pcm_open()
returns "Unknown PCM default" and only a raw hw: device opens, which
Chromium will not use. libspeechd.so.2 fails identically, leaving the
Web Speech engine with no system voices.

Stage all three through the same appimage.files channel as the NSS
modules (#6101). quick-sharun then pulls the rest of the closure
(libsndfile, FLAC, vorbis, opus, ogg, asyncns...) from the runner by ldd.
libpulse keeps its private half in <triple>/pulseaudio/ and finds it by
RUNPATH, which points at the host directory: verified that the private
lib is deployed to lib/pulseaudio/ and that lib.path gains `+/pulseaudio`
so sharun's library path wins over the RUNPATH, and the guard now checks
both.

Verified against the shipped 0.12.6-2026090706 bundle on glibc 2.41: in
its runtime environment dlopen of libpulse/libpipewire/libspeechd fails
and ALSA has no usable PCM, while staging these libraries makes dlopen
succeed and a tone play through PipeWire's PulseAudio server.

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

* fix(linux): stop the AppImage asking for a root password (#6110)

Every new AppImage pops a modal on first launch and asks for the root
password through pkexec. That is the bundler's fix-namespaces.hook: on
distros that restrict unprivileged user namespaces (Ubuntu 24.04+) it
offers to install an AppArmor profile granting `userns`, and since the
profile it writes is keyed to the AppImage's exact path, every nightly
asks again.

Readest never needs that capability. tauri-runtime-cef sets
CefSettings.no_sandbox unless its `sandbox` feature is enabled, and this
build compiles it without: every Chromium child of the shipped AppImage
runs `--type=zygote --no-sandbox`, and the app starts fine on a machine
where `unshare -Urm` is denied and no profile is installed. The hook is
boilerplate for Chromium apps that do sandbox; here it buys a root
prompt and nothing else.

Ship an AppRun hook that sorts ahead of it and stubs the two helpers it
prompts through — both come from AppRun.lib and have no other callers in
the bundle, so the rest of that hook still runs, it just cannot reach
the user. Verified against the shipped 0.12.6-2026090706 bundle: stock
hooks block startup on the dialog (three lines of log, app never comes
up), with this hook the app starts normally and no zenity or pkexec
process appears. Also verified in a jammy container that a file shipped
through appimage.files survives quick-sharun and lands in bin/ ahead of
the bundler's own hooks.

The entry lives in tauri.conf.json rather than the workflows so local
Linux builds get it too; the CI staging step now merges into that map
instead of replacing it.

This leaves the AppImage exactly as sandboxed as it is today, which is
also what the WebKitGTK builds before it were — Tauri never enabled
WebKit's sandbox either. Sandboxing the renderer on Linux is a separate
change: it needs the CEF `sandbox` feature plus /etc/apparmor.d/readest
shipped in deb/rpm, and this hook would then have to go.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

* ci: pin down the quick-sharun regression behind the AppImage staging

The staging comment blamed drift — a fork "~1100 lines behind upstream"
that "expands its deployment array without eval". The gap is real but
not the cause. The fork's HEAD, FabianLars/Anylinux-AppImages@3e280d1b
"fix handling of spaces in input paths", is a deliberate one-line change:

    eval set -- "$TO_DEPLOY_ARRAY" "$@"   ->   set -- $TO_DEPLOY_ARRAY "$@"

Upstream's line really does split positional paths on spaces, and tauri
names the AppDir after the product, so the change fixed something. But
the array entries come single-quoted from _save_array, so without the
eval each keeps its literal quotes, fails `[ -f ]`, and every DEPLOY_*
extra is silently skipped. Measured in a dash one-liner: upstream splits
"My App/libfoo.so" into two arguments, the fork keeps the array entry as
'/path/libextra.so' quotes and all, and quoting the positional args
through the same helper — eval set -- "$TO_DEPLOY_ARRAY"
"$(_save_array "$@")" — keeps both.

Record that, and the two things upstream review pointed out: pulse is
already implied by DEPLOY_CHROMIUM through DEPLOY_PIPEWIRE, so the
libpulse entry turns redundant the moment the fork's main is fixed (the
CLI re-fetches it on every build), and libpipewire is not needed for
audio at all, only for the screen-share portal, so it stays out.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* ci(linux): build the CEF tauri CLI from readest/tauri with pkgforge pinned

The published @tauri-apps/cli-cef (3.0.0-alpha.26) bundles the AppImage
with a fork of quick-sharun whose deployment array is broken, and it
re-downloads that fork on every build with no way to point it anywhere
else - no env var, no mirror (TAURI_BUNDLER_TOOLS_GITHUB_MIRROR only
rewrites github.com URLs), and no cache seeding, since the guard that
made the pre-#6074 seed work is commented out.

Build the CLI on the Linux legs from readest/tauri@c62e9f90 instead, the
way the workflow did until #6074: there sharun_cef.rs fetches
pkgforge-dev/Anylinux-AppImages at facb95e8 verified by SHA-256 (the
revision tauri-apps/tauri#12491 pins), runs the tooling with bash and
streamed output, passes the deploy list as arguments, keeps whitespace
out of the AppDir name, and adds no fix-namespaces hook. Pinned to a
rev so a release cannot change behaviour under us; rust-cache keeps
~/.cargo/bin and a marker file skips the rebuild while the pin holds.
scripts/tauri.mjs runs `cargo tauri` when TAURI_CEF_CARGO=1, with the
same command line as the npm CLI.

STRACE_MODE stays off in this step; the hang it works around is fixed
by the bash/streamed-output change, but lifting it is its own change.
The hand-staged NSS and audio entries stay too, until a nightly built
this way confirms the tooling deploys them itself.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* ci: trim the AppImage comments to the essentials

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-07 12:12:02 +02:00
Huang Xin
655c72ad5a
feat(linux): ship Readest on the tauri CEF runtime (#6074)
* feat(linux): build and ship Readest on the tauri CEF runtime

Linux now builds against upstream tauri `feat/cef` (git) and the plugins on
plugins-workspace `feat/cef`, while macOS/Windows/mobile keep the readest
fork untouched:

- `pnpm tauri:cef dev|build` (scripts/tauri-cef.mjs) runs @tauri-apps/cli-cef
  with `--features cef`, cargo `--no-default-features` and the Linux-only
  `[patch.crates-io]` in src-tauri/.cargo/cef.toml, swapping the committed
  Cargo.cef.lock in for the run so Cargo.lock stays in the fork state.
- The fork crates are no longer workspace members (a member clashes on
  `links` with the git copy); the tauri-plugins fork carried no changes and
  is removed, tauri-plugin-fs comes from crates.io at 2.5.1.
- App: `cef = ["tauri/cef"]` (the fork gets a no-op stub), explicit runtime
  type, `cef_entry_point`, `--no-first-run` for CEF, commands generic over
  the runtime, xdg-portal dialogs on Linux (rfd's GTK thread crashes CEF),
  rangefile reads and pointer-driven move/resize on the Linux CEF runtime,
  Chromium reported in the About dialog, deb/rpm depend on libwebkit2gtk
  while plugins still pull the wry runtime.
- Build-generated permission files are untracked; turso registers `batch`.
- CI Linux legs use `pnpm tauri:cef`.

Submodules: packages/tauri -> feat/cef-feature-stub, tauri-plugin-turso ->
fix/register-batch-command (both need pushing).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* feat(linux): let the CEF wrapper run an unpacked tauri CLI for offline builds

Flatpak builds have no network, so `TAURI_CEF_CLI` points scripts/tauri-cef.mjs
at an unpacked copy of @tauri-apps/cli-cef instead of `pnpm dlx`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* chore(linux): take the CEF stack from the readest forks

- src-tauri/.cargo/cef.toml: tauri and the plugins now come from the readest
  forks' feat/cef branches (upstream feat/cef plus the DevTools-close fix in
  tauri-runtime-cef); Cargo.cef.lock re-resolved against them.
- tauri-plugin-turso: point at main, which merged the batch command fix.
- CI: STRACE_MODE=0 for the Linux legs so the CEF AppImage bundler
  (quick-sharun) does not launch the app under Xvfb and hang (#4906).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* feat(linux): make the CEF runtime the default tauri build on Linux

`pnpm tauri` now goes through scripts/tauri.mjs (the former tauri-cef.mjs):
on Linux its dev, build and bundle commands run the feat/cef tauri CLI
with the CEF feature, cargo config and Cargo.cef.lock swap, and every
other platform or command passes straight through to @tauri-apps/cli.
The separate `tauri:cef` script goes away, so the release and nightly
workflows, the local Linux build script and the docs use plain
`pnpm tauri build` again.

The tauri webdriver harness (scripts/test-tauri.sh) still calls the
`tauri` binary directly and keeps the wry runtime on Linux, since
tauri-driver needs WebKitWebDriver.

Cargo.cef.lock picks up the quick-xml 0.41 bump from main.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* chore(nix): refresh cargoHash for the reshaped Cargo.lock

Dropping the packages/tauri-plugins submodule and the tauri-plugin-fs
path patch changed the vendored cargo dependency set, so the Nix
fixed-output hash moves to the value the nix-deps-check job reported.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(linux): harden the CEF wrapper and pointer window drag

Review follow-ups on the CEF runtime work:

- scripts/tauri.mjs parks the wry Cargo.lock in Cargo.lock.wry, created
  exclusively, so two CEF commands in one checkout cannot swap lockfiles
  over each other, and a killed run leaves an obvious file to move back.
- The CEF runtime alias, entry point and runtime attributes are gated on
  Linux as well as the `cef` feature; elsewhere the feature is a no-op.
- Pointer-driven window move/resize applies the last pointer delta when
  the button is released before the pending animation frame, and does
  not start tracking when the button was already released while the
  window state was being read.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-05 20:09:06 +02:00