Don't include server in DM links if not needed

This commit is contained in:
N-Pex 2023-10-09 19:10:07 +02:00
parent e6eeb9ede8
commit c04a0a2638
5 changed files with 28 additions and 5 deletions

View file

@ -29,4 +29,12 @@ export default class User {
}
return user_id;
}
// Get the domain out of the home_server, so if that one is e.g.
// "https://yourdomain.com:8008" then we return "yourdomain.com"
static serverDomain(home_server) {
const parts = home_server.split("://");
const serverAndPort = parts[parts.length - 1].split(/:|\//);
return serverAndPort[0];
}
}