Use shorter youtu.be links instead of youtube.com for YouTube share links (#671)

This commit is contained in:
fatpowaranga 2020-10-20 00:11:50 +10:00 committed by GitHub
parent b578be1059
commit 02231537f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -93,6 +93,10 @@ export default Vue.extend({
return `https://www.youtube.com/watch?v=${this.id}`
},
youtubeShareUrl: function () {
return `https://youtu.be/${this.id}`
},
youtubeEmbedUrl: function () {
return `https://www.youtube-nocookie.com/embed/${this.id}`
},
@ -168,7 +172,7 @@ export default Vue.extend({
}
break
case 'copyYoutube':
navigator.clipboard.writeText(this.youtubeUrl)
navigator.clipboard.writeText(this.youtubeShareUrl)
this.showToast({
message: this.$t('Share.YouTube URL copied to clipboard')
})

View File

@ -50,6 +50,10 @@ export default Vue.extend({
return `https://www.youtube.com/watch?v=${this.id}`
},
youtubeShareURL() {
return `https://youtu.be/${this.id}`
},
youtubeEmbedURL() {
return `https://www.youtube-nocookie.com/embed/${this.id}`
}
@ -88,7 +92,7 @@ export default Vue.extend({
this.showToast({
message: this.$t('Share.YouTube URL copied to clipboard')
})
this.copy(this.getFinalUrl(this.youtubeURL))
this.copy(this.getFinalUrl(this.youtubeShareURL))
this.$refs.iconButton.focusOut()
},