Use friendly URLs
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -67,9 +67,6 @@ export default function App({ history }: AppProps) {
|
|||||||
<SentryRoute exact path="/register">
|
<SentryRoute exact path="/register">
|
||||||
<RegisterPage />
|
<RegisterPage />
|
||||||
</SentryRoute>
|
</SentryRoute>
|
||||||
<SentryRoute path="/room/:roomId?">
|
|
||||||
<RoomPage />
|
|
||||||
</SentryRoute>
|
|
||||||
<SentryRoute path="/inspector">
|
<SentryRoute path="/inspector">
|
||||||
<SequenceDiagramViewerPage />
|
<SequenceDiagramViewerPage />
|
||||||
</SentryRoute>
|
</SentryRoute>
|
||||||
|
|||||||
@@ -74,7 +74,10 @@ function CallTile({
|
|||||||
}: CallTileProps) {
|
}: CallTileProps) {
|
||||||
return (
|
return (
|
||||||
<div className={styles.callTile}>
|
<div className={styles.callTile}>
|
||||||
<Link to={`/room/${roomId}`} className={styles.callTileLink}>
|
<Link
|
||||||
|
to={`/${roomId.substring(1).split(":")[0]}`}
|
||||||
|
className={styles.callTileLink}
|
||||||
|
>
|
||||||
<Avatar
|
<Avatar
|
||||||
size={Size.LG}
|
size={Size.LG}
|
||||||
bgKey={name}
|
bgKey={name}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export function RegisteredView({ client, isPasswordlessUser }: Props) {
|
|||||||
const [roomIdOrAlias] = await createRoom(client, roomName, ptt);
|
const [roomIdOrAlias] = await createRoom(client, roomName, ptt);
|
||||||
|
|
||||||
if (roomIdOrAlias) {
|
if (roomIdOrAlias) {
|
||||||
history.push(`/room/${roomIdOrAlias}`);
|
history.push(`/${roomIdOrAlias.substring(1).split(":")[0]}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,8 +86,7 @@ export const UnauthenticatedView: FC = () => {
|
|||||||
setOnFinished(() => {
|
setOnFinished(() => {
|
||||||
setClient(client, session);
|
setClient(client, session);
|
||||||
const aliasLocalpart = roomAliasLocalpartFromRoomName(roomName);
|
const aliasLocalpart = roomAliasLocalpartFromRoomName(roomName);
|
||||||
const [, serverName] = client.getUserId().split(":");
|
history.push(`/${aliasLocalpart}`);
|
||||||
history.push(`/room/#${aliasLocalpart}:${serverName}`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@@ -100,7 +99,7 @@ export const UnauthenticatedView: FC = () => {
|
|||||||
|
|
||||||
// Only consider the registration successful if we managed to create the room, too
|
// Only consider the registration successful if we managed to create the room, too
|
||||||
setClient(client, session);
|
setClient(client, session);
|
||||||
history.push(`/room/${roomIdOrAlias}`);
|
history.push(`/${roomIdOrAlias.substring(1).split(":")[0]}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
submit().catch((error) => {
|
submit().catch((error) => {
|
||||||
|
|||||||
@@ -346,15 +346,11 @@ export async function createRoom(
|
|||||||
// Returns a URL to that will load Element Call with the given room
|
// Returns a URL to that will load Element Call with the given room
|
||||||
export function getRoomUrl(roomIdOrAlias: string): string {
|
export function getRoomUrl(roomIdOrAlias: string): string {
|
||||||
if (roomIdOrAlias.startsWith("#")) {
|
if (roomIdOrAlias.startsWith("#")) {
|
||||||
const [localPart, host] = roomIdOrAlias.replace("#", "").split(":");
|
return `${window.location.protocol}//${window.location.host}/${
|
||||||
|
roomIdOrAlias.substring(1).split(":")[0]
|
||||||
if (host !== Config.defaultServerName()) {
|
}`;
|
||||||
return `${window.location.protocol}//${window.location.host}/room/${roomIdOrAlias}`;
|
|
||||||
} else {
|
|
||||||
return `${window.location.protocol}//${window.location.host}/${localPart}`;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return `${window.location.protocol}//${window.location.host}/room/#?roomId=${roomIdOrAlias}`;
|
return `${window.location.protocol}//${window.location.host}?roomId=${roomIdOrAlias}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user