Store: Refactor the settings module

The settings' store module has had a lot of duplicated logic for
the majority of its getters, mutations and actions.

This commit serves to remedy that duplication substantially
by auto generating all getters, mutations and the majority
of actions, using a predictable pattern.
This commit is contained in:
Svallinn 2021-06-06 06:32:41 +01:00
parent 8de473cf2b
commit 49c4c7ac5e
No known key found for this signature in database
GPG Key ID: 09FB527F34037CCA
1 changed files with 92 additions and 781 deletions

View File

@ -3,7 +3,9 @@ import Datastore from 'nedb'
let dbLocation let dbLocation
let webframe = null let webframe = null
if (window && window.process && window.process.type === 'renderer') { const usingElectron = window?.process?.type === 'renderer'
if (usingElectron) {
// Electron is being used // Electron is being used
/* let dbLocation = localStorage.getItem('dbLocation') /* let dbLocation = localStorage.getItem('dbLocation')
@ -28,6 +30,30 @@ const settingsDb = new Datastore({
autoload: true autoload: true
}) })
/**
* NOTE: If someone wants to add a new setting to the app,
* all that needs to be done in this file is adding
* the setting name and its default value to the `state` object
*
* The respective getter, mutation (setter) and action (updater) will
* be automatically generated with the following pattern:
*
* Setting: example
* Getter: getExample
* Mutation: setExample
* Action: updateExample
*
* For more details on this, see the expanded exemplification below
*
* If, for whatever reason, the setting needs less or more
* functionality than what these auto-generated functions can provide,
* then that setting and its necessary functions must be manually added
* only AFTER the generic ones have been auto-generated
* Example: `usingElectron` (doesn't need an action)
*
* The same rule applies for standalone getters, mutations and actions
* Example: `grabUserSettings` (standalone action)
*/
const state = { const state = {
currentTheme: 'lightRed', currentTheme: 'lightRed',
uiScale: 100, uiScale: 100,
@ -66,7 +92,6 @@ const state = {
disableSmoothScrolling: false, disableSmoothScrolling: false,
hideWatchedSubs: false, hideWatchedSubs: false,
useRssFeeds: false, useRssFeeds: false,
usingElectron: true,
hideVideoViews: false, hideVideoViews: false,
hideVideoLikesAndDislikes: false, hideVideoLikesAndDislikes: false,
hideChannelSubscriptions: false, hideChannelSubscriptions: false,
@ -84,214 +109,72 @@ const state = {
displayVideoPlayButton: true displayVideoPlayButton: true
} }
const getters = { const getters = {}
getBackendFallback: () => { const mutations = {}
return state.backendFallback const actions = {}
},
getCheckForUpdates: () => { /**
return state.checkForUpdates * Build getters, mutations and actions for every setting id
}, * e.g.:
* Setting id: uiScale
* Getter:
* getUiScale: (state) => state.uiScale
* Mutation:
* setUiScale: (state, uiScaleValue) => state.uiScale = uiScaleValue
* Action:
* updateUiScale: ({ commit }, uiScaleValue) => {
* await settingsDb.update(
* { _id: 'uiScale' },
* { _id: 'uiScale', value: uiScaleValue },
* { upsert: true },
* (err, _) => {
* commit('setUiScale', uiScaleValue)
* }
* )
*/
for (const settingId of Object.keys(state)) {
const capitalizedSettingId =
settingId.replace(/^\w/, (c) => c.toUpperCase())
getCheckForBlogPosts: () => { const getterId = 'get' + capitalizedSettingId
return state.checkForBlogPosts const mutationId = 'set' + capitalizedSettingId
}, const actionId = 'update' + capitalizedSettingId
getBarColor: () => { getters[getterId] = (state) => state[settingId]
return state.barColor mutations[mutationId] = (state, value) => { state[settingId] = value }
}, actions[actionId] = ({ commit }, value) => {
settingsDb.update(
getUiScale: () => { { _id: settingId },
return state.uiScale { _id: settingId, value: value },
}, { upsert: true },
(err, _) => {
getEnableSearchSuggestions: () => { if (!err) {
return state.enableSearchSuggestions commit(mutationId, value)
}, }
}
getBackendPreference: () => { )
return state.backendPreference
},
getLandingPage: () => {
return state.landingPage
},
getRegion: () => {
return state.region
},
getListType: () => {
return state.listType
},
getThumbnailPreference: () => {
return state.thumbnailPreference
},
getInvidiousInstance: () => {
return state.invidiousInstance
},
getDefaultProfile: () => {
return state.defaultProfile
},
getRememberHistory: () => {
return state.rememberHistory
},
getSaveWatchedProgress: () => {
return state.saveWatchedProgress
},
getRemoveVideoMetaFiles: () => {
return state.removeVideoMetaFiles
},
getAutoplayVideos: () => {
return state.autoplayVideos
},
getAutoplayPlaylists: () => {
return state.autoplayPlaylists
},
getPlayNextVideo: () => {
return state.playNextVideo
},
getEnableSubtitles: () => {
return state.enableSubtitles
},
getForceLocalBackendForLegacy: () => {
return state.forceLocalBackendForLegacy
},
getProxyVideos: () => {
return state.proxyVideos
},
getUseProxy: () => {
return state.useProxy
},
getProxyProtocol: () => {
return state.proxyProtocol
},
getProxyHostname: () => {
return state.proxyHostname
},
getProxyPort: () => {
return state.proxyPort
},
getDefaultTheatreMode: () => {
return state.defaultTheatreMode
},
getDefaultInterval: () => {
return state.defaultInterval
},
getDefaultVolume: () => {
return state.defaultVolume
},
getDefaultPlayback: () => {
return state.defaultPlayback
},
getDefaultVideoFormat: () => {
return state.defaultVideoFormat
},
getDefaultQuality: () => {
return state.defaultQuality
},
getHideWatchedSubs: () => {
return state.hideWatchedSubs
},
getUseRssFeeds: () => {
return state.useRssFeeds
},
getUsingElectron: () => {
return state.usingElectron
},
getDisableSmoothScrolling: () => {
return state.disableSmoothScrolling
},
getHideVideoViews: () => {
return state.hideVideoViews
},
getHideVideoLikesAndDislikes: () => {
return state.hideVideoLikesAndDislikes
},
getHideChannelSubscriptions: () => {
return state.hideChannelSubscriptions
},
getHideCommentLikes: () => {
return state.hideCommentLikes
},
getHideRecommendedVideos: () => {
return state.hideRecommendedVideos
},
getHideTrendingVideos: () => {
return state.hideTrendingVideos
},
getHidePopularVideos: () => {
return state.hidePopularVideos
},
getHidePlaylists: () => {
return state.hidePlaylists
},
getHideLiveChat: () => {
return state.hideLiveChat
},
getHideActiveSubscriptions: () => {
return state.hideActiveSubscriptions
},
getVideoVolumeMouseScroll: () => {
return state.videoVolumeMouseScroll
},
getDisplayVideoPlayButton: () => {
return state.displayVideoPlayButton
},
getUseSponsorBlock: () => {
return state.useSponsorBlock
},
getSponsorBlockUrl: () => {
return state.sponsorBlockUrl
},
getSponsorBlockShowSkippedToast: () => {
return state.sponsorBlockShowSkippedToast
} }
} }
const actions = { // Custom state
grabUserSettings ({ dispatch, commit, rootState }) { Object.assign(state, {
// Add `usingElectron` to the state
usingElectron: usingElectron
})
// Custom getters
Object.assign(getters, {
// Getter for `usingElectron`
getUsingElectron: (state) => state.usingElectron
})
// Custom mutations
// Object.assign(mutations, {})
// Custom actions
Object.assign(actions, {
// Add `grabUserSettings` to actions
grabUserSettings: ({ dispatch, commit }) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
settingsDb.find({}, (err, results) => { settingsDb.find({}, (err, results) => {
if (!err) { if (!err) {
@ -300,7 +183,10 @@ const actions = {
switch (result._id) { switch (result._id) {
case 'invidiousInstance': case 'invidiousInstance':
if (result.value === '') { if (result.value === '') {
dispatch('updateInvidiousInstance', 'https://invidious.snopyta.org') dispatch(
'updateInvidiousInstance',
'https://invidious.snopyta.org'
)
} else { } else {
commit('setInvidiousInstance', result.value) commit('setInvidiousInstance', result.value)
} }
@ -462,583 +348,8 @@ const actions = {
reject(err) reject(err)
}) })
}) })
},
updateInvidiousInstance ({ commit }, invidiousInstance) {
console.log(invidiousInstance)
settingsDb.update({ _id: 'invidiousInstance' }, { _id: 'invidiousInstance', value: invidiousInstance }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setInvidiousInstance', invidiousInstance)
}
})
},
updateDefaultProfile ({ commit }, defaultProfile) {
settingsDb.update({ _id: 'defaultProfile' }, { _id: 'defaultProfile', value: defaultProfile }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setDefaultProfile', defaultProfile)
}
})
},
updateBackendFallback ({ commit }, backendFallback) {
settingsDb.update({ _id: 'backendFallback' }, { _id: 'backendFallback', value: backendFallback }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setBackendFallback', backendFallback)
}
})
},
updateCheckForUpdates ({ commit }, checkForUpdates) {
settingsDb.update({ _id: 'checkForUpdates' }, { _id: 'checkForUpdates', value: checkForUpdates }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setCheckForUpdates', checkForUpdates)
}
})
},
updateCheckForBlogPosts ({ commit }, checkForBlogPosts) {
settingsDb.update({ _id: 'checkForBlogPosts' }, { _id: 'checkForBlogPosts', value: checkForBlogPosts }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setCheckForBlogPosts', checkForBlogPosts)
}
})
},
updateEnableSearchSuggestions ({ commit }, enableSearchSuggestions) {
settingsDb.update({ _id: 'enableSearchSuggestions' }, { _id: 'enableSearchSuggestions', value: enableSearchSuggestions }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setEnableSearchSuggestions', enableSearchSuggestions)
}
})
},
updateBackendPreference ({ commit }, backendPreference) {
settingsDb.update({ _id: 'backendPreference' }, { _id: 'backendPreference', value: backendPreference }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setBackendPreference', backendPreference)
}
})
},
updateLandingPage ({ commit }, landingPage) {
settingsDb.update({ _id: 'landingPage' }, { _id: 'landingPage', value: landingPage }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setLandingPage', landingPage)
}
})
},
updateRegion ({ commit }, region) {
settingsDb.update({ _id: 'region' }, { _id: 'region', value: region }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setRegion', region)
}
})
},
updateListType ({ commit }, listType) {
settingsDb.update({ _id: 'listType' }, { _id: 'listType', value: listType }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setListType', listType)
}
})
},
updateThumbnailPreference ({ commit }, thumbnailPreference) {
settingsDb.update({ _id: 'thumbnailPreference' }, { _id: 'thumbnailPreference', value: thumbnailPreference }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setThumbnailPreference', thumbnailPreference)
}
})
},
updateBarColor ({ commit }, barColor) {
settingsDb.update({ _id: 'barColor' }, { _id: 'barColor', value: barColor }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setBarColor', barColor)
}
})
},
updateUiScale ({ commit }, uiScale) {
settingsDb.update({ _id: 'uiScale' }, { _id: 'uiScale', value: uiScale }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setUiScale', uiScale)
}
})
},
updateHideWatchedSubs ({ commit }, hideWatchedSubs) {
settingsDb.update({ _id: 'hideWatchedSubs' }, { _id: 'hideWatchedSubs', value: hideWatchedSubs }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setHideWatchedSubs', hideWatchedSubs)
}
})
},
updateUseRssFeeds ({ commit }, useRssFeeds) {
settingsDb.update({ _id: 'useRssFeeds' }, { _id: 'useRssFeeds', value: useRssFeeds }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setUseRssFeeds', useRssFeeds)
}
})
},
updateRememberHistory ({ commit }, history) {
settingsDb.update({ _id: 'rememberHistory' }, { _id: 'rememberHistory', value: history }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setRememberHistory', history)
}
})
},
updateSaveWatchedProgress ({ commit }, saveWatchedProgress) {
settingsDb.update({ _id: 'saveWatchedProgress' }, { _id: 'saveWatchedProgress', value: saveWatchedProgress }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setSaveWatchedProgress', saveWatchedProgress)
}
})
},
updateRemoveVideoMetaFiles ({ commit }, removeVideoMetaFiles) {
settingsDb.update({ _id: 'removeVideoMetaFiles' }, { _id: 'removeVideoMetaFiles', value: removeVideoMetaFiles }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setRemoveVideoMetaFiles', removeVideoMetaFiles)
}
})
},
updateAutoplayVideos ({ commit }, autoplayVideos) {
settingsDb.update({ _id: 'autoplayVideos' }, { _id: 'autoplayVideos', value: autoplayVideos }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setAutoplayVideos', autoplayVideos)
}
})
},
updateAutoplayPlaylists ({ commit }, autoplayPlaylists) {
settingsDb.update({ _id: 'autoplayPlaylists' }, { _id: 'autoplayPlaylists', value: autoplayPlaylists }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setAutoplayPlaylists', autoplayPlaylists)
}
})
},
updatePlayNextVideo ({ commit }, playNextVideo) {
settingsDb.update({ _id: 'playNextVideo' }, { _id: 'playNextVideo', value: playNextVideo }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setPlayNextVideo', playNextVideo)
}
})
},
updateEnableSubtitles ({ commit }, enableSubtitles) {
settingsDb.update({ _id: 'enableSubtitles' }, { _id: 'enableSubtitles', value: enableSubtitles }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setEnableSubtitles', enableSubtitles)
}
})
},
updateForceLocalBackendForLegacy ({ commit }, forceLocalBackendForLegacy) {
settingsDb.update({ _id: 'forceLocalBackendForLegacy' }, { _id: 'forceLocalBackendForLegacy', value: forceLocalBackendForLegacy }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setForceLocalBackendForLegacy', forceLocalBackendForLegacy)
}
})
},
updateProxyVideos ({ commit }, proxyVideos) {
settingsDb.update({ _id: 'proxyVideos' }, { _id: 'proxyVideos', value: proxyVideos }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setProxyVideos', proxyVideos)
}
})
},
updateDefaultTheatreMode ({ commit }, defaultTheatreMode) {
settingsDb.update({ _id: 'defaultTheatreMode' }, { _id: 'defaultTheatreMode', value: defaultTheatreMode }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setDefaultTheatreMode', defaultTheatreMode)
}
})
},
updateDefaultInterval ({ commit }, defaultInterval) {
settingsDb.update({ _id: 'defaultInterval' }, { _id: 'defaultInterval', value: defaultInterval }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setDefaultInterval', defaultInterval)
}
})
},
updateDefaultVolume ({ commit }, defaultVolume) {
settingsDb.update({ _id: 'defaultVolume' }, { _id: 'defaultVolume', value: defaultVolume }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setDefaultVolume', defaultVolume)
sessionStorage.setItem('volume', defaultVolume)
}
})
},
updateDefaultPlayback ({ commit }, defaultPlayback) {
settingsDb.update({ _id: 'defaultPlayback' }, { _id: 'defaultPlayback', value: defaultPlayback }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setDefaultPlayback', defaultPlayback)
}
})
},
updateDefaultVideoFormat ({ commit }, defaultVideoFormat) {
settingsDb.update({ _id: 'defaultVideoFormat' }, { _id: 'defaultVideoFormat', value: defaultVideoFormat }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setDefaultVideoFormat', defaultVideoFormat)
}
})
},
updateDefaultQuality ({ commit }, defaultQuality) {
settingsDb.update({ _id: 'defaultQuality' }, { _id: 'defaultQuality', value: defaultQuality }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setDefaultQuality', defaultQuality)
}
})
},
updateUseProxy ({ commit }, useProxy) {
settingsDb.update({ _id: 'useProxy' }, { _id: 'useProxy', value: useProxy }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setUseProxy', useProxy)
}
})
},
updateProxyProtocol ({ commit }, proxyProtocol) {
settingsDb.update({ _id: 'proxyProtocol' }, { _id: 'proxyProtocol', value: proxyProtocol }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setProxyProtocol', proxyProtocol)
}
})
},
updateProxyHostname ({ commit }, proxyHostname) {
settingsDb.update({ _id: 'proxyHostname' }, { _id: 'proxyHostname', value: proxyHostname }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setProxyHostname', proxyHostname)
}
})
},
updateProxyPort ({ commit }, proxyPort) {
settingsDb.update({ _id: 'proxyPort' }, { _id: 'proxyPort', value: proxyPort }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setProxyPort', proxyPort)
}
})
},
updateDisableSmoothScrolling ({ commit }, disableSmoothScrolling) {
settingsDb.update({ _id: 'disableSmoothScrolling' }, { _id: 'disableSmoothScrolling', value: disableSmoothScrolling }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setDisableSmoothScrolling', disableSmoothScrolling)
}
})
},
updateHideVideoViews ({ commit }, hideVideoViews) {
settingsDb.update({ _id: 'hideVideoViews' }, { _id: 'hideVideoViews', value: hideVideoViews }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setHideVideoViews', hideVideoViews)
}
})
},
updateHideVideoLikesAndDislikes ({ commit }, hideVideoLikesAndDislikes) {
settingsDb.update({ _id: 'hideVideoLikesAndDislikes' }, { _id: 'hideVideoLikesAndDislikes', value: hideVideoLikesAndDislikes }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setHideVideoLikesAndDislikes', hideVideoLikesAndDislikes)
}
})
},
updateHideChannelSubscriptions ({ commit }, hideChannelSubscriptions) {
settingsDb.update({ _id: 'hideChannelSubscriptions' }, { _id: 'hideChannelSubscriptions', value: hideChannelSubscriptions }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setHideChannelSubscriptions', hideChannelSubscriptions)
}
})
},
updateHideCommentLikes ({ commit }, hideCommentLikes) {
settingsDb.update({ _id: 'hideCommentLikes' }, { _id: 'hideCommentLikes', value: hideCommentLikes }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setHideCommentLikes', hideCommentLikes)
}
})
},
updateHideRecommendedVideos ({ commit }, hideRecommendedVideos) {
settingsDb.update({ _id: 'hideRecommendedVideos' }, { _id: 'hideRecommendedVideos', value: hideRecommendedVideos }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setHideRecommendedVideos', hideRecommendedVideos)
}
})
},
updateHideTrendingVideos ({ commit }, hideTrendingVideos) {
settingsDb.update({ _id: 'hideTrendingVideos' }, { _id: 'hideTrendingVideos', value: hideTrendingVideos }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setHideTrendingVideos', hideTrendingVideos)
}
})
},
updateHidePopularVideos ({ commit }, hidePopularVideos) {
settingsDb.update({ _id: 'hidePopularVideos' }, { _id: 'hidePopularVideos', value: hidePopularVideos }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setHidePopularVideos', hidePopularVideos)
}
})
},
updateHidePlaylists ({ commit }, hidePlaylists) {
settingsDb.update({ _id: 'hidePlaylists' }, { _id: 'hidePlaylists', value: hidePlaylists }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setHidePlaylists', hidePlaylists)
}
})
},
updateHideActiveSubscriptions ({ commit }, hideActiveSubscriptions) {
settingsDb.update({ _id: 'hideActiveSubscriptions' }, { _id: 'hideActiveSubscriptions', value: hideActiveSubscriptions }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setHideActiveSubscriptions', hideActiveSubscriptions)
}
})
},
updateHideLiveChat ({ commit }, hideLiveChat) {
settingsDb.update({ _id: 'hideLiveChat' }, { _id: 'hideLiveChat', value: hideLiveChat }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setHideLiveChat', hideLiveChat)
}
})
},
updateVideoVolumeMouseScroll ({ commit }, videoVolumeMouseScroll) {
settingsDb.update({ _id: 'videoVolumeMouseScroll' }, { _id: 'videoVolumeMouseScroll', value: videoVolumeMouseScroll }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setVideoVolumeMouseScroll', videoVolumeMouseScroll)
}
})
},
updateDisplayVideoPlayButton ({ commit }, displayVideoPlayButton) {
settingsDb.update({ _id: 'displayVideoPlayButton' }, { _id: 'displayVideoPlayButton', value: displayVideoPlayButton }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setDisplayVideoPlayButton', displayVideoPlayButton)
}
})
},
updateUseSponsorBlock ({ commit }, useSponsorBlock) {
settingsDb.update({ _id: 'useSponsorBlock' }, { _id: 'useSponsorBlock', value: useSponsorBlock }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setUseSponsorBlock', useSponsorBlock)
}
})
},
updateSponsorBlockUrl ({ commit }, sponsorBlockUrl) {
settingsDb.update({ _id: 'sponsorBlockUrl' }, { _id: 'sponsorBlockUrl', value: sponsorBlockUrl }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setSponsorBlockUrl', sponsorBlockUrl)
}
})
},
updateSponsorBlockShowSkippedToast ({ commit }, sponsorBlockShowSkippedToast) {
settingsDb.update({ _id: 'sponsorBlockShowSkippedToast' }, { _id: 'sponsorBlockShowSkippedToast', value: sponsorBlockShowSkippedToast }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setSponsorBlockShowSkippedToast', sponsorBlockShowSkippedToast)
}
})
} }
} })
const mutations = {
setInvidiousInstance (state, invidiousInstance) {
state.invidiousInstance = invidiousInstance
},
setCurrentTheme (state, currentTheme) {
state.barColor = currentTheme
},
setDefaultProfile (state, defaultProfile) {
state.defaultProfile = defaultProfile
},
setBackendFallback (state, backendFallback) {
state.backendFallback = backendFallback
},
setCheckForUpdates (state, checkForUpdates) {
state.checkForUpdates = checkForUpdates
},
setCheckForBlogPosts (state, checkForBlogPosts) {
state.checkForBlogPosts = checkForBlogPosts
},
setBackendPreference (state, backendPreference) {
state.backendPreference = backendPreference
},
setLandingPage (state, defaultLandingPage) {
state.defaultLandingPage = defaultLandingPage
},
setRegion (state, region) {
state.region = region
},
setListType (state, listType) {
state.listType = listType
},
setThumbnailPreference (state, thumbnailPreference) {
state.thumbnailPreference = thumbnailPreference
},
setBarColor (state, barColor) {
state.barColor = barColor
},
setUiScale (state, uiScale) {
state.uiScale = uiScale
},
setEnableSearchSuggestions (state, enableSearchSuggestions) {
state.enableSearchSuggestions = enableSearchSuggestions
},
setRememberHistory (state, rememberHistory) {
state.rememberHistory = rememberHistory
},
setSaveWatchedProgress (state, saveWatchedProgress) {
state.saveWatchedProgress = saveWatchedProgress
},
setRemoveVideoMetaFiles (state, removeVideoMetaFiles) {
state.removeVideoMetaFiles = removeVideoMetaFiles
},
setAutoplayVideos (state, autoplayVideos) {
state.autoplayVideos = autoplayVideos
},
setAutoplayPlaylists (state, autoplayPlaylists) {
state.autoplayPlaylists = autoplayPlaylists
},
setPlayNextVideo (state, playNextVideo) {
state.playNextVideo = playNextVideo
},
setEnableSubtitles (state, enableSubtitles) {
state.enableSubtitles = enableSubtitles
},
setForceLocalBackendForLegacy (state, forceLocalBackendForLegacy) {
state.forceLocalBackendForLegacy = forceLocalBackendForLegacy
},
setProxyVideos (state, proxyVideos) {
state.proxyVideos = proxyVideos
},
setDefaultInterval (state, defaultInterval) {
state.defaultInterval = defaultInterval
},
setDefaultVolume (state, defaultVolume) {
state.defaultVolume = defaultVolume
},
setDefaultPlayback (state, defaultPlayback) {
state.defaultPlayback = defaultPlayback
},
setDefaultVideoFormat (state, defaultVideoFormat) {
state.defaultVideoFormat = defaultVideoFormat
},
setDefaultQuality (state, defaultQuality) {
state.defaultQuality = defaultQuality
},
setProxy (state, proxy) {
state.proxy = proxy
},
setDefaultTheatreMode (state, defaultTheatreMode) {
state.defaultTheatreMode = defaultTheatreMode
},
setUseProxy (state, useProxy) {
state.useProxy = useProxy
},
setProxyProtocol (state, proxyProtocol) {
state.proxyProtocol = proxyProtocol
},
setProxyHostname (state, proxyHostname) {
state.proxyHostname = proxyHostname
},
setProxyPort (state, proxyPort) {
state.proxyPort = proxyPort
},
setDebugMode (state, debugMode) {
state.debugMode = debugMode
},
setHideWatchedSubs (state, hideWatchedSubs) {
state.hideWatchedSubs = hideWatchedSubs
},
setUseRssFeeds (state, useRssFeeds) {
state.useRssFeeds = useRssFeeds
},
setUsingElectron (state, usingElectron) {
state.usingElectron = usingElectron
},
setDisableSmoothScrolling (state, disableSmoothScrolling) {
state.disableSmoothScrolling = disableSmoothScrolling
},
setVideoView (state, videoView) {
state.videoView = videoView
},
setProfileList (state, profileList) {
state.profileList = profileList
},
setHideVideoViews (state, hideVideoViews) {
state.hideVideoViews = hideVideoViews
},
setHideVideoLikesAndDislikes (state, hideVideoLikesAndDislikes) {
state.hideVideoLikesAndDislikes = hideVideoLikesAndDislikes
},
setHideChannelSubscriptions (state, hideChannelSubscriptions) {
state.hideChannelSubscriptions = hideChannelSubscriptions
},
setHideCommentLikes (state, hideCommentLikes) {
state.hideCommentLikes = hideCommentLikes
},
setHideRecommendedVideos (state, hideRecommendedVideos) {
state.hideRecommendedVideos = hideRecommendedVideos
},
setHideTrendingVideos (state, hideTrendingVideos) {
state.hideTrendingVideos = hideTrendingVideos
},
setHidePopularVideos (state, hidePopularVideos) {
state.hidePopularVideos = hidePopularVideos
},
setHidePlaylists (state, hidePlaylists) {
state.hidePlaylists = hidePlaylists
},
setHideLiveChat (state, hideLiveChat) {
state.hideLiveChat = hideLiveChat
},
setHideActiveSubscriptions (state, hideActiveSubscriptions) {
state.hideActiveSubscriptions = hideActiveSubscriptions
},
setVideoVolumeMouseScroll (state, videoVolumeMouseScroll) {
state.videoVolumeMouseScroll = videoVolumeMouseScroll
},
setDisplayVideoPlayButton (state, displayVideoPlayButton) {
state.displayVideoPlayButton = displayVideoPlayButton
},
setUseSponsorBlock (state, useSponsorBlock) {
state.useSponsorBlock = useSponsorBlock
},
setSponsorBlockUrl (state, sponsorBlockUrl) {
state.sponsorBlockUrl = sponsorBlockUrl
},
setSponsorBlockShowSkippedToast (state, sponsorBlockShowSkippedToast) {
state.sponsorBlockShowSkippedToast = sponsorBlockShowSkippedToast
}
}
export default { export default {
state, state,