mirror of https://github.com/FreeTubeApp/FreeTube
Filter settings sections at build time instead of run time (#5040)
This commit is contained in:
parent
4c511869fc
commit
a5f3410378
|
@ -23,19 +23,24 @@ export default defineComponent({
|
||||||
'general-settings': GeneralSettings,
|
'general-settings': GeneralSettings,
|
||||||
'theme-settings': ThemeSettings,
|
'theme-settings': ThemeSettings,
|
||||||
'player-settings': PlayerSettings,
|
'player-settings': PlayerSettings,
|
||||||
'external-player-settings': ExternalPlayerSettings,
|
|
||||||
'subscription-settings': SubscriptionSettings,
|
'subscription-settings': SubscriptionSettings,
|
||||||
'privacy-settings': PrivacySettings,
|
'privacy-settings': PrivacySettings,
|
||||||
'data-settings': DataSettings,
|
'data-settings': DataSettings,
|
||||||
'distraction-settings': DistractionSettings,
|
'distraction-settings': DistractionSettings,
|
||||||
'proxy-settings': ProxySettings,
|
|
||||||
'sponsor-block-settings': SponsorBlockSettings,
|
'sponsor-block-settings': SponsorBlockSettings,
|
||||||
'download-settings': DownloadSettings,
|
|
||||||
'parental-control-settings': ParentControlSettings,
|
'parental-control-settings': ParentControlSettings,
|
||||||
'experimental-settings': ExperimentalSettings,
|
|
||||||
'password-settings': PasswordSettings,
|
'password-settings': PasswordSettings,
|
||||||
'password-dialog': PasswordDialog,
|
'password-dialog': PasswordDialog,
|
||||||
'ft-toggle-switch': FtToggleSwitch
|
'ft-toggle-switch': FtToggleSwitch,
|
||||||
|
|
||||||
|
...(process.env.IS_ELECTRON
|
||||||
|
? {
|
||||||
|
'proxy-settings': ProxySettings,
|
||||||
|
'download-settings': DownloadSettings,
|
||||||
|
'external-player-settings': ExternalPlayerSettings,
|
||||||
|
'experimental-settings': ExperimentalSettings
|
||||||
|
}
|
||||||
|
: {})
|
||||||
},
|
},
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
|
@ -53,11 +58,14 @@ export default defineComponent({
|
||||||
type: 'player-settings',
|
type: 'player-settings',
|
||||||
title: this.$t('Settings.Player Settings.Player Settings')
|
title: this.$t('Settings.Player Settings.Player Settings')
|
||||||
},
|
},
|
||||||
{
|
...(process.env.IS_ELECTRON
|
||||||
type: 'external-player-settings',
|
? [
|
||||||
title: this.$t('Settings.External Player Settings.External Player Settings'),
|
{
|
||||||
usingElectron: true
|
type: 'external-player-settings',
|
||||||
},
|
title: this.$t('Settings.External Player Settings.External Player Settings')
|
||||||
|
}
|
||||||
|
]
|
||||||
|
: []),
|
||||||
{
|
{
|
||||||
type: 'subscription-settings',
|
type: 'subscription-settings',
|
||||||
title: this.$t('Settings.Subscription Settings.Subscription Settings')
|
title: this.$t('Settings.Subscription Settings.Subscription Settings')
|
||||||
|
@ -74,16 +82,18 @@ export default defineComponent({
|
||||||
type: 'data-settings',
|
type: 'data-settings',
|
||||||
title: this.$t('Settings.Data Settings.Data Settings')
|
title: this.$t('Settings.Data Settings.Data Settings')
|
||||||
},
|
},
|
||||||
{
|
...(process.env.IS_ELECTRON
|
||||||
type: 'proxy-settings',
|
? [
|
||||||
title: this.$t('Settings.Proxy Settings.Proxy Settings'),
|
{
|
||||||
usingElectron: true
|
type: 'proxy-settings',
|
||||||
},
|
title: this.$t('Settings.Proxy Settings.Proxy Settings')
|
||||||
{
|
},
|
||||||
type: 'download-settings',
|
{
|
||||||
title: this.$t('Settings.Download Settings.Download Settings'),
|
type: 'download-settings',
|
||||||
usingElectron: true
|
title: this.$t('Settings.Download Settings.Download Settings')
|
||||||
},
|
}
|
||||||
|
]
|
||||||
|
: []),
|
||||||
{
|
{
|
||||||
type: 'parental-control-settings',
|
type: 'parental-control-settings',
|
||||||
title: this.$t('Settings.Parental Control Settings.Parental Control Settings')
|
title: this.$t('Settings.Parental Control Settings.Parental Control Settings')
|
||||||
|
@ -92,11 +102,14 @@ export default defineComponent({
|
||||||
type: 'sponsor-block-settings',
|
type: 'sponsor-block-settings',
|
||||||
title: this.$t('Settings.SponsorBlock Settings.SponsorBlock Settings'),
|
title: this.$t('Settings.SponsorBlock Settings.SponsorBlock Settings'),
|
||||||
},
|
},
|
||||||
{
|
...(process.env.IS_ELECTRON
|
||||||
type: 'experimental-settings',
|
? [
|
||||||
title: this.$t('Settings.Experimental Settings.Experimental Settings'),
|
{
|
||||||
usingElectron: true
|
type: 'experimental-settings',
|
||||||
},
|
title: this.$t('Settings.Experimental Settings.Experimental Settings')
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
{
|
{
|
||||||
type: 'password-settings',
|
type: 'password-settings',
|
||||||
title: this.$t('Settings.Password Settings.Password Settings')
|
title: this.$t('Settings.Password Settings.Password Settings')
|
||||||
|
@ -122,20 +135,13 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
settingsSectionComponents: function () {
|
settingsSectionComponents: function () {
|
||||||
let settingsSections
|
|
||||||
if (!process.env.IS_ELECTRON) {
|
|
||||||
settingsSections = this.settingsComponentsData.filter((settingsComponent) => !settingsComponent.usingElectron)
|
|
||||||
} else {
|
|
||||||
settingsSections = this.settingsComponentsData
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.settingsSectionSortEnabled) {
|
if (this.settingsSectionSortEnabled) {
|
||||||
return settingsSections.toSorted((a, b) =>
|
return this.settingsComponentsData.toSorted((a, b) =>
|
||||||
a.title.toLowerCase().localeCompare(b.title.toLowerCase(), this.locale)
|
a.title.toLowerCase().localeCompare(b.title.toLowerCase(), this.locale)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return settingsSections
|
return this.settingsComponentsData
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
|
|
Loading…
Reference in New Issue