From f3cc3dc515ee560d77b9a98bc4eb63777f57c444 Mon Sep 17 00:00:00 2001 From: Ashley Date: Thu, 2 Mar 2023 20:42:03 +0000 Subject: [PATCH] add linkifiy yaayayyaya --- src/libpoketube/init/pages-video.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libpoketube/init/pages-video.js b/src/libpoketube/init/pages-video.js index 31388152..46c60392 100644 --- a/src/libpoketube/init/pages-video.js +++ b/src/libpoketube/init/pages-video.js @@ -195,6 +195,16 @@ module.exports = function (app, config, renderTemplate) { ].includes(req.hostname); const verify = req.hostname === "pt.zzls.xyz"; + function linkify(text) { + // regular expression to match URLs + const urlRegex = /(https?:\/\/[^\s]+)/g; + + return text.replace(urlRegex, (url) => { + // wrap the URL in an tag with the URL as the href attribute + return `${url}`; + }); + } + const response = await modules.fetch("http://ip-api.com/json/"); const ip = await response.json(); @@ -233,6 +243,7 @@ module.exports = function (app, config, renderTemplate) { renderTemplate(res, req, "poketube.ejs", { color: data.color, color2: data.color2, + linkify, engagement, support, u,