Skip to content

Commit

Permalink
UIUX: Consistent use of "Settings" in Electron app and specterd args …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
moneymanolis and k9ert authored Mar 7, 2023
1 parent 45c3a32 commit b004ca2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
27 changes: 13 additions & 14 deletions pyinstaller/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ app.whenReady().then(() => {
trayMenu = [
{ label: 'Launching Specter ...', enabled: false },
{ label: 'Show Specter', click() { mainWindow.show() }},
{ label: 'Preferences', click() { openPreferences() }},
{ label: 'Settings', click() { openPreferences() }},
{ label: 'Quit', click() { quitSpecterd(); app.quit() } },
]
tray.setToolTip('Specter')
Expand Down Expand Up @@ -381,7 +381,7 @@ function initMainWindow() {

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

Expand Down Expand Up @@ -490,16 +490,15 @@ function startSpecterd(specterdPath) {
specterdArgs.push("--no-filelog")
if (hwiBridgeMode) specterdArgs.push('--hwibridge')
if (appSettings.specterdCLIArgs != '') {
if (specterdArgs == null) {
specterdArgs = []
}
// User has inputed cli arguments in the UI
let specterdExtraArgs = appSettings.specterdCLIArgs.split(' ')
specterdExtraArgs.forEach((arg, index) => specterdExtraArgs[index] = arg.trim())
specterdArgs = specterdArgs.concat(specterdExtraArgs)
specterdExtraArgs.forEach((arg) => {
// Ensures that whitespaces are not used as cli arguments
if (arg != '') {
specterdArgs.push(arg)
}
})
}


logger.info(`Starting specterd ${specterdPath} ${specterdArgs}`);
// locale fix (copying from nodejs-env + adding locales)
const options = {
env: { ...process.env}
Expand Down Expand Up @@ -657,7 +656,7 @@ function setMainMenu() {
if (platformName == 'osx') {
menu[0].submenu.splice(1, 0,
{
label: 'Preferences',
label: 'Settings...', // This is a naming convention on MacOS. If you use just "Preferences", it gets translated to "Settings..." on MacOS.
click: openPreferences,
accelerator: "CmdOrCtrl+,"
}
Expand All @@ -666,22 +665,22 @@ function setMainMenu() {
{
label: 'Specter Logs',
click: openErrorLog,
accelerator: "CmdOrCtrl+,"
accelerator: "CmdOrCtrl+L"
}
);
} else {
menu.unshift({
label: 'Specter',
submenu: [
{
label: 'Preferences',
label: 'Settings',
click: openPreferences,
accelerator: "CmdOrCtrl+,"
},
{
label: 'Specter Logs',
click: openErrorLog,
accelerator: "CmdOrCtrl+,"
accelerator: "CmdOrCtrl+L"
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions pyinstaller/electron/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

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

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

<div>
Expand Down

0 comments on commit b004ca2

Please sign in to comment.