From 9a75e6a53a1e153e10e77f95be5be1ed7a9e04a9 Mon Sep 17 00:00:00 2001 From: Preston Date: Thu, 14 Jan 2021 22:37:52 -0500 Subject: [PATCH] Fix toast string and add support for embed URLs when parsing links --- .../components/watch-video-info/watch-video-info.js | 6 +++++- src/renderer/store/modules/utils.js | 6 ++++++ src/renderer/views/Watch/Watch.js | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) 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 8ba60799..52356b3d 100644 --- a/src/renderer/components/watch-video-info/watch-video-info.js +++ b/src/renderer/components/watch-video-info/watch-video-info.js @@ -355,7 +355,7 @@ export default Vue.extend({ this.addVideo(payload) this.showToast({ - message: this.$t('Video.Video has been marked as watched') + message: this.$t('Video.Video has been saved') }) }, @@ -366,6 +366,10 @@ export default Vue.extend({ } this.removeVideo(payload) + + this.showToast({ + message: this.$t('Video.Video has been removed from your saved list') + }) }, ...mapActions([ diff --git a/src/renderer/store/modules/utils.js b/src/renderer/store/modules/utils.js index 292d408e..16f28a9e 100644 --- a/src/renderer/store/modules/utils.js +++ b/src/renderer/store/modules/utils.js @@ -212,6 +212,12 @@ const actions = { return urlObject.pathname.slice(1) } }, + // youtube.com/embed + function() { + if (urlObject.pathname.match(/^\/embed\/[A-Za-z0-9_-]+$/)) { + return urlObject.pathname.replace('/embed/', '') + } + }, // cloudtube function() { if (urlObject.host.match(/^cadence\.(gq|moe)$/) && urlObject.pathname.match(/^\/cloudtube\/video\/[A-Za-z0-9_-]+$/)) { diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index 1155c7c1..e1e19785 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -237,7 +237,9 @@ export default Vue.extend({ this.channelId = result.player_response.videoDetails.channelId this.channelName = result.videoDetails.author.name console.log(result) - this.channelThumbnail = result.videoDetails.author.thumbnails[0].url + if (result.videoDetails.author.thumbnails.length > 0) { + this.channelThumbnail = result.videoDetails.author.thumbnails[0].url + } } else { this.channelId = result.player_response.videoDetails.channelId this.channelName = result.player_response.videoDetails.author