diff --git a/pkgs/by-name/fl/flexoptix-app/allow-no-secret-manager.patch b/pkgs/by-name/fl/flexoptix-app/allow-no-secret-manager.patch new file mode 100644 index 000000000000..30b676d8f403 --- /dev/null +++ b/pkgs/by-name/fl/flexoptix-app/allow-no-secret-manager.patch @@ -0,0 +1,9 @@ +--- app/node_modules/rme-electron/main/fo-storage/models/fo-storage-file.js ++++ app/node_modules/rme-electron/main/fo-storage/models/fo-storage-file.js +@@ -25,6 +25,7 @@ + if (!this.#isPlainObject(initialContent)) { + throw new Error("Content must be a plain object"); + } ++ safeStorage.setUsePlainTextEncryption(true); + this.#content = initialContent; + } diff --git a/pkgs/by-name/fl/flexoptix-app/disable-autoupdate.patch b/pkgs/by-name/fl/flexoptix-app/disable-autoupdate.patch index d71133951e72..c3b2bdec8185 100644 --- a/pkgs/by-name/fl/flexoptix-app/disable-autoupdate.patch +++ b/pkgs/by-name/fl/flexoptix-app/disable-autoupdate.patch @@ -1,16 +1,12 @@ ---- app/electron/jsComponents/mainWindowEvents.js 2024-02-18 12:53:41.115773007 -0500 -+++ app/electron/jsComponents/mainWindowEvents.js2 2024-02-18 23:22:20.003280203 -0500 -@@ -128,7 +128,12 @@ - - if (app.isPackaged) { - global.mainWindow.webContents.once("did-finish-load", function () { -- autoUpdater.checkForUpdates(); -+ global.mainWindow.loadURL( -+ url.format({ -+ ...global.APPLICATION_URL_OBJECT, -+ slashes: true, -+ }), -+ ); - }); - } else { - global.mainWindow.webContents.openDevTools(); +--- app/node_modules/electron-updater/out/AppUpdater.js ++++ app/node_modules/electron-updater/out/AppUpdater.js +@@ -211,6 +211,9 @@ + * Asks the server whether there is an update. + */ + checkForUpdates() { ++ this.emit("update-not-available", null); ++ return true; ++ + if (!this.isUpdaterActive()) { + return Promise.resolve(null); + } diff --git a/pkgs/by-name/fl/flexoptix-app/package.nix b/pkgs/by-name/fl/flexoptix-app/package.nix index 402f7cc52d0c..d37ec9824bff 100644 --- a/pkgs/by-name/fl/flexoptix-app/package.nix +++ b/pkgs/by-name/fl/flexoptix-app/package.nix @@ -3,29 +3,42 @@ appimageTools, fetchurl, asar, + python3, }: let pname = "flexoptix-app"; - version = "5.21.2-latest"; + version = "5.48.0-latest"; src = fetchurl { name = "${pname}-${version}.AppImage"; url = "https://flexbox.reconfigure.me/download/electron/linux/x64/FLEXOPTIX%20App.${version}.AppImage"; - hash = "sha256-BnNRwD09CE1EZDg3Hn3khN4FZ8Hj5LLAunk+NKU5BJo="; + hash = "sha256-VSGfExus+4dDef6V1ZEATMBVCIb0JS459+yolx5sg3c="; }; udevRules = fetchurl { url = "https://www.flexoptix.net/static/frontend/Flexoptix/default/en_US/files/99-tprogrammer.rules"; - hash = "sha256-faowRYdrk88WUpOpaEfedzybBgxVRZhvAaYP9HAuzAE="; + hash = "sha256-/1ZtJT+1IMyYqw3N0bVJ/T3vbmex169lzx+SlY5WsnA="; }; appimageContents = (appimageTools.extract { inherit pname version src; }).overrideAttrs (oA: { buildCommand = '' ${oA.buildCommand} - # Get rid of the autoupdater + # Remove left-over node-gyp executable symlinks + # https://github.com/nodejs/node-gyp/issues/2713 + find $out/ -type l -name python3 -exec ln -sf ${python3.interpreter} {} \; + + # Extract app to make it patchable ${asar}/bin/asar extract $out/resources/app.asar app + + # Fix app crash when none of these secret managers is available: https://www.electronjs.org/docs/latest/api/safe-storage#safestoragegetselectedstoragebackend-linux + patch -p0 < ${./allow-no-secret-manager.patch} + # Get rid of the autoupdater patch -p0 < ${./disable-autoupdate.patch} + + # Makes debugging easier: cp -r app $out/_app + + # Repackage ${asar}/bin/asar pack app $out/resources/app.asar ''; }); @@ -42,7 +55,10 @@ appimageTools.wrapAppImage { install -Dm444 ${appimageContents}/flexoptix-app.desktop -t $out/share/applications install -Dm444 ${appimageContents}/flexoptix-app.png -t $out/share/pixmaps substituteInPlace $out/share/applications/flexoptix-app.desktop \ - --replace 'Exec=AppRun' "Exec=$out/bin/${pname} --" + --replace-fail 'Exec=AppRun' "Exec=$out/bin/${pname} --" + + # For debugging + [[ -e ${appimageContents}/_app ]] && ln -s ${appimageContents}/_app $out # Add udev rules mkdir -p $out/lib/udev/rules.d