Skip to content

Commit

Permalink
Remove landing page from selection and/or restore selection to defaul…
Browse files Browse the repository at this point in the history
…t if is no longer valid
  • Loading branch information
kommunarr committed Nov 17, 2023
1 parent ed1ae8a commit e224957
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/renderer/components/general-settings/general-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,21 @@ export default defineComponent({
checkForBlogPosts: function () {
return this.$store.getters.getCheckForBlogPosts
},
hidePlaylists: function () {
return this.$store.getters.getHidePlaylists
},
hidePopularVideos: function () {
return this.$store.getters.getHidePopularVideos
},
hideTrendingVideos: function () {
return this.$store.getters.getHideTrendingVideos
},
defaultPages: function () {
return this.$router.getRoutes().filter((route) => this.includedDefaultPageNames.includes(route.name))
let includedPageNames = this.includedDefaultPageNames
if (this.hideTrendingVideos) includedPageNames = includedPageNames.filter((pageName) => pageName !== 'trending')
if (this.hidePlaylists) includedPageNames = includedPageNames.filter((pageName) => pageName !== 'userPlaylists')
if (!(!this.hidePopularVideos && (this.backendFallback || this.backendPreference === 'invidious'))) includedPageNames = includedPageNames.filter((pageName) => pageName !== 'popular')
return this.$router.getRoutes().filter((route) => includedPageNames.includes(route.name))
},
defaultPageNames: function () {
return this.defaultPages.map((route) => this.$t(route.meta.title))
Expand All @@ -84,6 +97,11 @@ export default defineComponent({
return this.$store.getters.getBackendPreference
},
landingPage: function () {
const landingPage = this.$store.getters.getLandingPage
// invalidate landing page selection & restore to default value if no longer valid
if (!this.defaultPageValues.includes(landingPage)) {
this.updateLandingPage('subscriptions')
}
return this.$store.getters.getLandingPage
},
region: function () {
Expand Down

0 comments on commit e224957

Please sign in to comment.