Skip to content

Commit b004ca2

Browse files
moneymanolisk9ert
andauthored
UIUX: Consistent use of "Settings" in Electron app and specterd args parsing (#2288)
* consistent usage of "settings" in menus * simpler specterd cli args code * Change cli args label to illustrate need of "=" sign * Change headline in settings.html --------- Co-authored-by: k9ert <k9ert@gmx.de>
1 parent 45c3a32 commit b004ca2

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

pyinstaller/electron/main.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ app.whenReady().then(() => {
301301
trayMenu = [
302302
{ label: 'Launching Specter ...', enabled: false },
303303
{ label: 'Show Specter', click() { mainWindow.show() }},
304-
{ label: 'Preferences', click() { openPreferences() }},
304+
{ label: 'Settings', click() { openPreferences() }},
305305
{ label: 'Quit', click() { quitSpecterd(); app.quit() } },
306306
]
307307
tray.setToolTip('Specter')
@@ -381,7 +381,7 @@ function initMainWindow() {
381381

382382
mainWindow.webContents.on("did-fail-load", function() {
383383
mainWindow.loadURL(`file://${__dirname}/splash.html`);
384-
updatingLoaderMsg(`Failed to load: ${appSettings.specterURL}<br>Please make sure the URL is entered correctly in the Preferences and try again...`)
384+
updatingLoaderMsg(`Failed to load: ${appSettings.specterURL}<br>Please make sure the URL is entered correctly in the settings and try again...`)
385385
});
386386
}
387387

@@ -490,16 +490,15 @@ function startSpecterd(specterdPath) {
490490
specterdArgs.push("--no-filelog")
491491
if (hwiBridgeMode) specterdArgs.push('--hwibridge')
492492
if (appSettings.specterdCLIArgs != '') {
493-
if (specterdArgs == null) {
494-
specterdArgs = []
495-
}
493+
// User has inputed cli arguments in the UI
496494
let specterdExtraArgs = appSettings.specterdCLIArgs.split(' ')
497-
specterdExtraArgs.forEach((arg, index) => specterdExtraArgs[index] = arg.trim())
498-
specterdArgs = specterdArgs.concat(specterdExtraArgs)
495+
specterdExtraArgs.forEach((arg) => {
496+
// Ensures that whitespaces are not used as cli arguments
497+
if (arg != '') {
498+
specterdArgs.push(arg)
499+
}
500+
})
499501
}
500-
501-
502-
logger.info(`Starting specterd ${specterdPath} ${specterdArgs}`);
503502
// locale fix (copying from nodejs-env + adding locales)
504503
const options = {
505504
env: { ...process.env}
@@ -657,7 +656,7 @@ function setMainMenu() {
657656
if (platformName == 'osx') {
658657
menu[0].submenu.splice(1, 0,
659658
{
660-
label: 'Preferences',
659+
label: 'Settings...', // This is a naming convention on MacOS. If you use just "Preferences", it gets translated to "Settings..." on MacOS.
661660
click: openPreferences,
662661
accelerator: "CmdOrCtrl+,"
663662
}
@@ -666,22 +665,22 @@ function setMainMenu() {
666665
{
667666
label: 'Specter Logs',
668667
click: openErrorLog,
669-
accelerator: "CmdOrCtrl+,"
668+
accelerator: "CmdOrCtrl+L"
670669
}
671670
);
672671
} else {
673672
menu.unshift({
674673
label: 'Specter',
675674
submenu: [
676675
{
677-
label: 'Preferences',
676+
label: 'Settings',
678677
click: openPreferences,
679678
accelerator: "CmdOrCtrl+,"
680679
},
681680
{
682681
label: 'Specter Logs',
683682
click: openErrorLog,
684-
accelerator: "CmdOrCtrl+,"
683+
accelerator: "CmdOrCtrl+L"
685684
}
686685
]
687686
}

pyinstaller/electron/settings.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<body class="flex flex-col items-center">
1414
<div class="max-w-[700px] w-[700px]">
15-
<h1 class="mt-10">Preferences</h1>
15+
<h1 class="mt-10">Settings</h1>
1616
<form action="">
1717
<div>
1818
<h3 class="mt-8">Do you want to connect to a remote Specter?</h3>
@@ -90,7 +90,7 @@ <h3>Specter daemon configurations</h3>
9090

9191
<div class="floating-wrapper">
9292
<input id="specterd-cli-args" class="floating-input peer" type="text" placeholder=" " />
93-
<label class="floating-label">Specterd CLI args (example: --tor --port=25441)</label>
93+
<label class="floating-label">Specterd CLI args (--tor). Use an equal sign to specify values (--port=25441)</label>
9494
</div>
9595

9696
<div>

0 commit comments

Comments
 (0)