From 7822f7423e43f846df1bb2b5f7998dfe8a043198 Mon Sep 17 00:00:00 2001 From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> Date: Thu, 22 Sep 2022 21:04:10 -0400 Subject: [PATCH] Remove console.logs (#2606) * remove console.logs * use 'off' instead of 0 --- .eslintrc.js | 10 +++--- src/main/index.js | 9 ++---- src/renderer/App.js | 4 --- .../components/data-settings/data-settings.js | 9 +++--- .../ft-list-dropdown/ft-list-dropdown.js | 7 ----- .../components/ft-list-video/ft-list-video.js | 3 -- .../ft-profile-edit/ft-profile-edit.js | 2 -- .../ft-video-player/ft-video-player.js | 10 ++---- .../general-settings/general-settings.js | 1 - .../components/playlist-info/playlist-info.js | 1 - src/renderer/components/top-nav/top-nav.js | 4 +-- .../watch-video-comments.js | 10 +++--- .../watch-video-info/watch-video-info.js | 2 -- .../watch-video-live-chat.js | 12 ++----- .../watch-video-playlist.js | 10 ++---- src/renderer/i18n/index.js | 2 +- src/renderer/store/modules/invidious.js | 11 +++---- src/renderer/store/modules/utils.js | 6 ++-- src/renderer/store/modules/ytdl.js | 26 ++-------------- src/renderer/views/Channel/Channel.js | 31 ++++++++----------- src/renderer/views/Playlist/Playlist.js | 14 +++------ src/renderer/views/Popular/Popular.js | 4 +-- .../views/ProfileSettings/ProfileSettings.js | 3 -- src/renderer/views/Search/Search.js | 15 ++------- .../views/Subscriptions/Subscriptions.js | 8 ++--- src/renderer/views/Trending/Trending.js | 7 ++--- src/renderer/views/Watch/Watch.js | 18 ++++------- static/pwabuilder-sw.js | 5 +-- 28 files changed, 70 insertions(+), 174 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 14c73fcd..0700821a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -32,12 +32,12 @@ module.exports = { plugins: ['vue'], rules: { - 'space-before-function-paren': 0, + 'space-before-function-paren': 'off', 'comma-dangle': ['error', 'never'], 'vue/no-v-html': 'off', - 'no-console': 0, - 'no-unused-vars': 1, - 'no-undef': 1, - 'vue/no-template-key': 1 + 'no-console': ['error', { allow: ['warn', 'error'] }], + 'no-unused-vars': 'warn', + 'no-undef': 'warn', + 'vue/no-template-key': 'warn' } } diff --git a/src/main/index.js b/src/main/index.js index dff15bef..4f8e799c 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -9,7 +9,6 @@ import { IpcChannels, DBActions, SyncEvents } from '../constants' import baseHandlers from '../datastores/handlers/base' if (process.argv.includes('--version')) { - console.log(`v${app.getVersion()}`) app.exit() } else { runApp() @@ -172,7 +171,7 @@ function runApp() { require('vue-devtools').install() /* eslint-enable */ } catch (err) { - console.log(err) + console.error(err) } } @@ -195,7 +194,7 @@ function runApp() { return nativeTheme.shouldUseDarkColors ? '#212121' : '#f1f1f1' } }).catch((error) => { - console.log(error) + console.error(error) // Default to nativeTheme settings if nothing is found. return nativeTheme.shouldUseDarkColors ? '#212121' : '#f1f1f1' }) @@ -258,7 +257,6 @@ function runApp() { const boundsDoc = await baseHandlers.settings._findBounds() if (typeof boundsDoc?.value === 'object') { - console.log({ boundsDoc }) const { maximized, fullScreen, ...bounds } = boundsDoc.value const allDisplaysSummaryWidth = screen .getAllDisplays() @@ -348,8 +346,6 @@ function runApp() { // Which raises "Object has been destroyed" error mainWindow = allWindows[0] } - - console.log('closed') }) } @@ -401,7 +397,6 @@ function runApp() { }) ipcMain.on(IpcChannels.ENABLE_PROXY, (_, url) => { - console.log(url) session.defaultSession.setProxy({ proxyRules: url }) diff --git a/src/renderer/App.js b/src/renderer/App.js index afc64838..966a8895 100644 --- a/src/renderer/App.js +++ b/src/renderer/App.js @@ -159,7 +159,6 @@ export default Vue.extend({ this.grabAllPlaylists() if (process.env.IS_ELECTRON) { - console.log('User is using Electron') ipcRenderer = require('electron').ipcRenderer this.setupListenersToSyncWindows() this.activateKeyboardShortcuts() @@ -194,11 +193,8 @@ export default Vue.extend({ }, updateTheme: function (theme) { - console.group('updateTheme') - console.log('Theme: ', theme) document.body.className = `${theme.baseTheme} main${theme.mainColor} sec${theme.secColor}` document.body.dataset.systemTheme = this.systemTheme - console.groupEnd() }, checkForNewUpdates: function () { diff --git a/src/renderer/components/data-settings/data-settings.js b/src/renderer/components/data-settings/data-settings.js index a8596af3..7e823a46 100644 --- a/src/renderer/components/data-settings/data-settings.js +++ b/src/renderer/components/data-settings/data-settings.js @@ -528,8 +528,7 @@ export default Vue.extend({ } }) }).catch((err) => { - console.log(err) - console.log('error reading') + console.error(err) const message = this.$t('Settings.Data Settings.Invalid subscriptions file') this.showToast({ message: `${message}: ${err}` @@ -946,7 +945,7 @@ export default Vue.extend({ this.handleFreetubeImportFile(dbLocation) fs.unlink(dbLocation, (err) => { if (err) { - console.log(err) + console.error(err) } }) }, @@ -1285,7 +1284,7 @@ export default Vue.extend({ this.invidiousAPICall(subscriptionsPayload).then((response) => { resolve(response) }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err.responseJSON.error}`, @@ -1312,7 +1311,7 @@ export default Vue.extend({ ytch.getChannelInfo({ channelId: channelId }).then(async (response) => { resolve(response) }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, diff --git a/src/renderer/components/ft-list-dropdown/ft-list-dropdown.js b/src/renderer/components/ft-list-dropdown/ft-list-dropdown.js index 0c484e37..1f186014 100644 --- a/src/renderer/components/ft-list-dropdown/ft-list-dropdown.js +++ b/src/renderer/components/ft-list-dropdown/ft-list-dropdown.js @@ -31,12 +31,5 @@ export default Vue.extend({ listType: function () { return this.$store.getters.getListType } - }, - mounted: function () { - }, - methods: { - goToChannel: function () { - console.log('TODO: ft-list-channel method goToChannel') - } } }) diff --git a/src/renderer/components/ft-list-video/ft-list-video.js b/src/renderer/components/ft-list-video/ft-list-video.js index 9eae1d85..1c7c9e7c 100644 --- a/src/renderer/components/ft-list-video/ft-list-video.js +++ b/src/renderer/components/ft-list-video/ft-list-video.js @@ -291,9 +291,6 @@ export default Vue.extend({ }, handleOptionsClick: function (option) { - console.log('Handling share') - console.log(option) - switch (option) { case 'history': if (this.watched) { diff --git a/src/renderer/components/ft-profile-edit/ft-profile-edit.js b/src/renderer/components/ft-profile-edit/ft-profile-edit.js index bc740fae..29544729 100644 --- a/src/renderer/components/ft-profile-edit/ft-profile-edit.js +++ b/src/renderer/components/ft-profile-edit/ft-profile-edit.js @@ -111,8 +111,6 @@ export default Vue.extend({ profile._id = this.profileId } - console.log(profile) - if (this.isNew) { this.createProfile(profile) this.showToast({ diff --git a/src/renderer/components/ft-video-player/ft-video-player.js b/src/renderer/components/ft-video-player/ft-video-player.js index 1bfa6bf5..3f728af0 100644 --- a/src/renderer/components/ft-video-player/ft-video-player.js +++ b/src/renderer/components/ft-video-player/ft-video-player.js @@ -157,7 +157,7 @@ export default Vue.extend({ try { return JSON.parse(this.$store.getters.getDefaultCaptionSettings) } catch (e) { - console.log(e) + console.error(e) return {} } }, @@ -343,7 +343,6 @@ export default Vue.extend({ }, methods: { initializePlayer: async function () { - console.log(this.adaptiveFormats) const videoPlayer = document.getElementById(this.id) if (videoPlayer !== null) { if (!this.useDash) { @@ -1034,7 +1033,7 @@ export default Vue.extend({ enableDashFormat: function () { if (this.dashSrc === null) { - console.log('No dash format available.') + console.warn('No dash format available.') return } @@ -1047,7 +1046,7 @@ export default Vue.extend({ enableLegacyFormat: function () { if (this.sourceList.length === 0) { - console.log('No sources available') + console.error('No sources available') return } @@ -1112,7 +1111,6 @@ export default Vue.extend({ const frameTime = 1 / fps const dist = frameTime * step this.player.currentTime(this.player.currentTime() + dist) - console.log(fps) }, changeVolume: function (volume) { @@ -1427,7 +1425,6 @@ export default Vue.extend({ VjsButton.call(this, player, options) }, handleClick: (event) => { - console.log(event) const selectedQuality = event.target.innerText const bitrate = selectedQuality === 'auto' ? 'auto' : parseInt(event.target.attributes.bitrate.value) this.setDashQualityLevel(bitrate) @@ -1685,7 +1682,6 @@ export default Vue.extend({ clearTimeout(this.touchPauseTimeout) }, toggleShowStatsModal: function() { - console.log(this.format) if (this.format !== 'dash') { this.showToast({ message: this.$t('Video.Stats.Video statistics are not available for legacy videos') diff --git a/src/renderer/components/general-settings/general-settings.js b/src/renderer/components/general-settings/general-settings.js index 8adcc92b..36c930c8 100644 --- a/src/renderer/components/general-settings/general-settings.js +++ b/src/renderer/components/general-settings/general-settings.js @@ -205,7 +205,6 @@ export default Vue.extend({ handlePreferredApiBackend: function (backend) { this.updateBackendPreference(backend) - console.log(backend) if (backend === 'local') { this.updateForceLocalBackendForLegacy(false) diff --git a/src/renderer/components/playlist-info/playlist-info.js b/src/renderer/components/playlist-info/playlist-info.js index df905d51..f3ac378b 100644 --- a/src/renderer/components/playlist-info/playlist-info.js +++ b/src/renderer/components/playlist-info/playlist-info.js @@ -82,7 +82,6 @@ export default Vue.extend({ } }, mounted: function () { - console.log(this.data) this.id = this.data.id this.firstVideoId = this.data.firstVideoId this.title = this.data.title diff --git a/src/renderer/components/top-nav/top-nav.js b/src/renderer/components/top-nav/top-nav.js index 30ec3db9..92ddc31e 100644 --- a/src/renderer/components/top-nav/top-nav.js +++ b/src/renderer/components/top-nav/top-nav.js @@ -252,9 +252,9 @@ export default Vue.extend({ this.invidiousAPICall(searchPayload).then((results) => { this.searchSuggestionsDataList = results.suggestions }).catch((err) => { - console.log(err) + console.error(err) if (this.backendFallback) { - console.log( + console.error( 'Error gettings search suggestions. Falling back to Local API' ) this.getSearchSuggestionsLocal(query) diff --git a/src/renderer/components/watch-video-comments/watch-video-comments.js b/src/renderer/components/watch-video-comments/watch-video-comments.js index cf06c3e3..f1769399 100644 --- a/src/renderer/components/watch-video-comments/watch-video-comments.js +++ b/src/renderer/components/watch-video-comments/watch-video-comments.js @@ -182,7 +182,7 @@ export default Vue.extend({ ytcm.getComments(payload).then((response) => { this.parseLocalCommentData(response, null) }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -217,7 +217,7 @@ export default Vue.extend({ ytcm.getCommentReplies(payload).then((response) => { this.parseLocalCommentData(response, payload.index) }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -332,8 +332,7 @@ export default Vue.extend({ this.isLoading = false this.showComments = true }).catch((xhr) => { - console.log('found an error') - console.log(xhr) + console.error(xhr) const errorMessage = this.$t('Invidious API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${xhr.responseText}`, @@ -389,8 +388,7 @@ export default Vue.extend({ this.commentData[index].showReplies = true this.isLoading = false }).catch((xhr) => { - console.log('found an error') - console.log(xhr) + console.error(xhr) const errorMessage = this.$t('Invidious API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${xhr.responseText}`, diff --git a/src/renderer/components/watch-video-info/watch-video-info.js b/src/renderer/components/watch-video-info/watch-video-info.js index d199cb4d..f7bd40a6 100644 --- a/src/renderer/components/watch-video-info/watch-video-info.js +++ b/src/renderer/components/watch-video-info/watch-video-info.js @@ -2,7 +2,6 @@ import Vue from 'vue' import { mapActions } from 'vuex' import FtCard from '../ft-card/ft-card.vue' import FtButton from '../ft-button/ft-button.vue' -import FtListDropdown from '../ft-list-dropdown/ft-list-dropdown.vue' import FtFlexBox from '../ft-flex-box/ft-flex-box.vue' import FtIconButton from '../ft-icon-button/ft-icon-button.vue' import FtShareButton from '../ft-share-button/ft-share-button.vue' @@ -14,7 +13,6 @@ export default Vue.extend({ components: { 'ft-card': FtCard, 'ft-button': FtButton, - 'ft-list-dropdown': FtListDropdown, 'ft-flex-box': FtFlexBox, 'ft-icon-button': FtIconButton, 'ft-share-button': FtShareButton diff --git a/src/renderer/components/watch-video-live-chat/watch-video-live-chat.js b/src/renderer/components/watch-video-live-chat/watch-video-live-chat.js index 572707b3..81ea8dc1 100644 --- a/src/renderer/components/watch-video-live-chat/watch-video-live-chat.js +++ b/src/renderer/components/watch-video-live-chat/watch-video-live-chat.js @@ -85,7 +85,6 @@ export default Vue.extend({ } else { switch (this.backendPreference) { case 'local': - console.log('Getting Chat') this.getLiveChatLocal() break case 'invidious': @@ -115,13 +114,12 @@ export default Vue.extend({ this.isLoading = false this.liveChat.on('start', (liveId) => { - console.log('Live chat is enabled') this.isLoading = false }) this.liveChat.on('end', (reason) => { - console.log('Live chat has ended') - console.log(reason) + console.error('Live chat has ended') + console.error(reason) this.hasError = true this.showEnableChat = false this.errorMessage = this.$t('Video["Chat is disabled or the Live Stream has ended."]') @@ -141,8 +139,6 @@ export default Vue.extend({ }, parseLiveChatComment: function (comment) { - console.log(comment) - if (this.hasEnded) { return } @@ -171,13 +167,12 @@ export default Vue.extend({ const liveChatMessage = $('.liveChatMessage') if (typeof (liveChatComments.get(0)) === 'undefined' && typeof (liveChatMessage.get(0)) === 'undefined') { - console.log("Can't find chat object. Stopping chat connection") + console.error("Can't find chat object. Stopping chat connection") this.liveChat.stop() return } this.comments.push(comment) - console.log(this.comments.length) if (typeof (comment.superchat) !== 'undefined') { this.getRandomColorClass().then((data) => { @@ -211,7 +206,6 @@ export default Vue.extend({ } if (this.comments.length > 150 && this.stayAtBottom) { - console.log('user is not at bottom') this.comments = this.comments.splice(this.comments.length - 150, this.comments.length) } }, diff --git a/src/renderer/components/watch-video-playlist/watch-video-playlist.js b/src/renderer/components/watch-video-playlist/watch-video-playlist.js index 91f3a6af..6e01937c 100644 --- a/src/renderer/components/watch-video-playlist/watch-video-playlist.js +++ b/src/renderer/components/watch-video-playlist/watch-video-playlist.js @@ -278,9 +278,6 @@ export default Vue.extend({ this.isLoading = true this.ytGetPlaylistInfo(this.playlistId).then((result) => { - console.log('done') - console.log(result) - this.playlistTitle = result.title this.playlistItems = result.items this.videoCount = result.estimatedItemCount @@ -307,7 +304,7 @@ export default Vue.extend({ this.isLoading = false }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -336,9 +333,6 @@ export default Vue.extend({ } this.invidiousGetPlaylistInfo(payload).then((result) => { - console.log('done') - console.log(result) - this.playlistTitle = result.title this.videoCount = result.videoCount this.channelName = result.author @@ -348,7 +342,7 @@ export default Vue.extend({ this.isLoading = false }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, diff --git a/src/renderer/i18n/index.js b/src/renderer/i18n/index.js index 7447e2c3..df870e32 100644 --- a/src/renderer/i18n/index.js +++ b/src/renderer/i18n/index.js @@ -20,7 +20,7 @@ activeLocales.forEach((locale) => { const doc = yaml.load(fs.readFileSync(`${fileLocation}${locale}.yaml`)) messages[locale] = doc } catch (e) { - console.log(e) + console.error(e) } }) diff --git a/src/renderer/store/modules/invidious.js b/src/renderer/store/modules/invidious.js index 494e8648..9631932e 100644 --- a/src/renderer/store/modules/invidious.js +++ b/src/renderer/store/modules/invidious.js @@ -46,7 +46,7 @@ const actions = { /* eslint-disable-next-line */ const fileLocation = payload.isDev ? './static/' : `${__dirname}/static/` if (fs.existsSync(`${fileLocation}${fileName}`)) { - console.log('reading static file for invidious instances') + console.warn('reading static file for invidious instances') const fileData = fs.readFileSync(`${fileLocation}${fileName}`) instances = JSON.parse(fileData).map((entry) => { return entry.url @@ -98,8 +98,7 @@ const actions = { dispatch('invidiousAPICall', payload).then((response) => { resolve(response) }).catch((xhr) => { - console.log('found an error') - console.log(xhr) + console.error(xhr) commit('toggleIsGetChannelInfoRunning') reject(xhr) }) @@ -111,8 +110,7 @@ const actions = { dispatch('invidiousAPICall', payload).then((response) => { resolve(response) }).catch((xhr) => { - console.log('found an error') - console.log(xhr) + console.error(xhr) commit('toggleIsGetChannelInfoRunning') reject(xhr) }) @@ -130,8 +128,7 @@ const actions = { dispatch('invidiousAPICall', payload).then((response) => { resolve(response) }).catch((xhr) => { - console.log('found an error') - console.log(xhr) + console.error(xhr) reject(xhr) }) }) diff --git a/src/renderer/store/modules/utils.js b/src/renderer/store/modules/utils.js index caffd10a..5934d103 100644 --- a/src/renderer/store/modules/utils.js +++ b/src/renderer/store/modules/utils.js @@ -337,7 +337,7 @@ const actions = { }) const response = await fetch(url).catch((error) => { - console.log(error) + console.error(error) dispatch('showToast', { message: errorMessage }) @@ -347,7 +347,7 @@ const actions = { const chunks = [] const handleError = (err) => { - console.log(err) + console.error(err) dispatch('showToast', { message: errorMessage }) @@ -1128,8 +1128,6 @@ const actions = { message: openingToast }) - console.log(executable, args) - const { ipcRenderer } = require('electron') ipcRenderer.send(IpcChannels.OPEN_IN_EXTERNAL_PLAYER, { executable, args }) } diff --git a/src/renderer/store/modules/ytdl.js b/src/renderer/store/modules/ytdl.js index b9fa01b8..828439d2 100644 --- a/src/renderer/store/modules/ytdl.js +++ b/src/renderer/store/modules/ytdl.js @@ -17,10 +17,8 @@ const getters = {} const actions = { ytSearch ({ commit, dispatch, rootState }, payload) { - console.log('Performing search please wait...') return new Promise((resolve, reject) => { if (state.isYtSearchRunning) { - console.log('search is running. please try again') resolve(false) } @@ -90,27 +88,23 @@ const actions = { const query = filter || payload.query ytsr(query, payload.options).then((result) => { - console.log(result) - console.log('done') resolve(result) }).catch((err) => { - console.log(err) + console.error(err) reject(err) }).finally(() => { commit('toggleIsYtSearchRunning') }) }).catch((err) => { - console.log(err) + console.error(err) commit('toggleIsYtSearchRunning') reject(err) }) } else { ytsr(payload.query, payload.options).then((result) => { - console.log(result) - console.log('done') resolve(result) }).catch((err) => { - console.log(err) + console.error(err) reject(err) }).finally(() => { commit('toggleIsYtSearchRunning') @@ -172,9 +166,6 @@ const actions = { searchSettings = rootState.utils.searchSettings } - console.log(searchSettings) - console.log(filter) - if (searchSettings.sortBy !== 'relevance') { let filterValue switch (searchSettings.sortBy) { @@ -192,8 +183,6 @@ const actions = { filter = await ytsr.getFilters(filterUrl, options) } - console.log(`Current ref: ${filterUrl}`) - if (searchSettings.duration !== '') { let filterValue = null if (searchSettings.duration === 'short') { @@ -206,8 +195,6 @@ const actions = { filter = await ytsr.getFilters(filterUrl, options) } - console.log(`Current ref: ${filterUrl}`) - if (searchSettings.time !== '') { let filterValue = null @@ -233,16 +220,12 @@ const actions = { filter = await ytsr.getFilters(filterUrl, options) } - console.log(`Current ref: ${filterUrl}`) - if (searchSettings.type !== 'all') { const filterValue = searchSettings.type.charAt(0).toUpperCase() + searchSettings.type.slice(1) filterUrl = filter.get('Type').get(filterValue).url filter = await ytsr.getFilters(filterUrl, options) } - console.log(`Current ref: ${filterUrl}`) - return new Promise((resolve, reject) => { resolve(filterUrl) }) @@ -250,8 +233,6 @@ const actions = { ytGetPlaylistInfo ({ rootState }, playlistId) { return new Promise((resolve, reject) => { - console.log(playlistId) - console.log('Getting playlist info please wait...') let agent = null const settings = rootState.settings const useProxy = settings.useProxy @@ -310,7 +291,6 @@ const actions = { ytGetVideoInformation ({ rootState }, videoId) { return new Promise((resolve, reject) => { - console.log('Getting video info please wait...') let agent = null const settings = rootState.settings const useProxy = settings.useProxy diff --git a/src/renderer/views/Channel/Channel.js b/src/renderer/views/Channel/Channel.js index 07df2aca..9bf3d3b7 100644 --- a/src/renderer/views/Channel/Channel.js +++ b/src/renderer/views/Channel/Channel.js @@ -304,7 +304,7 @@ export default Vue.extend({ this.isLoading = false }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -336,7 +336,7 @@ export default Vue.extend({ this.videoContinuationString = response.continuation this.isElementListLoading = false }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -361,7 +361,7 @@ export default Vue.extend({ this.latestVideos = this.latestVideos.concat(response.items) this.videoContinuationString = response.continuation }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -383,7 +383,6 @@ export default Vue.extend({ return } - console.log(response) const channelName = response.author const channelId = response.authorId this.channelName = channelName @@ -416,7 +415,7 @@ export default Vue.extend({ this.isLoading = false }).catch((err) => { this.setErrorMessage(err.responseJSON.error) - console.log(err) + console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err.responseJSON.error}`, @@ -444,7 +443,7 @@ export default Vue.extend({ this.latestVideosPage++ this.isElementListLoading = false }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -463,7 +462,6 @@ export default Vue.extend({ return } - console.log(response) this.latestPlaylists = response.items.map((item) => { item.proxyThumbnail = false return item @@ -471,7 +469,7 @@ export default Vue.extend({ this.playlistContinuationString = response.continuation this.isElementListLoading = false }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -493,11 +491,10 @@ export default Vue.extend({ getPlaylistsLocalMore: function () { ytch.getChannelPlaylistsMore({ continuation: this.playlistContinuationString }).then((response) => { - console.log(response) this.latestPlaylists = this.latestPlaylists.concat(response.items) this.playlistContinuationString = response.continuation }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -523,7 +520,7 @@ export default Vue.extend({ this.latestPlaylists = response.playlists this.isElementListLoading = false }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err.responseJSON.error}`, @@ -545,7 +542,7 @@ export default Vue.extend({ getPlaylistsInvidiousMore: function () { if (this.playlistContinuationString === null) { - console.log('There are no more playlists available for this channel') + console.warn('There are no more playlists available for this channel') return } @@ -566,7 +563,7 @@ export default Vue.extend({ this.latestPlaylists = this.latestPlaylists.concat(response.playlists) this.isElementListLoading = false }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err.responseJSON.error}`, @@ -727,12 +724,11 @@ export default Vue.extend({ searchChannelLocal: function () { if (this.searchContinuationString === '') { ytch.searchChannel({ channelId: this.id, channelIdType: this.idType, query: this.lastSearchQuery }).then((response) => { - console.log(response) this.searchResults = response.items this.isElementListLoading = false this.searchContinuationString = response.continuation }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -752,12 +748,11 @@ export default Vue.extend({ }) } else { ytch.searchChannelMore({ continuation: this.searchContinuationString }).then((response) => { - console.log(response) this.searchResults = this.searchResults.concat(response.items) this.isElementListLoading = false this.searchContinuationString = response.continuation }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -785,7 +780,7 @@ export default Vue.extend({ this.isElementListLoading = false this.searchPage++ }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, diff --git a/src/renderer/views/Playlist/Playlist.js b/src/renderer/views/Playlist/Playlist.js index 2719a5c0..2fcfb66b 100644 --- a/src/renderer/views/Playlist/Playlist.js +++ b/src/renderer/views/Playlist/Playlist.js @@ -67,9 +67,6 @@ export default Vue.extend({ this.isLoading = true this.ytGetPlaylistInfo(this.playlistId).then((result) => { - console.log('done') - console.log(result) - this.infoData = { id: result.id, title: result.title, @@ -107,9 +104,9 @@ export default Vue.extend({ this.isLoading = false }).catch((err) => { - console.log(err) + console.error(err) if (this.backendPreference === 'local' && this.backendFallback) { - console.log('Falling back to Invidious API') + console.warn('Falling back to Invidious API') this.getPlaylistInvidious() } else { this.isLoading = false @@ -126,9 +123,6 @@ export default Vue.extend({ } this.invidiousGetPlaylistInfo(payload).then((result) => { - console.log('done') - console.log(result) - this.infoData = { id: result.playlistId, title: result.title, @@ -155,9 +149,9 @@ export default Vue.extend({ this.isLoading = false }).catch((err) => { - console.log(err) + console.error(err) if (this.backendPreference === 'invidious' && this.backendFallback) { - console.log('Error getting data with Invidious, falling back to local backend') + console.warn('Error getting data with Invidious, falling back to local backend') this.getPlaylistLocal() } else { this.isLoading = false diff --git a/src/renderer/views/Popular/Popular.js b/src/renderer/views/Popular/Popular.js index e56dcecc..634a12e5 100644 --- a/src/renderer/views/Popular/Popular.js +++ b/src/renderer/views/Popular/Popular.js @@ -41,7 +41,7 @@ export default Vue.extend({ this.isLoading = true const result = await this.invidiousAPICall(searchPayload) .catch((err) => { - console.log(err) + console.error(err) }) if (!result) { @@ -49,8 +49,6 @@ export default Vue.extend({ return } - console.log(result) - this.shownResults = result.filter((item) => { return item.type === 'video' || item.type === 'shortVideo' || item.type === 'channel' || item.type === 'playlist' }) diff --git a/src/renderer/views/ProfileSettings/ProfileSettings.js b/src/renderer/views/ProfileSettings/ProfileSettings.js index 2547f4e9..007be833 100644 --- a/src/renderer/views/ProfileSettings/ProfileSettings.js +++ b/src/renderer/views/ProfileSettings/ProfileSettings.js @@ -17,9 +17,6 @@ export default Vue.extend({ return this.$store.getters.getProfileList } }, - mounted: function () { - console.log(this.profileList) - }, methods: { newProfile: function () { this.$router.push({ diff --git a/src/renderer/views/Search/Search.js b/src/renderer/views/Search/Search.js index a7196351..15af0170 100644 --- a/src/renderer/views/Search/Search.js +++ b/src/renderer/views/Search/Search.js @@ -72,7 +72,6 @@ export default Vue.extend({ }, mounted: function () { this.query = this.$route.params.query - console.log(this.$route) this.searchSettings = { sortBy: this.$route.query.sortBy, @@ -100,8 +99,6 @@ export default Vue.extend({ this.isLoading = true if (sameSearch.length > 0) { - console.log(sameSearch) - // Replacing the data right away causes a strange error where the data // Shown is mixed from 2 different search results. So we'll wait a moment // Before showing the results. @@ -129,7 +126,6 @@ export default Vue.extend({ payload.options.safeSearch = this.showFamilyFriendlyOnly this.ytSearch(payload).then((result) => { - console.log(result) if (!result) { return } @@ -201,7 +197,7 @@ export default Vue.extend({ this.$store.commit('addToSessionSearchHistory', historyPayload) }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -225,7 +221,6 @@ export default Vue.extend({ if (this.searchPage === 1) { this.isLoading = true } - console.log(payload) const searchPayload = { resource: 'search', @@ -247,14 +242,10 @@ export default Vue.extend({ this.apiUsed = 'invidious' - console.log(result) - const returnData = result.filter((item) => { return item.type === 'video' || item.type === 'channel' || item.type === 'playlist' }) - console.log(returnData) - if (this.searchPage !== 1) { this.shownResults = this.shownResults.concat(returnData) } else { @@ -273,7 +264,7 @@ export default Vue.extend({ this.$store.commit('addToSessionSearchHistory', historyPayload) }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -304,8 +295,6 @@ export default Vue.extend({ } } - console.log(payload) - if (this.apiUsed === 'local') { if (this.amountOfResults <= this.shownResults.length) { this.showToast({ diff --git a/src/renderer/views/Subscriptions/Subscriptions.js b/src/renderer/views/Subscriptions/Subscriptions.js index 62f54f5f..c1dd5d5c 100644 --- a/src/renderer/views/Subscriptions/Subscriptions.js +++ b/src/renderer/views/Subscriptions/Subscriptions.js @@ -254,7 +254,7 @@ export default Vue.extend({ resolve(videos) }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -313,7 +313,7 @@ export default Vue.extend({ resolve(items) }).catch((err) => { - console.log(err) + console.error(err) if (err.toString().match(/404/)) { this.errorChannels.push(channel) resolve([]) @@ -365,7 +365,7 @@ export default Vue.extend({ return video }))) }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err.responseText}`, @@ -416,7 +416,7 @@ export default Vue.extend({ return video }))) }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, diff --git a/src/renderer/views/Trending/Trending.js b/src/renderer/views/Trending/Trending.js index d3c13c70..718b8540 100644 --- a/src/renderer/views/Trending/Trending.js +++ b/src/renderer/views/Trending/Trending.js @@ -107,7 +107,6 @@ export default Vue.extend({ getTrendingInfoLocal: function () { this.isLoading = true - console.log('getting local trending') const param = { parseCreatorOnRise: false, page: this.currentTab, @@ -126,7 +125,7 @@ export default Vue.extend({ }).then(() => { document.querySelector(`#${this.currentTab}Tab`).focus() }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err}`, @@ -172,8 +171,6 @@ export default Vue.extend({ return } - console.log(result) - const returnData = result.filter((item) => { return item.type === 'video' || item.type === 'channel' || item.type === 'playlist' }) @@ -185,7 +182,7 @@ export default Vue.extend({ }).then(() => { document.querySelector(`#${this.currentTab}Tab`).focus() }).catch((err) => { - console.log(err) + console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err.responseText}`, diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index 3478eb06..cb3341e2 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -245,8 +245,6 @@ export default Vue.extend({ this.ytGetVideoInformation(this.videoId) .then(async result => { - console.log(result) - const playabilityStatus = result.player_response.playabilityStatus if (playabilityStatus.status === 'UNPLAYABLE') { const errorScreen = playabilityStatus.errorScreen.playerErrorMessageRenderer @@ -284,7 +282,6 @@ export default Vue.extend({ if ('id' in result.videoDetails.author) { this.channelId = result.player_response.videoDetails.channelId this.channelName = result.videoDetails.author.name - console.log(result) if (result.videoDetails.author.thumbnails.length > 0) { this.channelThumbnail = result.videoDetails.author.thumbnails[0].url } @@ -607,7 +604,7 @@ export default Vue.extend({ this.copyToClipboard({ content: err }) } }) - console.log(err) + console.error(err) if (this.backendPreference === 'local' && this.backendFallback && !err.toString().includes('private')) { this.showToast({ message: this.$t('Falling back to Invidious API') @@ -629,8 +626,6 @@ export default Vue.extend({ this.invidiousGetVideoInformation(this.videoId) .then(result => { - console.log(result) - if (result.error) { throw new Error(result.error) } @@ -784,6 +779,7 @@ export default Vue.extend({ this.isLoading = false }) .catch(err => { + console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') this.showToast({ message: `${errorMessage}: ${err.responseText}`, @@ -792,7 +788,7 @@ export default Vue.extend({ this.copyToClipboard({ content: err.responseText }) } }) - console.log(err) + console.error(err) if (this.backendPreference === 'invidious' && this.backendFallback) { this.showToast({ message: this.$t('Falling back to Local API') @@ -894,8 +890,6 @@ export default Vue.extend({ return video.videoId === this.videoId }) - console.log(historyIndex) - if (!this.isLive) { if (this.timestamp) { if (this.timestamp < 0) { @@ -963,7 +957,7 @@ export default Vue.extend({ this.copyToClipboard({ content: err }) } }) - console.log(err) + console.error(err) if (!process.env.IS_ELECTRON || (this.backendPreference === 'local' && this.backendFallback)) { this.showToast({ message: this.$t('Falling back to Invidious API') @@ -1162,14 +1156,14 @@ export default Vue.extend({ }, handleVideoError: function (error) { - console.log(error) + console.error(error) if (this.isLive) { return } if (error.code === 4) { if (this.activeFormat === 'dash') { - console.log( + console.warn( 'Unable to play dash formats. Reverting to legacy formats...' ) this.enableLegacyFormat() diff --git a/static/pwabuilder-sw.js b/static/pwabuilder-sw.js index ff5c3c7e..bc108b31 100644 --- a/static/pwabuilder-sw.js +++ b/static/pwabuilder-sw.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ // This is the service worker with the Advanced caching const CACHE = 'pwabuilder-adv-cache' @@ -110,7 +111,7 @@ function cacheFirstFetch(event) { return } - console.log('[PWA Builder] Network request failed and no cache.' + error) + console.error('[PWA Builder] Network request failed and no cache.' + error) // Use the precached offline page as fallback return caches.open(CACHE).then(function (cache) { cache.match(offlineFallbackPage) @@ -130,7 +131,7 @@ function networkFirstFetch(event) { return response }) .catch(function (error) { - console.log('[PWA Builder] Network request Failed. Serving content from cache: ' + error) + console.error('[PWA Builder] Network request Failed. Serving content from cache: ' + error) return fromCache(event.request) }) )