Fixed sandbox. Multiple tabs work now.
WiP on selectable mosaico templates. TODO: Make files always point to trusted URL, such that we don't have to rebase them. They are public anyway. The same goes for mosaico endpoints: /mosaico/templates and /mosaico/img
This commit is contained in:
parent
a4ee1534cc
commit
7788b0bc67
79 changed files with 724 additions and 390 deletions
26
lib/urls.js
26
lib/urls.js
|
@ -3,27 +3,41 @@
|
|||
const config = require('config');
|
||||
const urllib = require('url');
|
||||
|
||||
function getTrustedUrlBase() {
|
||||
return urllib.resolve(config.www.trustedUrlBase, '');
|
||||
}
|
||||
|
||||
function getSandboxUrlBase() {
|
||||
return urllib.resolve(config.www.sandboxUrlBase, '');
|
||||
}
|
||||
|
||||
function getTrustedUrl(path) {
|
||||
return urllib.resolve(config.www.trustedUrlBase, path || '');
|
||||
}
|
||||
|
||||
function getSandboxUrl(path) {
|
||||
return urllib.resolve(config.www.sandboxUrlBase, path || '');
|
||||
function getSandboxUrl(path, context) {
|
||||
if (context && context.user && context.user.restrictedAccessToken) {
|
||||
return urllib.resolve(config.www.sandboxUrlBase, context.user.restrictedAccessToken + '/' + (path || ''));
|
||||
} else {
|
||||
return urllib.resolve(config.www.sandboxUrlBase, 'ANONYMOUS/' + (path || ''));
|
||||
}
|
||||
}
|
||||
|
||||
function getTrustedUrlBaseDir() {
|
||||
const mailtrainUrl = urllib.parse(getTrustedUrl());
|
||||
return mailtrainUrl.pathname;
|
||||
const ivisUrl = urllib.parse(config.www.trustedUrlBase);
|
||||
return ivisUrl.pathname;
|
||||
}
|
||||
|
||||
function getSandboxUrlBaseDir() {
|
||||
const mailtrainUrl = urllib.parse(getSandboxUrl());
|
||||
return mailtrainUrl.pathname;
|
||||
const ivisUrl = urllib.parse(config.www.sandboxUrlBase);
|
||||
return ivisUrl.pathname;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getTrustedUrl,
|
||||
getSandboxUrl,
|
||||
getTrustedUrlBase,
|
||||
getSandboxUrlBase,
|
||||
getTrustedUrlBaseDir,
|
||||
getSandboxUrlBaseDir
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue