From 78698b9d72f96bb69e62aa6006c47130c8918461 Mon Sep 17 00:00:00 2001 From: Xendarboh <1435589+xendarboh@users.noreply.github.com> Date: Wed, 12 Feb 2025 13:29:22 -0800 Subject: [PATCH 1/2] refactor(capabilities): shell: explicit command args --- src-tauri/capabilities/default.json | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index c51de40..9fae946 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -37,14 +37,9 @@ "identifier": "shell:allow-execute", "allow": [ { - "name": "chmod+x", + "name": "chmod-walletshield", "cmd": "chmod", - "args": [ - "+x", - { - "validator": "\\S+" - } - ], + "args": ["+x", "walletshield"], "sidecar": false } ] @@ -55,14 +50,7 @@ { "name": "walletshield-listen", "cmd": "walletshield", - "args": [ - "-listen", - ":7070", - "-config", - { - "validator": "\\S+" - } - ], + "args": ["-listen", ":7070", "-config", "client.toml"], "sidecar": false } ] From aed0c7bbc29f3db68fa93ce7a685ff3498a37aa8 Mon Sep 17 00:00:00 2001 From: Xendarboh <1435589+xendarboh@users.noreply.github.com> Date: Wed, 12 Feb 2025 13:33:29 -0800 Subject: [PATCH 2/2] refactor: execute commands using cwd file paths --- src/App.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index c29a6fb..f0795e3 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -166,10 +166,14 @@ function App() { // prepare the walletshield binary for execution //////////////////////////////////////////////////////////////////////// if (platform() === "linux" || platform() === "macos") { - const output = await Command.create("chmod+x", [ - "+x", - fileWalletshield, - ]).execute(); + log.debug(`executing command: chmod +x walletshield`); + const output = await Command.create( + "chmod-walletshield", + ["+x", "walletshield"], + { + cwd: dirNetwork, + }, + ).execute(); if (output.code !== 0) { throw new Error(`Failed to chmod+x walletshield: ${output.stderr}`); } @@ -181,7 +185,7 @@ function App() { setMsgType(() => "info"); setMsg(() => `Starting network client...`); const cmd = "walletshield"; - const args = ["-listen", ":7070", "-config", fileClientCfg]; + const args = ["-listen", ":7070", "-config", "client.toml"]; const command = Command.create("walletshield-listen", args, { cwd: dirNetwork, env: {