aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers
diff options
context:
space:
mode:
authorLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-06-17 14:17:37 +0000
committerLibravatar GitHub <noreply@github.com>2021-06-17 19:47:37 +0530
commita8253a9f6e5cd30760c3fcbf05767e7276b191c1 (patch)
tree32bd59f5ce3df73b91ed50728cf6a3d339e9b2e2 /src/containers
parentRun ALL builds if no OSes were chosen (manual trigger) (#1529) (diff)
downloadferdium-app-a8253a9f6e5cd30760c3fcbf05767e7276b191c1.tar.gz
ferdium-app-a8253a9f6e5cd30760c3fcbf05767e7276b191c1.tar.zst
ferdium-app-a8253a9f6e5cd30760c3fcbf05767e7276b191c1.zip
User agent as a user-preference (#1535)
Introduced a global and a service-specific 'user-agent' value that can be set by the user from the preference section. The global override is in Advanced, while the service override was moved to the bottom of the service editor form (and now occupies the full width of the form). Show 'restart reqd' prompt for user-agent setting. The order of the user-agent is the following: 1. Any request header overrides in the recipe will still override the user agent string. 2. If the user has set a user agent override for the service, use that. 3. If the recipe has a predefined user agent, use that. 4. If the user has set a global user agent override, use that. 5. Otherwise, use the user agent string corresponding to the underlying Electron version. If the current webpage is the Google login form, we still remove the Chrome version number from the user agent string. The value that would be used if no custom override is set (recipe-provided value or global override for the service, current Electron instance for the global override) is shown as a placeholder in the input box on the corresponding setting screen. Co-authored-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'src/containers')
-rw-r--r--src/containers/settings/EditServiceScreen.js5
-rw-r--r--src/containers/settings/EditSettingsScreen.js8
2 files changed, 13 insertions, 0 deletions
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js
index 9a200d734..77548bdcf 100644
--- a/src/containers/settings/EditServiceScreen.js
+++ b/src/containers/settings/EditServiceScreen.js
@@ -219,6 +219,11 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
219 options: spellcheckerLanguage, 219 options: spellcheckerLanguage,
220 disabled: !stores.settings.app.enableSpellchecking, 220 disabled: !stores.settings.app.enableSpellchecking,
221 }, 221 },
222 userAgentPref: {
223 label: intl.formatMessage(globalMessages.userAgentPref),
224 placeholder: service.defaultUserAgent,
225 value: service.userAgentPref ? service.userAgentPref : '',
226 },
222 }, 227 },
223 }; 228 };
224 229
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js
index a5dc427ba..2b2d7277b 100644
--- a/src/containers/settings/EditSettingsScreen.js
+++ b/src/containers/settings/EditSettingsScreen.js
@@ -18,6 +18,7 @@ import { config as spellcheckerConfig } from '../../features/spellchecker';
18 18
19import { getSelectOptions } from '../../helpers/i18n-helpers'; 19import { getSelectOptions } from '../../helpers/i18n-helpers';
20import { hash } from '../../helpers/password-helpers'; 20import { hash } from '../../helpers/password-helpers';
21import defaultUserAgent from '../../helpers/userAgent-helpers';
21 22
22import EditSettingsForm from '../../components/settings/settings/EditSettingsForm'; 23import EditSettingsForm from '../../components/settings/settings/EditSettingsForm';
23import ErrorBoundary from '../../components/util/ErrorBoundary'; 24import ErrorBoundary from '../../components/util/ErrorBoundary';
@@ -283,6 +284,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
283 showDragArea: settingsData.showDragArea, 284 showDragArea: settingsData.showDragArea,
284 enableSpellchecking: settingsData.enableSpellchecking, 285 enableSpellchecking: settingsData.enableSpellchecking,
285 spellcheckerLanguage: settingsData.spellcheckerLanguage, 286 spellcheckerLanguage: settingsData.spellcheckerLanguage,
287 userAgentPref: settingsData.userAgentPref,
286 beta: settingsData.beta, // we need this info in the main process as well 288 beta: settingsData.beta, // we need this info in the main process as well
287 automaticUpdates: settingsData.automaticUpdates, // we need this info in the main process as well 289 automaticUpdates: settingsData.automaticUpdates, // we need this info in the main process as well
288 locale: settingsData.locale, // we need this info in the main process as well 290 locale: settingsData.locale, // we need this info in the main process as well
@@ -524,6 +526,12 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
524 options: spellcheckingLanguages, 526 options: spellcheckingLanguages,
525 default: DEFAULT_APP_SETTINGS.spellcheckerLanguage, 527 default: DEFAULT_APP_SETTINGS.spellcheckerLanguage,
526 }, 528 },
529 userAgentPref: {
530 label: intl.formatMessage(globalMessages.userAgentPref),
531 value: settings.all.app.userAgentPref,
532 default: DEFAULT_APP_SETTINGS.userAgentPref,
533 placeholder: defaultUserAgent(),
534 },
527 darkMode: { 535 darkMode: {
528 label: intl.formatMessage(messages.darkMode), 536 label: intl.formatMessage(messages.darkMode),
529 value: settings.all.app.darkMode, 537 value: settings.all.app.darkMode,