mirror of
https://github.com/TeamPiped/Piped.git
synced 2025-12-25 22:20:20 +00:00
feat(hyperlinking): hyperlinking URLs in the channel descriptions (#304)
* feat(hyperlinking): hyperlinking URLs in the channel descriptions * fix(hyperlinking): fixed url detection * fix(hyperlinking): purify channel descriptions to prevent XSS vulnerability
This commit is contained in:
@@ -158,6 +158,13 @@ const mixin = {
|
||||
timeAgo(time) {
|
||||
return timeAgo.format(time);
|
||||
},
|
||||
urlify(string) {
|
||||
const regex = /(((https?:\/\/)|(www\.))[^\s]+)/g;
|
||||
if (!string) return '';
|
||||
return string.replace(regex, (url) => {
|
||||
return `<a class="uk-button uk-button-text" href="${url}" target="_blank">${url}</a>`
|
||||
})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
backgroundColor() {
|
||||
|
||||
Reference in New Issue
Block a user