Skip to content

Commit

Permalink
Enable Local API for playlists, search, and trending in Cordova
Browse files Browse the repository at this point in the history
This is related to #5.
  • Loading branch information
MarmadileManteater committed Jan 27, 2023
1 parent fbe8b99 commit 034bdbd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/renderer/views/Playlist/Playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default defineComponent({
this.isLoading = false
}).catch((err) => {
console.error(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) {
console.warn('Error getting data with Invidious, falling back to local backend')
this.getPlaylistLocal()
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/Search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,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.performSearchLocal(payload)
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/views/Trending/Trending.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default defineComponent({
},

getTrendingInfo: function () {
if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
if (!(process.env.IS_ELECTRON || process.env.IS_CORDOVA) || this.backendPreference === 'invidious') {
this.getTrendingInfoInvidious()
} else {
this.getTrendingInfoLocal()
Expand Down Expand Up @@ -159,7 +159,7 @@ export default defineComponent({
copyToClipboard(err.responseText)
})

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.getTrendingInfoLocal()
} else {
Expand Down

0 comments on commit 034bdbd

Please sign in to comment.