Experimental "file drop" mode

This commit is contained in:
N Pex 2023-06-28 12:14:44 +00:00
parent 791fa5936a
commit ebadd509e9
19 changed files with 1038 additions and 85 deletions

View file

@ -140,11 +140,22 @@ router.beforeEach((to, from, next) => {
}
});
router.getRoomLink = function (alias, roomId, roomName) {
router.getRoomLink = function (alias, roomId, roomName, mode) {
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
// changed. Include the "?roomName" part
return window.location.origin + window.location.pathname + "?roomName=" + encodeURIComponent(roomName) + "#/room/" + encodeURIComponent(util.sanitizeRoomId(alias || roomId));
params["roomName"] = roomName;
}
if (mode) {
// Optional mode given, append as "m" query param
params["m"] = mode;
}
if (Object.entries(params).length > 0) {
const queryString = Object.entries(params)
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
.join('&')
return window.location.origin + window.location.pathname + "?" + queryString + "#/room/" + encodeURIComponent(util.sanitizeRoomId(alias || roomId));
}
return window.location.origin + window.location.pathname + "#/room/" + encodeURIComponent(util.sanitizeRoomId(alias || roomId));
}