mirror of
https://github.com/readest/readest.git
synced 2026-11-29 19:02:28 +00:00
* fix(tts): play local AAC narration natively on Linux Decode AAC-LC/ALAC MP4 narration with Symphonia 0.6.1 and send PCM to CPAL, with SoundTouch preserving pitch when playback speed changes. Read stored EPUB entries as byte windows and DEFLATE entries through a bounded in-memory checkpoint index, without extracting audio to cache. Reuse the native narration clock and controls; retain browser playback for remote audio and local MP3/Ogg/Opus/WebM sources. Cover source integrity, exact seeks and MP4 edit timing, bounded output, audible playback position, ordered controls and cancellation of pending loads. Run the native plugin and lifecycle regressions in PR CI. Regression evidence: without the Linux source-descriptor change, "hands Linux the raw compressed ZIP entry without reading its audio bytes" fails because getMediaSource returns null instead of the path and raw ZIP entry. Transport and device-stream lifecycle regressions were also verified to fail before their corresponding fixes. Verified on current origin/main: full Vitest suite (14687 passed, 16 skipped), lint, format check, web build, Rust formatting and CEF Clippy with warnings denied. CEF unit tests: 201 app + 24 plugin tests passed; 3 transport/device-stream lifecycle regressions passed. Nix cargoDeps realization and actionlint passed. Full Nix app build and mobile device tests not run. Linux CEF runtime with Symphonia 0.6.1: captured audible AAC, verified forward/backward seeks, rate, pause/frozen clock, abort, and compressed EPUB playback through all three paragraph highlights to completion. No reporter EPUB was supplied; used generated narration fixtures. One earlier app run exited SIGBUS during a shared-target rebuild; cause unconfirmed, fresh launch after checks passed the sequence. Reported by DeathStroke19891 on GitHub. Fixes #7084. Co-Authored-By: Claude Code <noreply@anthropic.com> * fix(tts): enqueue Linux controls before async dispatch Tauri schedules async command invocations independently, so pause/resume could reach the Linux worker in reverse order even when blocking reply waiters were kept separate. Dispatch Linux playout_control directly from the synchronous plugin handler, then resolve its worker reply off-thread. Retain the same IPC payload, ACL parsing, asset scope and non-Linux paths. This also allows abort to cancel a pending load without waiting for its reply, which a frontend promise chain would delay. Regression evidence: reverse the first polls of the old command futures and the ordering assertion fails with ["resume", "pause"] instead of ["pause", "resume"]. The updated production-handler regression asserts pause/resume/load/abort enqueue before any response future is polled, then runs response tasks and blocking waiters in reverse order. Verified Rust formatting, CEF Clippy with warnings denied, 201 app and 24 plugin unit tests, 3 lifecycle regressions, and a rebuilt CEF app. Runtime: 40 rapid pause/resume cycles preserved final state, pause froze the clock, and abort canceled a 226 MB compressed recording load in about 19 ms. Invalid payload and out-of-scope path rejections passed. Independent review verified ACL handling and non-Linux routing. Frontend checks are rerun by the repository's pre-push hook. Co-Authored-By: Claude Code <noreply@anthropic.com> * refactor(tts): hide narration platforms (owner: remove the linux flag) Move native source selection and backend capabilities into NativeNarrationPlayer. MediaOverlayClient retains one native flag and uses streaming, queueing, and cancellation capabilities without OS checks. Preserve local ZIP playback, browser fallbacks, and mobile staging. Validation: 93 focused tests passed; full Vitest suite passed 1,220 files and 14,691 tests (4 files and 16 tests skipped). TypeScript, Biome lint, format checking, and git diff --check passed. Lint reports one existing informational diagnostic in nativePageTurn.ts. New loadSource tests fail before delegation exists and pass afterward. In an isolated Linux CEF app, compressed AAC playback advanced through all three paragraph highlights using the native clock. Mobile device checks were not run. Co-Authored-By: Claude Code <noreply@anthropic.com> * fix(tts): finish canceled narration loads without errors A native load can be canceled independently of the speak signal. Suppress load failures when either signal was aborted, retaining the original playback signal across invalidation so Rust cancellation errors are also recognized. Other load failures still yield playback errors. Validation: eight regression cases fail without this guard, yielding an error instead of completing the generator. All 95 focused native/client/ player tests pass with the fix, including genuine load failures. TypeScript, Biome lint and formatting, and git diff --check pass. In isolated Linux CEF, stopping a large compressed recording during loading closes the player, leaves native playback stopped, and logs no playback error. Mobile device checks were not run. The pre-push hook runs the full frontend suite. Co-Authored-By: Claude Code <noreply@anthropic.com> --------- Co-authored-by: Claude Code <noreply@anthropic.com>
229 lines
8 KiB
Nix
229 lines
8 KiB
Nix
{
|
|
description = "Readest development environment";
|
|
|
|
# Points `nix run`/`nix build` at the project's public Cachix cache so users
|
|
# do not compile the Rust/Tauri stack and webkitgtk from source. Nix ignores
|
|
# this for non-trusted users and otherwise prompts for consent, so the README
|
|
# also documents `cachix use readest` as the permanent opt-in.
|
|
nixConfig = {
|
|
extra-substituters = [ "https://readest.cachix.org" ];
|
|
extra-trusted-public-keys = [
|
|
"readest.cachix.org-1:KvKAePcZZCZB8ytFIAOGdgN3VRdmFHGRMHqMVckbt5c="
|
|
];
|
|
};
|
|
|
|
inputs = {
|
|
self.submodules = true;
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
android = {
|
|
url = "github:tadfisher/android-nixpkgs/stable";
|
|
};
|
|
fenix = {
|
|
url = "github:nix-community/fenix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, android, fenix }:
|
|
flake-utils.lib.eachSystem [
|
|
"x86_64-linux"
|
|
"aarch64-darwin"
|
|
]
|
|
(system:
|
|
let
|
|
inherit (nixpkgs) lib;
|
|
inherit (pkgs.lib) optionals;
|
|
inherit (pkgs.stdenv) isDarwin;
|
|
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
config.allowUnfree = true;
|
|
overlays = [ fenix.overlays.default ];
|
|
};
|
|
|
|
linuxDependencies = pkgs.callPackage ./nix/dependencies.nix { };
|
|
|
|
# ABI of the Android 34 emulator image. avdmanager only accepts an
|
|
# image that is installed in the SDK, and the emulator only runs
|
|
# images that match the host CPU, so both the SDK package list and
|
|
# the `avdmanager create avd -k` path derive from this one value.
|
|
androidAbi = if pkgs.stdenv.hostPlatform.isAarch64 then "arm64-v8a" else "x86_64";
|
|
# android-nixpkgs spells the x86_64 ABI as `x86-64` in attribute names.
|
|
androidImageSuffix = lib.replaceStrings [ "_" ] [ "-" ] androidAbi;
|
|
|
|
# Match CI's stable compiler. Older rustix releases probe internal
|
|
# compiler attributes that recent nightly toolchains have removed.
|
|
toolchain = with pkgs.fenix.stable; [
|
|
cargo
|
|
clippy
|
|
rust-src
|
|
rustc
|
|
rustfmt
|
|
];
|
|
|
|
commonNativeBuildInupts = with pkgs; [
|
|
pnpm
|
|
nodejs_24
|
|
clang
|
|
rust-analyzer-nightly
|
|
pkg-config
|
|
xdg-utils
|
|
patchelf
|
|
wrapGAppsHook4
|
|
playwright-driver.browsers
|
|
self.formatter.${pkgs.stdenv.hostPlatform.system}
|
|
] ++ optionals (!isDarwin) [ rustPlatform.bindgenHook ];
|
|
|
|
commonBuildInputs = with pkgs; [
|
|
at-spi2-atk
|
|
atkmm
|
|
cairo
|
|
fontconfig
|
|
freetype
|
|
gdk-pixbuf
|
|
glib
|
|
gtk3
|
|
harfbuzz
|
|
librsvg
|
|
libsoup_3
|
|
openssl
|
|
pango
|
|
zlib
|
|
|
|
gst_all_1.gstreamer
|
|
gst_all_1.gst-plugins-base
|
|
gst_all_1.gst-plugins-good
|
|
gst_all_1.gst-plugins-bad
|
|
] ++ (optionals (!isDarwin) (
|
|
[ webkitgtk_4_1 ]
|
|
# Expose CEF and dynamically loaded X11 libraries through the
|
|
# shell's LD_LIBRARY_PATH, using the same lists as the package.
|
|
++ lib.unique (linuxDependencies.cef ++ linuxDependencies.x11)
|
|
)) ++ (optionals isDarwin [
|
|
darwin.libiconv
|
|
]);
|
|
|
|
mkCommonShell =
|
|
{ name
|
|
, postInit ? ""
|
|
, extraNativeBuildInputs ? [ ]
|
|
, extraTargets ? [ ]
|
|
, extraEnv ? { }
|
|
}:
|
|
pkgs.mkShell rec {
|
|
inherit name;
|
|
|
|
nativeBuildInputs = commonNativeBuildInupts ++ extraNativeBuildInputs;
|
|
buildInputs = commonBuildInputs ++ [
|
|
(
|
|
with pkgs.fenix;
|
|
combine [
|
|
toolchain
|
|
extraTargets
|
|
]
|
|
)
|
|
];
|
|
|
|
env = {
|
|
GDK_BACKEND = "x11";
|
|
LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
|
|
|
|
PLAYWRIGHT_BROWSERS_PATH = pkgs.playwright-driver.browsers;
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = 1;
|
|
PLAYWRIGHT_HOST_PLATFORM_OVERRIDE = "ubuntu-24.04";
|
|
} // extraEnv;
|
|
|
|
shellHook = ''
|
|
git submodule update --init --recursive
|
|
pnpm install
|
|
|
|
${postInit}
|
|
'';
|
|
};
|
|
in
|
|
{
|
|
packages = {
|
|
android-sdk = android.sdk.${system} (sdkPkgs: with sdkPkgs; [
|
|
build-tools-36-0-0
|
|
build-tools-35-0-0
|
|
build-tools-34-0-0
|
|
cmdline-tools-latest
|
|
emulator
|
|
platform-tools
|
|
platforms-android-36
|
|
platforms-android-35
|
|
platforms-android-34
|
|
sdkPkgs."system-images-android-34-google-apis-${androidImageSuffix}"
|
|
sdkPkgs."system-images-android-34-google-apis-playstore-${androidImageSuffix}"
|
|
]);
|
|
} // lib.optionalAttrs (!isDarwin) {
|
|
default = pkgs.callPackage ./nix/package.nix { };
|
|
};
|
|
|
|
devShells = {
|
|
default = mkCommonShell {
|
|
name = "readest-dev";
|
|
};
|
|
|
|
android =
|
|
let
|
|
android-sdk = self.packages.${system}.android-sdk;
|
|
in
|
|
mkCommonShell
|
|
rec {
|
|
name = "readest-android";
|
|
postInit = ''
|
|
rm -rf apps/readest-app/src-tauri/gen/android
|
|
pnpm tauri android init
|
|
git checkout apps/readest-app/src-tauri/gen/android
|
|
pnpm tauri icon ../../data/icons/readest-book.png
|
|
|
|
if [ ! -d "$ANDROID_AVD_HOME/${name}.avd" ]; then
|
|
avdmanager create avd \
|
|
-n ${name} \
|
|
-k "system-images;android-34;google_apis;${androidAbi}" \
|
|
-d "pixel" \
|
|
--force
|
|
fi
|
|
'';
|
|
extraTargets = with pkgs.fenix.targets; [
|
|
aarch64-linux-android.stable.rust-std
|
|
armv7-linux-androideabi.stable.rust-std
|
|
i686-linux-android.stable.rust-std
|
|
x86_64-linux-android.stable.rust-std
|
|
];
|
|
extraNativeBuildInputs = [
|
|
android-sdk
|
|
pkgs.gradle
|
|
pkgs.jdk
|
|
];
|
|
extraEnv = {
|
|
ANDROID_HOME = "${android-sdk}/share/android-sdk";
|
|
ANDROID_SDK_ROOT = "${android-sdk}/share/android-sdk";
|
|
NDK_HOME = "${android-sdk}/share/android-sdk/ndk/26.1.10909125";
|
|
JAVA_HOME = pkgs.jdk.home;
|
|
ANDROID_AVD_HOME = "$XDG_CONFIG_HOME/.android/avd";
|
|
};
|
|
};
|
|
} // lib.optionalAttrs isDarwin {
|
|
ios = mkCommonShell {
|
|
name = "readest-ios";
|
|
extraNativeBuildInputs = [ pkgs.cocoapods ];
|
|
};
|
|
};
|
|
|
|
formatter = pkgs.nixpkgs-fmt;
|
|
|
|
# Deliberately no `checks.build`. `nix flake check` builds everything
|
|
# in `checks`, so pointing it at packages.default turned the PR check
|
|
# into a full release build: cargo vendor, a production Next.js build,
|
|
# and a cold release compile of the whole Tauri tree, with no sccache
|
|
# or rust-cache available inside the nix sandbox. That ran ~45 min per
|
|
# PR. The flake outputs are still evaluated across systems here, which
|
|
# catches eval errors, and `nix build` in nix-build.yml does the real
|
|
# build on main and pushes the result to the binary cache.
|
|
checks = { };
|
|
});
|
|
|
|
}
|