Fix some web issues and cleanup (#2582)

This commit is contained in:
absidue 2022-09-17 10:19:31 +02:00 committed by GitHub
parent 84b683089d
commit f2d2827e0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 60 deletions

View File

@ -82,17 +82,10 @@ export default Vue.extend({
} }
}, },
mounted: function () { mounted: function () {
if (!process.env.IS_ELECTRON) { if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
this.getPlaylistInformationInvidious() this.getPlaylistInformationInvidious()
} else { } else {
switch (this.backendPreference) { this.getPlaylistInformationLocal()
case 'local':
this.getPlaylistInformationLocal()
break
case 'invidious':
this.getPlaylistInformationInvidious()
break
}
} }
if ('mediaSession' in navigator) { if ('mediaSession' in navigator) {

View File

@ -181,20 +181,13 @@ export default Vue.extend({
this.apiUsed = '' this.apiUsed = ''
this.isLoading = true this.isLoading = true
if (!process.env.IS_ELECTRON) { if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
this.getVideoInformationInvidious() this.getChannelInfoInvidious()
this.getPlaylistsInvidious()
} else { } else {
switch (this.backendPreference) { this.getChannelInfoLocal()
case 'local': this.getChannelVideosLocal()
this.getChannelInfoLocal() this.getPlaylistsLocal()
this.getChannelVideosLocal()
this.getPlaylistsLocal()
break
case 'invidious':
this.getChannelInfoInvidious()
this.getPlaylistsInvidious()
break
}
} }
}, },
@ -237,20 +230,13 @@ export default Vue.extend({
this.currentTab = this.$route.params.currentTab ?? 'videos' this.currentTab = this.$route.params.currentTab ?? 'videos'
this.isLoading = true this.isLoading = true
if (!process.env.IS_ELECTRON) { if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
this.getVideoInformationInvidious() this.getChannelInfoInvidious()
this.getPlaylistsInvidious()
} else { } else {
switch (this.backendPreference) { this.getChannelInfoLocal()
case 'local': this.getChannelVideosLocal()
this.getChannelInfoLocal() this.getPlaylistsLocal()
this.getChannelVideosLocal()
this.getPlaylistsLocal()
break
case 'invidious':
this.getChannelInfoInvidious()
this.getPlaylistsInvidious()
break
}
} }
}, },
methods: { methods: {

View File

@ -7,7 +7,7 @@
<player-settings /> <player-settings />
<hr> <hr>
<external-player-settings v-if="usingElectron" /> <external-player-settings v-if="usingElectron" />
<hr> <hr v-if="usingElectron">
<subscription-settings /> <subscription-settings />
<hr> <hr>
<distraction-settings /> <distraction-settings />
@ -19,7 +19,7 @@
<proxy-settings /> <proxy-settings />
<hr> <hr>
<download-settings v-if="usingElectron" /> <download-settings v-if="usingElectron" />
<hr> <hr v-if="usingElectron">
<parental-control-settings /> <parental-control-settings />
<hr> <hr>
<sponsor-block-settings /> <sponsor-block-settings />

View File

@ -97,17 +97,10 @@ export default Vue.extend({
}, },
getTrendingInfo () { getTrendingInfo () {
if (!process.env.IS_ELECTRON) { if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
this.getVideoInformationInvidious() this.getTrendingInfoInvidious()
} else { } else {
switch (this.backendPreference) { this.getTrendingInfoLocal()
case 'local':
this.getTrendingInfoLocal()
break
case 'invidious':
this.getTrendingInfoInvidious()
break
}
} }
}, },
@ -142,7 +135,7 @@ export default Vue.extend({
navigator.clipboard.writeText(err) navigator.clipboard.writeText(err)
} }
}) })
if (!process.env.IS_ELECTRON || (this.backendPreference === 'local' && this.backendFallback)) { if (this.backendPreference === 'local' && this.backendFallback) {
this.showToast({ this.showToast({
message: this.$t('Falling back to Invidious API') message: this.$t('Falling back to Invidious API')
}) })
@ -202,7 +195,7 @@ export default Vue.extend({
} }
}) })
if (!process.env.IS_ELECTRON || (this.backendPreference === 'invidious' && this.backendFallback)) { if (process.env.IS_ELECTRON && (this.backendPreference === 'invidious' && this.backendFallback)) {
this.showToast({ this.showToast({
message: this.$t('Falling back to Local API') message: this.$t('Falling back to Local API')
}) })

View File

@ -218,17 +218,10 @@ export default Vue.extend({
this.checkIfPlaylist() this.checkIfPlaylist()
this.checkIfTimestamp() this.checkIfTimestamp()
if (!process.env.IS_ELECTRON) { if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
this.getVideoInformationInvidious() this.getVideoInformationInvidious()
} else { } else {
switch (this.backendPreference) { this.getVideoInformationLocal()
case 'local':
this.getVideoInformationLocal()
break
case 'invidious':
this.getVideoInformationInvidious()
break
}
} }
window.addEventListener('beforeunload', this.handleWatchProgress) window.addEventListener('beforeunload', this.handleWatchProgress)
@ -588,7 +581,7 @@ export default Vue.extend({
} }
}) })
console.log(err) console.log(err)
if (!process.env.IS_ELECTRON || (this.backendPreference === 'local' && this.backendFallback && !err.toString().includes('private'))) { if (this.backendPreference === 'local' && this.backendFallback && !err.toString().includes('private')) {
this.showToast({ this.showToast({
message: this.$t('Falling back to Invidious API') message: this.$t('Falling back to Invidious API')
}) })
@ -1151,7 +1144,7 @@ export default Vue.extend({
let url = `${this.currentInvidiousInstance}/api/manifest/dash/id/${this.videoId}` let url = `${this.currentInvidiousInstance}/api/manifest/dash/id/${this.videoId}`
if (this.proxyVideos || !process.env.IS_ELECTRON) { if (this.proxyVideos || !process.env.IS_ELECTRON) {
url = url + '?local=true' url += '?local=true'
} }
return [ return [