Skip to content

Commit

Permalink
**Release 109**
Browse files Browse the repository at this point in the history
commit ea18d5b
Author: Emma <MarmadileManteater@proton.me>
Date:   Fri Oct 20 18:33:33 2023 -0400
    Add `IS_CORDOVA` checks for new `IS_ELECTRON` checks

...

**Full Changelog**: 0.18.0.107...0.19.1.109
  • Loading branch information
MarmadileManteater committed Oct 20, 2023
2 parents d875ec1 + ea18d5b commit 0d8481c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
Expand Up @@ -123,7 +123,7 @@ export default defineComponent({
this.errorChannels = []
const postListFromRemote = (await Promise.all(channelsToLoadFromRemote.map(async (channel) => {
let posts = []
if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
if ((!process.env.IS_CORDOVA && !process.env.IS_ELECTRON) || this.backendPreference === 'invidious') {
posts = await this.getChannelPostsInvidious(channel)
} else {
posts = await this.getChannelPostsLocal(channel)
Expand Down Expand Up @@ -199,7 +199,7 @@ export default defineComponent({
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
if ((process.env.IS_CORDOVA || process.env.IS_ELECTRON) && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to the local API'))
resolve(this.getChannelPostsLocal(channel))
} else {
Expand Down
Expand Up @@ -131,7 +131,7 @@ export default defineComponent({
this.errorChannels = []
const videoListFromRemote = (await Promise.all(channelsToLoadFromRemote.map(async (channel) => {
let videos = []
if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
if (!(process.env.IS_CORDOVA || process.env.IS_ELECTRON) || this.backendPreference === 'invidious') {
if (useRss) {
videos = await this.getChannelLiveInvidiousRSS(channel)
} else {
Expand Down Expand Up @@ -213,7 +213,7 @@ export default defineComponent({
const feedUrl = `https://www.youtube.com/feeds/videos.xml?playlist_id=${playlistId}`

try {
const response = await fetch(feedUrl)
const response = await (process.env.IS_CORDOVA ? cordovaFetch : fetch)(feedUrl)

if (response.status === 404) {
// playlists don't exist if the channel was terminated but also if it doesn't have the tab,
Expand Down Expand Up @@ -281,7 +281,7 @@ export default defineComponent({
resolve(this.getChannelLiveInvidiousRSS(channel, failedAttempts + 1))
break
case 1:
if (process.env.IS_ELECTRON && this.backendFallback) {
if ((process.env.IS_CORDOVA || process.env.IS_ELECTRON) && this.backendFallback) {
showToast(this.$t('Falling back to the local API'))
resolve(this.getChannelLiveLocal(channel, failedAttempts + 1))
} else {
Expand Down Expand Up @@ -321,7 +321,7 @@ export default defineComponent({
case 0:
return this.getChannelLiveInvidious(channel, failedAttempts + 1)
case 1:
if (process.env.IS_ELECTRON && this.backendFallback) {
if ((process.env.IS_CORDOVA || process.env.IS_ELECTRON) && this.backendFallback) {
showToast(this.$t('Falling back to the local API'))
return this.getChannelLiveLocalRSS(channel, failedAttempts + 1)
} else {
Expand Down
Expand Up @@ -117,7 +117,7 @@ export default defineComponent({
this.errorChannels = []
const videoListFromRemote = (await Promise.all(channelsToLoadFromRemote.map(async (channel) => {
let videos = []
if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
if ((!process.env.IS_CORDOVA && !process.env.IS_ELECTRON) || this.backendPreference === 'invidious') {
videos = await this.getChannelShortsInvidious(channel)
} else {
videos = await this.getChannelShortsLocal(channel)
Expand Down Expand Up @@ -155,7 +155,7 @@ export default defineComponent({
const feedUrl = `https://www.youtube.com/feeds/videos.xml?playlist_id=${playlistId}`

try {
const response = await fetch(feedUrl)
const response = await (process.env.IS_CORDOVA ? cordovaFetch : fetch)(feedUrl)

if (response.status === 404) {
// playlists don't exist if the channel was terminated but also if it doesn't have the tab,
Expand Down Expand Up @@ -214,7 +214,7 @@ export default defineComponent({
})
switch (failedAttempts) {
case 0:
if (process.env.IS_ELECTRON && this.backendFallback) {
if ((process.env.IS_CORDOVA || process.env.IS_ELECTRON) && this.backendFallback) {
showToast(this.$t('Falling back to the local API'))
return this.getChannelShortsLocal(channel, failedAttempts + 1)
} else {
Expand Down
Expand Up @@ -131,7 +131,7 @@ export default defineComponent({
this.errorChannels = []
const videoListFromRemote = (await Promise.all(channelsToLoadFromRemote.map(async (channel) => {
let videos = []
if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
if (!(process.env.IS_CORDOVA || process.env.IS_ELECTRON) || this.backendPreference === 'invidious') {
if (useRss) {
videos = await this.getChannelVideosInvidiousRSS(channel)
} else {
Expand Down Expand Up @@ -213,7 +213,7 @@ export default defineComponent({
const feedUrl = `https://www.youtube.com/feeds/videos.xml?playlist_id=${playlistId}`

try {
const response = await fetch(feedUrl)
const response = await (process.env.IS_CORDOVA ? cordovaFetch : fetch)(feedUrl)

if (response.status === 404) {
// playlists don't exist if the channel was terminated but also if it doesn't have the tab,
Expand Down Expand Up @@ -278,7 +278,7 @@ export default defineComponent({
resolve(this.getChannelVideosInvidiousRSS(channel, failedAttempts + 1))
break
case 1:
if (process.env.IS_ELECTRON && this.backendFallback) {
if ((process.env.IS_CORDOVA || process.env.IS_ELECTRON) && this.backendFallback) {
showToast(this.$t('Falling back to the local API'))
resolve(this.getChannelVideosLocalScraper(channel, failedAttempts + 1))
} else {
Expand Down Expand Up @@ -319,7 +319,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_CORDOVA || process.env.IS_ELECTRON) && this.backendFallback) {
showToast(this.$t('Falling back to the local API'))
return this.getChannelVideosLocalRSS(channel, failedAttempts + 1)
} else {
Expand Down
Expand Up @@ -292,7 +292,7 @@ export default defineComponent({
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
if (process.env.IS_ELECTRON && this.backendFallback && this.backendPreference === 'invidious') {
if ((process.env.IS_CORDOVA || process.env.IS_ELECTRON) && this.backendFallback && this.backendPreference === 'invidious') {
showToast(this.$t('Falling back to local API'))
this.getCommentDataLocal()
} else {
Expand Down
Expand Up @@ -136,7 +136,7 @@ export default defineComponent({
},
playlistId: function (newVal, oldVal) {
if (oldVal !== newVal) {
if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
if (!(process.env.IS_CORDOVA || process.env.IS_ELECTRON) || this.backendPreference === 'invidious') {
this.getPlaylistInformationInvidious()
} else {
this.getPlaylistInformationLocal()
Expand All @@ -149,7 +149,7 @@ export default defineComponent({

if (cachedPlaylist?.id === this.playlistId) {
this.loadCachedPlaylistInformation(cachedPlaylist)
} else if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
} else if (!(process.env.IS_CORDOVA || process.env.IS_ELECTRON) || this.backendPreference === 'invidious') {
this.getPlaylistInformationInvidious()
} else {
this.getPlaylistInformationLocal()
Expand Down Expand Up @@ -402,7 +402,7 @@ export default defineComponent({
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
if ((process.env.IS_CORDOVA || process.env.IS_ELECTRON) && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
this.getPlaylistInformationLocal()
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/views/Channel/Channel.js
Expand Up @@ -1401,7 +1401,7 @@ export default defineComponent({
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
if ((process.env.IS_CORDOVA || process.env.IS_ELECTRON) && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
if (!this.channelInstance) {
this.channelInstance = await getLocalChannel(this.id)
Expand Down Expand Up @@ -1435,7 +1435,7 @@ export default defineComponent({
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
if ((process.env.IS_CORDOVA || process.env.IS_ELECTRON) && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
this.getChannelLocal()
} else {
Expand Down Expand Up @@ -1514,7 +1514,7 @@ export default defineComponent({
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
if ((process.env.IS_CORDOVA || process.env.IS_ELECTRON) && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
if (!this.channelInstance) {
this.channelInstance = await getLocalChannel(this.id)
Expand Down Expand Up @@ -1548,7 +1548,7 @@ export default defineComponent({
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
if ((process.env.IS_CORDOVA || process.env.IS_ELECTRON) && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
this.getChannelLocal()
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/Hashtag/Hashtag.js
Expand Up @@ -84,7 +84,7 @@ export default defineComponent({
showToast(`${errorMessage}: ${error}`, 10000, () => {
copyToClipboard(error)
})
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
if ((process.env.IS_CORDOVA || process.env.IS_ELECTRON) && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
this.resetData()
this.getLocalHashtag(hashtag)
Expand Down

0 comments on commit 0d8481c

Please sign in to comment.