Support "mirrors" array in the config file for link sharing
For issue #642
This commit is contained in:
parent
4648e4969c
commit
e3f7f1758f
9 changed files with 72 additions and 27 deletions
|
|
@ -208,7 +208,7 @@ router.beforeEach((to, from, next) => {
|
|||
}
|
||||
});
|
||||
|
||||
router.getRoomLink = function (alias, roomId, roomName, mode, autojoin, knock) {
|
||||
router.getRoomLink = function (alias, roomId, roomName, mode, autojoin, knock, mirror) {
|
||||
let params = {};
|
||||
if ((!alias || roomName.replace(/\s/g, "").toLowerCase() !== util.getRoomNameFromAlias(alias)) && roomName) {
|
||||
// There is no longer a correlation between alias and room name, probably because room name has
|
||||
|
|
@ -229,16 +229,16 @@ router.getRoomLink = function (alias, roomId, roomName, mode, autojoin, knock) {
|
|||
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
||||
.join('&')
|
||||
}
|
||||
return window.location.origin + window.location.pathname + "#/room/" + autoJoinSegment + encodeURIComponent(util.sanitizeRoomId(alias || roomId)) + queryString;
|
||||
return (mirror ? (window.location.protocol + "//" + mirror) : window.location.origin) + window.location.pathname + "#/room/" + autoJoinSegment + encodeURIComponent(util.sanitizeRoomId(alias || roomId)) + queryString;
|
||||
}
|
||||
|
||||
router.getDMLink = function (user, config) {
|
||||
router.getDMLink = function (user, config, mirror) {
|
||||
let userId = user.user_id;
|
||||
if (User.domainPart(userId) === config.defaultMatrixDomainPart && !config.useFullyQualifiedDMLinks) {
|
||||
// Using default server, don't include it in the link
|
||||
userId = User.localPart(user.user_id);
|
||||
}
|
||||
return `${window.location.origin + window.location.pathname}#/user/${encodeURIComponent(userId)}`
|
||||
return `${(mirror ? (window.location.protocol + "//" + mirror) : window.location.origin) + window.location.pathname}#/user/${encodeURIComponent(userId)}`
|
||||
}
|
||||
|
||||
export default router
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue