From 8aaaf2451ad7eeed27b851a63a0de1b575120e30 Mon Sep 17 00:00:00 2001 From: Youwes09 Date: Sun, 17 May 2026 16:27:57 -0500 Subject: [PATCH] Fix: Added ServerBinary Off & Flatpak Patches --- io.github.moku_project.Moku.yml | 81 +++++++++++++++++-- src-tauri/src/commands/server.rs | 8 +- src-tauri/src/server/conf.rs | 19 +++-- src/App.svelte | 5 +- .../settings/sections/GeneralSettings.svelte | 4 + src/types/settings.ts | 4 +- 6 files changed, 101 insertions(+), 20 deletions(-) diff --git a/io.github.moku_project.Moku.yml b/io.github.moku_project.Moku.yml index 6bb36a3..9a3e20e 100644 --- a/io.github.moku_project.Moku.yml +++ b/io.github.moku_project.Moku.yml @@ -32,6 +32,77 @@ build-options: CARGO_HOME: /run/build/moku/cargo modules: + - name: intltool + buildsystem: autotools + sources: + - type: archive + url: https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz + sha256: 67c74d94196b153b774ab9f89b2fa6c6ba79352407037c8c14d5aeb334e959cd + + - name: libdbusmenu + buildsystem: autotools + build-options: + cflags: -Wno-error + env: + HAVE_VALGRIND_FALSE: '#' + HAVE_VALGRIND_TRUE: '' + config-opts: + - --with-gtk=3 + - --disable-static + - --disable-dumper + - --disable-tests + - --disable-gtk-doc + - --disable-vala + - --disable-introspection + cleanup: + - /include + - /libexec + - /lib/pkgconfig + - /lib/*.la + - /share/doc + - /share/libdbusmenu + - /share/gtk-doc + - /share/gir-1.0 + sources: + - type: archive + url: https://launchpad.net/libdbusmenu/16.04/16.04.0/+download/libdbusmenu-16.04.0.tar.gz + sha256: b9cc4a2acd74509435892823607d966d424bd9ad5d0b00938f27240a1bfa878a + + - name: libayatana-ido + buildsystem: cmake-ninja + config-opts: + - -DENABLE_TESTS=OFF + - -DGSETTINGS_COMPILE=OFF + sources: + - type: git + url: https://github.com/AyatanaIndicators/ayatana-ido.git + tag: 0.10.3 + + - name: libayatana-indicator + buildsystem: cmake-ninja + config-opts: + - -DENABLE_TESTS=OFF + - -DGSETTINGS_COMPILE=OFF + sources: + - type: git + url: https://github.com/AyatanaIndicators/libayatana-indicator.git + tag: 0.9.4 + + - name: libayatana-appindicator + buildsystem: cmake-ninja + config-opts: + - -DENABLE_TESTS=OFF + - -DENABLE_BINDINGS_MONO=OFF + - -DENABLE_BINDINGS_VALA=OFF + - -DGSETTINGS_COMPILE=OFF + sources: + - type: git + url: https://github.com/AyatanaIndicators/libayatana-appindicator.git + tag: 0.5.93 + - type: shell + commands: + - sed -i '/add_subdirectory(docs)/d' CMakeLists.txt + - name: openjdk buildsystem: simple build-commands: @@ -52,9 +123,6 @@ modules: - type: inline dest-filename: catch_abort.c contents: | - // Linux only: - // Attempts to catch SIGTRAP and exit the thread instead of bringing down the whole process - #define _GNU_SOURCE #include #include @@ -117,19 +185,16 @@ modules: DATA_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/Tachidesk" mkdir -p "$DATA_DIR" - # Seed conf on first run if [ ! -f "$DATA_DIR/server.conf" ]; then cp /app/tachidesk/default-conf/server.conf "$DATA_DIR/server.conf" fi - # Force-patch the three keys that cause JCEF/GUI crashes every launch. sed -i \ -e 's|server\.webUIEnabled.*|server.webUIEnabled = false|' \ -e 's|server\.initialOpenInBrowserEnabled.*|server.initialOpenInBrowserEnabled = false|' \ -e 's|server\.systemTrayEnabled.*|server.systemTrayEnabled = false|' \ "$DATA_DIR/server.conf" - # Append keys if absent grep -q 'server\.webUIEnabled' "$DATA_DIR/server.conf" || echo 'server.webUIEnabled = true' >> "$DATA_DIR/server.conf" grep -q 'server\.initialOpenInBrowserEnabled' "$DATA_DIR/server.conf" || echo 'server.initialOpenInBrowserEnabled = false' >> "$DATA_DIR/server.conf" grep -q 'server\.systemTrayEnabled' "$DATA_DIR/server.conf" || echo 'server.systemTrayEnabled = false' >> "$DATA_DIR/server.conf" @@ -166,10 +231,10 @@ modules: CARGO_HOME: /run/build/moku/cargo XDG_DATA_HOME: /run/build/moku/xdg-data TAURI_SKIP_DEVSERVER_CHECK: 'true' - PKG_CONFIG_PATH: /usr/lib/pkgconfig:/usr/share/pkgconfig + PKG_CONFIG_PATH: /usr/lib/pkgconfig:/usr/share/pkgconfig:/app/lib/pkgconfig build-commands: - tar -xzf frontend-dist.tar.gz - - . /usr/lib/sdk/rust-stable/enable.sh && PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig cargo build --release --manifest-path src-tauri/Cargo.toml + - . /usr/lib/sdk/rust-stable/enable.sh && PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig:/app/lib/pkgconfig cargo build --release --manifest-path src-tauri/Cargo.toml - install -Dm755 src-tauri/target/release/moku /app/bin/moku - install -Dm644 packaging/io.github.moku_project.Moku.desktop /app/share/applications/io.github.moku_project.Moku.desktop - install -Dm644 src-tauri/icons/32x32.png /app/share/icons/hicolor/32x32/apps/io.github.moku_project.Moku.png diff --git a/src-tauri/src/commands/server.rs b/src-tauri/src/commands/server.rs index 0dd3341..f999322 100644 --- a/src-tauri/src/commands/server.rs +++ b/src-tauri/src/commands/server.rs @@ -3,7 +3,7 @@ use crate::ServerState; use tauri::Manager; #[tauri::command] -pub fn spawn_server(binary: String, app: tauri::AppHandle) -> Result<(), SpawnError> { +pub fn spawn_server(binary: String, web_ui_enabled: bool, app: tauri::AppHandle) -> Result<(), SpawnError> { { let state = app.state::(); if state.0.lock().unwrap().is_some() { @@ -22,10 +22,10 @@ pub fn spawn_server(binary: String, app: tauri::AppHandle) -> Result<(), SpawnEr server::do_log( &mut log, - &format!("[spawn_server] binary={:?} data_dir={:?}", binary, data_dir), + &format!("[spawn_server] binary={:?} web_ui_enabled={} data_dir={:?}", binary, web_ui_enabled, data_dir), ); - server::conf::seed_server_conf(&data_dir); + server::conf::seed_server_conf(&data_dir, web_ui_enabled); let mut invocation = server::resolve::resolve_server_binary(&binary, &app, &mut log).map_err(|e| { @@ -77,4 +77,4 @@ pub fn spawn_server(binary: String, app: tauri::AppHandle) -> Result<(), SpawnEr pub fn kill_server(app: tauri::AppHandle) -> Result<(), String> { server::kill_tachidesk(&app); Ok(()) -} +} \ No newline at end of file diff --git a/src-tauri/src/server/conf.rs b/src-tauri/src/server/conf.rs index 2e27e51..570bf12 100644 --- a/src-tauri/src/server/conf.rs +++ b/src-tauri/src/server/conf.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; const DEFAULT_SERVER_CONF: &str = r#"server.ip = "127.0.0.1" server.port = 4567 -server.webUIEnabled = true +server.webUIEnabled = false server.initialOpenInBrowserEnabled = false server.systemTrayEnabled = false server.webUIInterface = "browser" @@ -17,7 +17,7 @@ server.maxSourcesInParallel = 6 server.extensionRepos = [] "#; -pub fn seed_server_conf(data_dir: &PathBuf) { +pub fn seed_server_conf(data_dir: &PathBuf, web_ui_enabled: bool) { let conf_path = data_dir.join("server.conf"); if !conf_path.exists() { @@ -25,7 +25,12 @@ pub fn seed_server_conf(data_dir: &PathBuf) { eprintln!("Could not create Suwayomi data dir: {e}"); return; } - if let Err(e) = std::fs::write(&conf_path, DEFAULT_SERVER_CONF) { + let initial = patch_conf_key( + DEFAULT_SERVER_CONF.to_string(), + "server.webUIEnabled", + if web_ui_enabled { "true" } else { "false" }, + ); + if let Err(e) = std::fs::write(&conf_path, initial) { eprintln!("Could not write server.conf: {e}"); } return; @@ -37,7 +42,11 @@ pub fn seed_server_conf(data_dir: &PathBuf) { let patched = patch_conf_key( patch_conf_key( - patch_conf_key(contents, "server.webUIEnabled", "true"), + patch_conf_key( + contents, + "server.webUIEnabled", + if web_ui_enabled { "true" } else { "false" }, + ), "server.initialOpenInBrowserEnabled", "false", ), @@ -70,4 +79,4 @@ fn patch_conf_key(text: String, key: &str, value: &str) -> String { out.push_str(&replacement); out.push('\n'); out -} +} \ No newline at end of file diff --git a/src/App.svelte b/src/App.svelte index 291fb5e..a8f8ec8 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -138,7 +138,10 @@ startProbe(); if (store.settings.autoStartServer) { - invoke("spawn_server", { binary: store.settings.serverBinary }).catch((err: any) => { + invoke("spawn_server", { + binary: store.settings.serverBinary, + webUiEnabled: store.settings.suwayomiWebUI ?? false, + }).catch((err: any) => { if (err?.kind === "NotConfigured") boot.notConfigured = true; else console.warn("Could not start server:", err); }); diff --git a/src/features/settings/sections/GeneralSettings.svelte b/src/features/settings/sections/GeneralSettings.svelte index 491eb24..bc09eca 100644 --- a/src/features/settings/sections/GeneralSettings.svelte +++ b/src/features/settings/sections/GeneralSettings.svelte @@ -51,6 +51,10 @@
Auto-start serverLaunch tachidesk-server when Moku opens
+ diff --git a/src/types/settings.ts b/src/types/settings.ts index 0cc2ca3..3dc7f2b 100644 --- a/src/types/settings.ts +++ b/src/types/settings.ts @@ -92,7 +92,7 @@ export interface Settings { discordRpc: boolean; chapterSortDir: ChapterSortDir; chapterSortMode: ChapterSortMode; chapterPageSize: number; uiZoom: number; compactSidebar: boolean; gpuAcceleration: boolean; - serverUrl: string; serverBinary: string; autoStartServer: boolean; + serverUrl: string; serverBinary: string; autoStartServer: boolean; suwayomiWebUI: boolean; preferredExtensionLang: string; keybinds: Keybinds; idleTimeoutMin?: number; splashCards?: boolean; storageLimitGb: number | null; markReadOnNext: boolean; readerDebounceMs: number; @@ -143,7 +143,7 @@ export const DEFAULT_SETTINGS: Settings = { discordRpc: false, chapterSortDir: "desc", chapterSortMode: "source", chapterPageSize: 25, uiZoom: 1.0, compactSidebar: false, gpuAcceleration: true, - serverUrl: "http://localhost:4567", serverBinary: "", autoStartServer: true, + serverUrl: "http://localhost:4567", serverBinary: "", autoStartServer: true, suwayomiWebUI: false, preferredExtensionLang: "en", keybinds: DEFAULT_KEYBINDS, idleTimeoutMin: 5, splashCards: true, storageLimitGb: null, markReadOnNext: true, readerDebounceMs: 120, autoBookmark: true,