mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-17 08:34:42 -05:00
add linkifiy yaayayyaya
This commit is contained in:
parent
dc2b8b7769
commit
851f768cb5
1 changed files with 11 additions and 0 deletions
|
@ -195,6 +195,16 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
].includes(req.hostname);
|
].includes(req.hostname);
|
||||||
const verify = req.hostname === "pt.zzls.xyz";
|
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 <a> tag with the URL as the href attribute
|
||||||
|
return `<a href="${url.replace("https://youtube.com", "").replace("https://youtu.be", "")}" target="_blank">${url}</a>`;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const response = await modules.fetch("http://ip-api.com/json/");
|
const response = await modules.fetch("http://ip-api.com/json/");
|
||||||
const ip = await response.json();
|
const ip = await response.json();
|
||||||
|
|
||||||
|
@ -233,6 +243,7 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
renderTemplate(res, req, "poketube.ejs", {
|
renderTemplate(res, req, "poketube.ejs", {
|
||||||
color: data.color,
|
color: data.color,
|
||||||
color2: data.color2,
|
color2: data.color2,
|
||||||
|
linkify,
|
||||||
engagement,
|
engagement,
|
||||||
support,
|
support,
|
||||||
u,
|
u,
|
||||||
|
|
Loading…
Reference in a new issue