jschan - Anonymous imageboard software. Classic look, modern features and feel. Works without JavaScript and supports Tor, I2P, Lokinet, etc.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
'use strict';
|
|
|
|
|
|
|
|
module.exports = (permLevel, match, p1, p2, p3, offset, string, groups) => {
|
|
|
|
|
|
|
|
let { url, label, urlOnly } = groups;
|
|
|
|
|
|
|
|
url = url || urlOnly;
|
|
|
|
if (permLevel >= 4) {
|
|
|
|
label = url
|
|
|
|
.replace(/\(/g, '(')
|
|
|
|
.replace(/\)/g, ')');
|
|
|
|
}
|
|
|
|
url = url.replace(/\(/g, '%28')
|
|
|
|
.replace(/\)/g, '%29');
|
|
|
|
|
|
|
|
/*
|
|
|
|
//todo: Something to revisit later
|
|
|
|
const href = url;
|
|
|
|
if (urlOnly == null) {
|
|
|
|
try {
|
|
|
|
const urlObject = new URL(url);
|
|
|
|
if (config.get.allowedHosts.includes(urlObject.hostname)) {
|
|
|
|
href = `${urlObject.pathname}${urlObject.search}${urlObject.hash}`;
|
|
|
|
}
|
|
|
|
} catch (e) { }
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
return `<a rel='nofollow' referrerpolicy='same-origin' target='_blank' href='${url}'>${label || url}</a>`;
|
|
|
|
|
|
|
|
};
|