1 import CyTubeUtil
from '../../utilities';
2 import { sendPug
} from '../pug';
4 export default function initialize(app
, webConfig
) {
5 app
.get('/contact', (req
, res
) => {
6 // Basic obfuscation of email addresses to prevent spambots
7 // from picking them up. Not real encryption.
8 // Deobfuscated by clientside JS.
9 const contacts
= webConfig
.getEmailContacts().map(contact
=> {
10 const emkey
= CyTubeUtil
.randomSalt(16);
11 let email
= new Array(contact
.email
.length
);
12 for (let i
= 0; i
< contact
.email
.length
; i
++) {
13 email
[i
] = String
.fromCharCode(
14 contact
.email
.charCodeAt(i
) ^ emkey
.charCodeAt(i
% emkey
.length
)
17 contact
.email
= escape(email
.join(""));
18 contact
.emkey
= escape(emkey
);
22 return sendPug(res
, 'contact', {