From 0a658e3a220479dedd1bfb0fba9eae8dcb36ee12 Mon Sep 17 00:00:00 2001 From: Kendall Garner <17521368+kgarner7@users.noreply.github.com> Date: Fri, 9 Feb 2024 23:20:01 +0000 Subject: [PATCH] [bugfix]: default go libsecret, support changing secret store (#493) * [bugfix]: default go libsecret, support changing secret store * update readme and rename libsecret --- README.md | 1 + src/i18n/locales/en.json | 2 + src/main/main.ts | 6 ++ .../general/application-settings.tsx | 2 +- .../components/window/password-settings.tsx | 56 +++++++++++++++++++ .../settings/components/window/window-tab.tsx | 10 ++++ src/renderer/store/settings.store.ts | 4 +- 7 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 src/renderer/features/settings/components/window/password-settings.tsx diff --git a/README.md b/README.md index 061e8ef7f..486afa8d6 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ docker run --name feishin -p 9180:9180 feishin 2. After restarting the app, you will be prompted to select a server. Click the `Open menu` button and select `Manage servers`. Click the `Add server` button in the popup and fill out all applicable details. You will need to enter the full URL to your server, including the protocol and port if applicable (e.g. `https://navidrome.my-server.com` or `http://192.168.0.1:4533`). - **Navidrome** - For the best experience, select "Save password" when creating the server and configure the `SessionTimeout` setting in your Navidrome config to a larger value (e.g. 72h). + - **Linux users** - The default password store uses `libsecret`. `kwallet4/5/6` are also supported, but must be explicitly set in Settings > Window > Passwords/secret score. 3. _Optional_ - If you want to host Feishin on a subpath (not `/`), then pass in the following environment variable: `PUBLIC_PATH=PATH`. For example, to host on `/feishin`, pass in `PUBLIC_PATH=/feishin`. diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 8e6f5f9c4..41a4528da 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -509,6 +509,8 @@ "mpvExecutablePath_description": "sets the path to the mpv executable", "mpvExecutablePath_help": "one per line", "mpvExtraParameters": "mpv parameters", + "passwordStore": "passwords/secret store", + "passwordStore_description": "what password/secret store to use. change this if you are having issues storing passwords.", "playbackStyle": "playback style", "playbackStyle_description": "select the playback style to use for the audio player", "playbackStyle_optionCrossFade": "crossfade", diff --git a/src/main/main.ts b/src/main/main.ts index 189eaf9d0..a3722c34c 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -57,6 +57,12 @@ if (store.get('ignore_ssl')) { app.commandLine.appendSwitch('ignore-certificate-errors'); } +// From https://github.com/tutao/tutanota/commit/92c6ed27625fcf367f0fbcc755d83d7ff8fde94b +if (isLinux() && !process.argv.some((a) => a.startsWith('--password-store='))) { + const paswordStore = store.get('password_store', 'gnome-libsecret') as string; + app.commandLine.appendSwitch('password-store', paswordStore); +} + let mainWindow: BrowserWindow | null = null; let tray: Tray | null = null; let exitFromTray = false; diff --git a/src/renderer/features/settings/components/general/application-settings.tsx b/src/renderer/features/settings/components/general/application-settings.tsx index 1300c49f4..1052a2c91 100644 --- a/src/renderer/features/settings/components/general/application-settings.tsx +++ b/src/renderer/features/settings/components/general/application-settings.tsx @@ -94,7 +94,7 @@ export const ApplicationSettings = () => { localSettings.fontError(onFontError); return () => { - ipc!.removeAllListeners('custom-font-error'); + ipc?.removeAllListeners('custom-font-error'); }; } diff --git a/src/renderer/features/settings/components/window/password-settings.tsx b/src/renderer/features/settings/components/window/password-settings.tsx new file mode 100644 index 000000000..9cfdf626a --- /dev/null +++ b/src/renderer/features/settings/components/window/password-settings.tsx @@ -0,0 +1,56 @@ +import { SelectItem } from '@mantine/core'; +import isElectron from 'is-electron'; +import { useTranslation } from 'react-i18next'; +import { useSettingsStoreActions, useGeneralSettings } from '../../../../store/settings.store'; +import { + SettingsSection, + SettingOption, +} from '/@/renderer/features/settings/components/settings-section'; +import { Select } from '/@/renderer/components'; + +const localSettings = isElectron() ? window.electron.localSettings : null; + +const PASSWORD_SETTINGS: SelectItem[] = [ + { label: 'libsecret', value: 'gnome_libsecret' }, + { label: 'KDE 4 (kwallet4)', value: 'kwallet' }, + { label: 'KDE 5 (kwallet5)', value: 'kwallet5' }, + { label: 'KDE 6 (kwallet6)', value: 'kwallet6' }, +]; + +export const PasswordSettings = () => { + const { t } = useTranslation(); + const settings = useGeneralSettings(); + const { setSettings } = useSettingsStoreActions(); + + const updateOptions: SettingOption[] = [ + { + control: ( +