Improved BaseURL and DM link handling
This commit is contained in:
parent
b14749c28f
commit
dd70e4a576
9 changed files with 373 additions and 322 deletions
|
|
@ -15,8 +15,16 @@ export default {
|
|||
Vue.set(config, key, json[key]);
|
||||
}
|
||||
// If default server is not set, default to current server address
|
||||
if (!json.defaultServer) {
|
||||
Vue.set(config, "defaultServer", defaultServerFromLocation);
|
||||
if (!json.defaultBaseUrl) {
|
||||
if (json.defaultServer) {
|
||||
// TODO - Only to migrate old values (defaultServer was renamed defaultBaseUrl), can be removed later...
|
||||
Vue.set(config, "defaultBaseUrl", defaultServerFromLocation);
|
||||
} else {
|
||||
Vue.set(config, "defaultBaseUrl", json.defaultServer);
|
||||
}
|
||||
}
|
||||
if (json.useFullyQualifiedDMLinks == undefined) {
|
||||
Vue.set(config, "useFullyQualifiedDMLinks", true); // Default to true
|
||||
}
|
||||
Vue.set(config, "loaded", true);
|
||||
|
||||
|
|
@ -26,6 +34,24 @@ export default {
|
|||
}
|
||||
return config;
|
||||
});
|
||||
|
||||
/**
|
||||
* If there is an explicit mapping for this MX domain in the config file, return the endpoint URL that it maps to.
|
||||
* @param {*} domain
|
||||
* @returns
|
||||
*/
|
||||
config.getMatrixDomainPartMapping = (domain) => {
|
||||
console.log("Get domain endpoint mapping for", domain);
|
||||
if (config.matrixDomainPartMapping && config.matrixDomainPartMapping[domain]) {
|
||||
const mapping = config.matrixDomainPartMapping[domain];
|
||||
if (Array.isArray(mapping)) {
|
||||
return mapping[0]; //TODO - Use the first one for now, but maybe rotate somehow?
|
||||
}
|
||||
return mapping;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Vue.prototype.$config = config;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue