-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add import/export settings buttons #9123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Changes from all commits
bffdca3
043a659
df0d50d
55022f4
4d60589
220c332
76b37a7
45728a1
28b35dc
8e3b64a
49cdf75
fc2288e
2b13802
81806b8
c5924e2
ade92a4
8a54701
55065e5
64d0642
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,6 +121,15 @@ import { getSystemLocale, showToast } from '../../helpers/utils' | |
| * to evaluate if it is truly necessary | ||
| * and to ensure that the implementation works as intended. | ||
| * | ||
| *** | ||
| * `settingsNotTransferable` | ||
| * This set contains setting keys | ||
| * that should not be exported when a user chooses to "Export settings". | ||
| * | ||
| * When adding a new setting, it should be considered | ||
| * whether this setting can be exported or not. For example, settings | ||
| * that are OS or user specific like paths should not be exported. | ||
| * | ||
| **** | ||
| * ENDING NOTES | ||
| * | ||
|
|
@@ -141,10 +150,10 @@ import { getSystemLocale, showToast } from '../../helpers/utils' | |
|
|
||
| // HELPERS | ||
| const capitalize = str => str.charAt(0).toUpperCase() + str.slice(1) | ||
| const defaultGetterId = settingId => 'get' + capitalize(settingId) | ||
| const defaultMutationId = settingId => 'set' + capitalize(settingId) | ||
| const defaultUpdaterId = settingId => 'update' + capitalize(settingId) | ||
| const defaultSideEffectsTriggerId = settingId => | ||
| export const defaultGetterId = settingId => 'get' + capitalize(settingId) | ||
| export const defaultMutationId = settingId => 'set' + capitalize(settingId) | ||
| export const defaultUpdaterId = settingId => 'update' + capitalize(settingId) | ||
| export const defaultSideEffectsTriggerId = settingId => | ||
| 'trigger' + capitalize(settingId) + 'SideEffects' | ||
| /*****/ | ||
|
|
||
|
|
@@ -414,10 +423,47 @@ const sideEffectHandlers = { | |
|
|
||
| const settingsWithSideEffects = Object.keys(sideEffectHandlers) | ||
|
|
||
| const settingsNotTransferable = new Set([ | ||
| /* Depends on process.env.IS_ELECTRON */ | ||
| // ProxySettings | ||
| 'useProxy', | ||
| 'proxyProtocol', | ||
| 'proxyHostname', | ||
| 'proxyPort', | ||
| 'proxyUsername', | ||
| 'proxyPassword', | ||
| // ExternalPlayerSettings | ||
| 'externalPlayer', | ||
| 'externalPlayerExecutable', | ||
| 'externalPlayerIgnoreWarnings', | ||
| 'externalPlayerIgnoreDefaultArgs', | ||
| 'externalPlayerCustomArgs', | ||
| 'showAddedExternalPlayerCustomArgs', | ||
| // Others | ||
| 'disableSmoothScrolling', | ||
| 'hideToTrayOnMinimize', | ||
| 'screenshotAskPath', | ||
| 'screenshotFolderPath', | ||
|
|
||
| /* Depends on process.env.SUPPORTS_LOCAL_API */ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll let others chime in but I think we could keep the SUPPORTS_LOCAL_API settings transferable.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are many references to these values and quite easy for the code to miss |
||
| 'backendFallback', | ||
| 'backendPreference', | ||
| 'proxyVideos', | ||
| ]) | ||
|
|
||
| const customState = { | ||
| } | ||
|
|
||
| const customGetters = { | ||
| getTransferableSettings: (state) => { | ||
| const transferableSettings = {} | ||
| for (const [key, value] of Object.entries(state)) { | ||
| if (!settingsNotTransferable.has(key)) { | ||
| transferableSettings[key] = value | ||
| } | ||
| } | ||
| return transferableSettings | ||
| } | ||
| } | ||
|
|
||
| const customMutations = {} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.