Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<meta charset="utf-8" />
<meta name="viewport"
content="width=device-width, initial-scale=1.0" />
<% if (!process.env.IS_ELECTRON) { %>
<link rel="manifest" href="static/manifest.json" />
<% } %>
<title></title>
<% if (htmlWebpackPlugin.options.nodeModules) { %>
<script>
Expand All @@ -18,13 +20,14 @@

<body>
<div id="app"></div>
<% if (!process.env.IS_ELECTRON) { %>
<script>
// This is the service worker with the Advanced caching

// Add this below content to your HTML page, or add the js file to your page at the very top to register service worker

// Check compatibility for the browser we're running this in
if ("serviceWorker" in navigator && !<%= process.env.IS_ELECTRON %>) {
if ("serviceWorker" in navigator) {
if (navigator.serviceWorker.controller) {
console.log("[PWA Builder] active service worker found, no need to register");
} else {
Expand All @@ -39,6 +42,7 @@
}
}
</script>
<% } %>
<!-- webpack builds are automatically injected -->
</body>

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/data-settings/data-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ export default Vue.extend({
copyToClipboard(err.responseJSON.error)
})

if (this.backendFallback && this.backendPreference === 'invidious') {
if (process.env.IS_ELECTRON && this.backendFallback && this.backendPreference === 'invidious') {
showToast(this.$t('Falling back to the local API'))
resolve(this.getChannelInfoLocal(channelId))
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/top-nav/top-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export default Vue.extend({
this.searchSuggestionsDataList = results.suggestions
}).catch((err) => {
console.error(err)
if (this.backendFallback) {
if (process.env.IS_ELECTRON && this.backendFallback) {
console.error(
'Error gettings search suggestions. Falling back to Local API'
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export default Vue.extend({
showToast(`${errorMessage}: ${xhr.responseText}`, 10000, () => {
copyToClipboard(xhr.responseText)
})
if (this.backendFallback && this.backendPreference === 'invidious') {
if (process.env.IS_ELECTRON && this.backendFallback && this.backendPreference === 'invidious') {
showToast(this.$t('Falling back to local API'))
this.getCommentDataLocal()
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export default Vue.extend({
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
if (this.backendPreference === 'invidious' && this.backendFallback) {
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
this.getPlaylistInformationLocal()
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/views/Channel/Channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ export default Vue.extend({
showToast(`${errorMessage}: ${err.responseJSON.error}`, 10000, () => {
copyToClipboard(err.responseJSON.error)
})
if (this.backendPreference === 'invidious' && this.backendFallback) {
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
this.getPlaylistsLocal()
} else {
Expand Down Expand Up @@ -532,7 +532,7 @@ export default Vue.extend({
showToast(`${errorMessage}: ${err.responseJSON.error}`, 10000, () => {
copyToClipboard(err.responseJSON.error)
})
if (this.backendPreference === 'invidious' && this.backendFallback) {
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
this.getPlaylistsLocal()
} else {
Expand Down Expand Up @@ -727,7 +727,7 @@ export default Vue.extend({
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
if (this.backendPreference === 'invidious' && this.backendFallback) {
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
this.searchChannelLocal()
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/Playlist/Playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export default Vue.extend({
this.isLoading = false
}).catch((err) => {
console.error(err)
if (this.backendPreference === 'invidious' && this.backendFallback) {
if (process.env.IS_ELECTRON && 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 @@ -268,7 +268,7 @@ export default Vue.extend({
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
if (this.backendPreference === 'invidious' && this.backendFallback) {
if (process.env.IS_ELECTRON && 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/Subscriptions/Subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ export default Vue.extend({
resolve(this.getChannelVideosInvidiousRSS(channel, failedAttempts + 1))
break
case 1:
if (this.backendFallback) {
if (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 @@ -414,7 +414,7 @@ export default Vue.extend({
case 0:
return this.getChannelVideosInvidiousScraper(channel, failedAttempts + 1)
case 1:
if (this.backendFallback) {
if (process.env.IS_ELECTRON && this.backendFallback) {
showToast(this.$t('Falling back to the local API'))
return this.getChannelVideosLocalRSS(channel, failedAttempts + 1)
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ export default Vue.extend({
copyToClipboard(err.responseText)
})
console.error(err)
if (this.backendPreference === 'invidious' && this.backendFallback) {
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to Local API'))
this.getVideoInformationLocal()
} else {
Expand Down Expand Up @@ -1201,7 +1201,7 @@ export default Vue.extend({
}
}

if (this.removeVideoMetaFiles) {
if (process.env.IS_ELECTRON && this.removeVideoMetaFiles) {
if (process.env.NODE_ENV === 'development') {
const dashFileLocation = `static/dashFiles/${videoId}.xml`
const vttFileLocation = `static/storyboards/${videoId}.vtt`
Expand Down