diff options
author | 2021-06-17 14:17:37 +0000 | |
---|---|---|
committer | 2021-06-17 19:47:37 +0530 | |
commit | a8253a9f6e5cd30760c3fcbf05767e7276b191c1 (patch) | |
tree | 32bd59f5ce3df73b91ed50728cf6a3d339e9b2e2 /src/stores | |
parent | Run ALL builds if no OSes were chosen (manual trigger) (#1529) (diff) | |
download | ferdium-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/stores')
-rw-r--r-- | src/stores/ServicesStore.js | 1 | ||||
-rw-r--r-- | src/stores/SettingsStore.js | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 752f287e8..3dba217b2 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -315,6 +315,7 @@ export default class ServicesStore extends Store { | |||
315 | customIcon: false, | 315 | customIcon: false, |
316 | isDarkModeEnabled: false, | 316 | isDarkModeEnabled: false, |
317 | spellcheckerLanguage: SPELLCHECKER_LOCALES[this.stores.settings.app.spellcheckerLanguage], | 317 | spellcheckerLanguage: SPELLCHECKER_LOCALES[this.stores.settings.app.spellcheckerLanguage], |
318 | userAgentPref: '', | ||
318 | }, serviceData); | 319 | }, serviceData); |
319 | 320 | ||
320 | let data = serviceData; | 321 | let data = serviceData; |
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 { | |||
320 | }, | 320 | }, |
321 | }); | 321 | }); |
322 | } | 322 | } |
323 | |||
324 | if (!this.all.migration['user-agent-settings']) { | ||
325 | this.actions.settings.update({ | ||
326 | type: 'app', | ||
327 | data: { | ||
328 | userAgentPref: DEFAULT_APP_SETTINGS.userAgentPref, | ||
329 | }, | ||
330 | }); | ||
331 | |||
332 | this.actions.settings.update({ | ||
333 | type: 'migration', | ||
334 | data: { | ||
335 | 'user-agent-settings': true, | ||
336 | }, | ||
337 | }); | ||
338 | } | ||
323 | } | 339 | } |
324 | } | 340 | } |