Properly rewrite channel descriptions

This commit is contained in:
Bnyro
2023-01-30 19:42:57 +01:00
parent fe0fe2ab18
commit 5978848327
3 changed files with 11 additions and 8 deletions

View File

@@ -251,6 +251,15 @@ const mixin = {
elem.click();
elem.remove();
},
rewriteDescription(text) {
return this.urlify(text)
.replaceAll(/(?:http(?:s)?:\/\/)?(?:www\.)?youtube\.com(\/[/a-zA-Z0-9_?=&-]*)/gm, "$1")
.replaceAll(
/(?:http(?:s)?:\/\/)?(?:www\.)?youtu\.be\/(?:watch\?v=)?([/a-zA-Z0-9_?=&-]*)/gm,
"/watch?v=$1",
)
.replaceAll("\n", "<br>");
},
},
computed: {
authenticated(_this) {