From 0207a4ee691fc5fa20d09175e7842c77a24d8233 Mon Sep 17 00:00:00 2001 From: Ashley Date: Mon, 24 Apr 2023 17:01:04 +0000 Subject: [PATCH] add linkify to lite lel --- src/libpoketube/init/pages-video.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/libpoketube/init/pages-video.js b/src/libpoketube/init/pages-video.js index a36e1b52..01b266a3 100644 --- a/src/libpoketube/init/pages-video.js +++ b/src/libpoketube/init/pages-video.js @@ -3,6 +3,17 @@ const { IsJsonString, convert, getFirstLine, capitalizeFirstLetter, turntomins, const media_proxy = require("../libpoketube-video.js"); const atmos = require("../../../pokeatmosurls.json"); + +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 sha384 = modules.hash; const fetch = modules.fetch; const htmlToText = require("html-to-text"); @@ -175,15 +186,6 @@ 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}`; - }); - } core.video(v).then((data) => { try { @@ -267,6 +269,7 @@ core.video(v).then((data) => { const { v, e, r, f, t, quality: q } = req.query; try { + const info = await modules.fetch("http://ip-api.com/json/"); const ip = await info.json(); @@ -301,6 +304,7 @@ core.video(v).then((data) => { inv: comments, ip, convert, + linkify, wiki, f, t: config.t_url,