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.
 
 
 
 
 

33 lines
838 B

'use strict';
const { Permissions } = require(__dirname+'/../../../permission/permissions.js');
module.exports = (permissions, match, p1, p2, p3, offset, string, groups) => {
let { url, label, urlOnly } = groups;
url = url || urlOnly;
if (!permissions.get(Permissions.MANAGE_BOARD_GENERAL)) {
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>`;
};