From 3be18b8e5d3dfcbcdf624a4b71f448bc8715f340 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Wed, 10 Jun 2026 22:52:54 -0400 Subject: [PATCH] fix: Windows JSON patch via node, Linux AppImage via APPIMAGE_EXTRACT_AND_RUN Windows: ConvertTo-Json outputs True/False (invalid JSON) and UTF-16 BOM, corrupting tauri.conf.json. Switch to `node -e` which round-trips JSON correctly. Linux: linuxdeploy is itself an AppImage and cannot execute inside Docker without FUSE. APPIMAGE_EXTRACT_AND_RUN=1 makes it self-extract and run as a plain binary instead. Also fix unreachable_code warning in check_for_update. Co-Authored-By: Claude Sonnet 4.6 --- .gitea/workflows/release.yml | 5 ++--- src-tauri/src/lib.rs | 13 ++++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 6cad1a8..bfdb7b5 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -61,9 +61,7 @@ jobs: shell: powershell run: | $ver = '${{ needs.prepare.outputs.version }}' - $d = Get-Content 'src-tauri/tauri.conf.json' -Raw | ConvertFrom-Json - $d.version = $ver - $d | ConvertTo-Json -Depth 100 | Set-Content 'src-tauri/tauri.conf.json' -Encoding UTF8 + node -e "const fs=require('fs');const d=JSON.parse(fs.readFileSync('src-tauri/tauri.conf.json','utf8'));d.version='$ver';fs.writeFileSync('src-tauri/tauri.conf.json',JSON.stringify(d,null,2),'utf8');" - name: Install frontend deps shell: powershell @@ -164,6 +162,7 @@ jobs: TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: '' NODE_OPTIONS: '--max_old_space_size=4096' + APPIMAGE_EXTRACT_AND_RUN: '1' run: npm run tauri -- build --bundles appimage,deb - name: Upload to release diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 21d2d35..952ea9a 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -61,14 +61,13 @@ async fn check_for_update(app: tauri::AppHandle) -> Result { #[cfg(not(any(target_os = "android", target_os = "ios")))] { use tauri_plugin_updater::UpdaterExt; - match app.updater().map_err(|e| e.to_string())?.check().await { - Ok(Some(update)) => { - return Ok(UpdateInfo { available: true, version: Some(update.version) }); - } - Ok(None) => return Ok(UpdateInfo { available: false, version: None }), - Err(e) => return Err(e.to_string()), - } + return match app.updater().map_err(|e| e.to_string())?.check().await { + Ok(Some(update)) => Ok(UpdateInfo { available: true, version: Some(update.version) }), + Ok(None) => Ok(UpdateInfo { available: false, version: None }), + Err(e) => Err(e.to_string()), + }; } + #[cfg(any(target_os = "android", target_os = "ios"))] Ok(UpdateInfo { available: false, version: None }) }