mailtrain/lib/urls.js

29 lines
673 B
JavaScript
Raw Normal View History

'use strict';
const config = require('config');
2018-04-29 16:13:40 +00:00
const urllib = require('url');
function getTrustedUrl(path) {
2018-04-29 16:13:40 +00:00
return urllib.resolve(config.www.trustedUrlBase, path || '');
}
function getSandboxUrl(path) {
2018-04-29 16:13:40 +00:00
return urllib.resolve(config.www.sandboxUrlBase, path || '');
}
function getTrustedUrlBaseDir() {
2018-04-29 16:13:40 +00:00
const mailtrainUrl = urllib.parse(getTrustedUrl());
return mailtrainUrl.pathname;
}
function getSandboxUrlBaseDir() {
2018-04-29 16:13:40 +00:00
const mailtrainUrl = urllib.parse(getSandboxUrl());
return mailtrainUrl.pathname;
}
module.exports = {
getTrustedUrl,
getSandboxUrl,
getTrustedUrlBaseDir,
getSandboxUrlBaseDir
};