From a8253a9f6e5cd30760c3fcbf05767e7276b191c1 Mon Sep 17 00:00:00 2001 From: Vijay Raghavan Aravamudhan Date: Thu, 17 Jun 2021 14:17:37 +0000 Subject: User agent as a user-preference (#1535) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/stores/SettingsStore.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/stores/SettingsStore.js') diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index 15b0db120..b433efd45 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js @@ -320,5 +320,21 @@ export default class SettingsStore extends Store { }, }); } + + if (!this.all.migration['user-agent-settings']) { + this.actions.settings.update({ + type: 'app', + data: { + userAgentPref: DEFAULT_APP_SETTINGS.userAgentPref, + }, + }); + + this.actions.settings.update({ + type: 'migration', + data: { + 'user-agent-settings': true, + }, + }); + } } } -- cgit v1.2.3-54-g00ecf