Skip to content

Commit

Permalink
Allow local api for channels in cordova
Browse files Browse the repository at this point in the history
  • Loading branch information
MarmadileManteater committed Mar 7, 2023
1 parent 824050c commit 8c58028
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/renderer/views/Channel/Channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export default defineComponent({
this.showShareMenu = true
this.errorMessage = ''

if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
if (!(process.env.IS_ELECTRON || process.env.IS_CORDOVA) || this.backendPreference === 'invidious') {
this.getChannelInfoInvidious()
} else {
this.getChannelLocal()
Expand Down Expand Up @@ -301,7 +301,7 @@ export default defineComponent({
return
}

if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
if ((process.env.IS_ELECTRON || process.env.IS_CORDOVA) || this.backendPreference === 'invidious') {
this.getChannelInfoInvidious()
} else {
this.getChannelLocal()
Expand All @@ -311,7 +311,7 @@ export default defineComponent({
resolveChannelUrl: async function (url, tab = undefined) {
let id

if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
if ((process.env.IS_ELECTRON || process.env.IS_CORDOVA) || this.backendPreference === 'invidious') {
id = await invidiousGetChannelId(url)
} else {
id = await getLocalChannelId(url)
Expand Down Expand Up @@ -827,7 +827,7 @@ export default defineComponent({
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
if ((process.env.IS_ELECTRON || process.env.IS_CORDOVA) && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
this.getChannelLocal()
} else {
Expand Down Expand Up @@ -864,7 +864,7 @@ export default defineComponent({
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
if ((process.env.IS_ELECTRON || process.env.IS_CORDOVA) && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
this.getChannelLocal()
} else {
Expand Down Expand Up @@ -928,7 +928,7 @@ export default defineComponent({
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
if ((process.env.IS_ELECTRON || process.env.IS_CORDOVA) && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
this.getCommunityPostsLocal()
}
Expand Down Expand Up @@ -1185,7 +1185,7 @@ export default defineComponent({
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
if ((process.env.IS_ELECTRON || process.env.IS_CORDOVA) && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
this.searchChannelLocal()
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/views/Subscriptions/Subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export default defineComponent({
this.errorChannels = []
this.activeSubscriptionList.forEach(async (channel) => {
let videos = []
if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
if (!(process.env.IS_ELECTRON && process.env.IS_CORDOVA) || this.backendPreference === 'invidious') {
if (useRss) {
videos = await this.getChannelVideosInvidiousRSS(channel)
} else {
Expand Down Expand Up @@ -381,7 +381,7 @@ export default defineComponent({
resolve(this.getChannelVideosInvidiousRSS(channel, failedAttempts + 1))
break
case 1:
if (process.env.IS_ELECTRON && this.backendFallback) {
if ((process.env.IS_ELECTRON && process.env.IS_CORDOVA) && this.backendFallback) {
showToast(this.$t('Falling back to the local API'))
resolve(this.getChannelVideosLocalScraper(channel, failedAttempts + 1))
} else {
Expand Down Expand Up @@ -420,7 +420,7 @@ export default defineComponent({
case 0:
return this.getChannelVideosInvidiousScraper(channel, failedAttempts + 1)
case 1:
if (process.env.IS_ELECTRON && this.backendFallback) {
if ((process.env.IS_ELECTRON && process.env.IS_CORDOVA) && this.backendFallback) {
showToast(this.$t('Falling back to the local API'))
return this.getChannelVideosLocalRSS(channel, failedAttempts + 1)
} else {
Expand Down

0 comments on commit 8c58028

Please sign in to comment.