Fix toast string and add support for embed URLs when parsing links

This commit is contained in:
Preston 2021-01-14 22:37:52 -05:00
parent c6737cd507
commit 9a75e6a53a
3 changed files with 14 additions and 2 deletions

View File

@ -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([

View File

@ -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_-]+$/)) {

View File

@ -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