silverfort-client: 3.7.5 -> 3.7.6

Looks like Silverfort obfuscates their client code now, which makes
patching a bit harder. Let's switch to substituteInPlace instead of a
using patch file and upgrade to `3.7.6`.

Signed-off-by: David Wronek <david.wronek@mainlining.org>
This commit is contained in:
David Wronek 2026-02-18 19:33:37 +01:00
parent 958556a89c
commit 6efbdd93ed
2 changed files with 13 additions and 29 deletions

View file

@ -1,17 +0,0 @@
diff --git a/build/electron/main.js b/build/electron/main.js
index ca36c4b..dbea8c6 100644
--- a/build/electron/main.js
+++ b/build/electron/main.js
@@ -324,12 +324,6 @@ const readEnvVars = async () => {
disableStartup = envVariables.SF_DISABLE_STARTUP;
}
- try {
- await fsPromises.unlink(configFileName, { force: true });
- } catch (err) {
- log.error(`failed to delete env file (${configFileName})`, err.toString());
- }
-
log.info(`Env vars loaded from file. (${configFileName}) `);
return { url, id };

View file

@ -11,11 +11,11 @@
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "silverfort-client";
version = "3.7.5";
version = "3.7.6";
src = requireFile rec {
name = "${finalAttrs.pname}_${finalAttrs.version}_amd64.deb";
hash = "sha256-eOkSVoucMiGH4sTnC8/3sWMyT9DpnGEYXX+1y2ULDBg=";
hash = "sha256-r/za9JNQoVVowYp3DQ7nHfS+W74v5SZWOmRmIiRvOKw=";
message = ''
Due to the commercial license of Silverfort, Nix is unable to download
Silverfort automatically. Please download ${name} manually and add it
@ -61,11 +61,20 @@ stdenvNoCC.mkDerivation (finalAttrs: {
})
];
postPatch = ''
asar extract "opt/Silverfort Client/resources/app.asar" $TMP/work
# By default, Silverfort will delete the envfile after it has been read one time.
# This file is located at "~/.config/Silverfort Client/config.env" and can be configured
# to store environment variables in JSON format.
# For example: `{"SF_MESSAGING_URL":"https://example-sdms-server.net"}`
substituteInPlace $TMP/work/build/electron/main.js --replace-fail \
'try{await fsPromises.unlink(t,{force:!0})}catch(e){log.error(`failed to delete env file (''${t})`,e.toString())}' ""
'';
installPhase = ''
runHook preInstall
asar extract "opt/Silverfort Client/resources/app.asar" $TMP/work
# Remove unneeded files
rm $TMP/work/build/{"public assests.zip",robots.txt}
@ -74,16 +83,8 @@ stdenvNoCC.mkDerivation (finalAttrs: {
install -Dm444 $TMP/work/build/favicon.ico $out/share/icons/hicolor/256x256/apps/silverfort-client.png
install -Dm444 $TMP/work/build/logo512.png $out/share/icons/hicolor/512x512/apps/silverfort-client.png
# By default, Silverfort will delete the envfile after it has been read one time.
# This file is located at "~/.config/Silverfort Client/config.env" and can be configured
# to store environment variables in JSON format.
# For example: `{"SF_MESSAGING_URL":"https://example-sdms-server.net"}`
patch -d $TMP/work -p1 < ${./dont-delete-envfile.patch}
asar pack $TMP/work $out/share/silverfort-client/resources/app.asar
rm -rf $TMP/work
runHook postInstall
'';