mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-17 21:25:54 +02:00
41 lines
853 B
JavaScript
41 lines
853 B
JavaScript
export function customAPIurl() {
|
|
const url = new URL(process.env.SERVER_URL);
|
|
return url.pathname === '/api/app' ? url.origin + '/api' : url.origin;
|
|
}
|
|
|
|
export const color = [
|
|
'#93a3db',
|
|
'#e6c3db',
|
|
'#c0e3bc',
|
|
'#bce3db',
|
|
'#b8ccdb',
|
|
'#ceb8db',
|
|
'#ffccff',
|
|
'#99ffcc',
|
|
'#cc99ff',
|
|
'#ffcc99',
|
|
'#66ccff',
|
|
'#ffffcc',
|
|
];
|
|
|
|
export function replaceMailVaribles(subject, body, variables) {
|
|
let replacedSubject = subject;
|
|
let replacedBody = body;
|
|
|
|
for (const variable in variables) {
|
|
const regex = new RegExp(`{{${variable}}}`, 'g');
|
|
if (subject) {
|
|
replacedSubject = replacedSubject.replace(regex, variables[variable]);
|
|
}
|
|
if (body) {
|
|
replacedBody = replacedBody.replace(regex, variables[variable]);
|
|
}
|
|
}
|
|
|
|
const result = {
|
|
subject: replacedSubject,
|
|
body: replacedBody,
|
|
};
|
|
return result;
|
|
}
|