mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-11-20 03:25:52 +01:00
add https to homeserver if not already a valid url
This commit is contained in:
parent
1ac36cbd23
commit
97030f7ef3
@ -43,6 +43,14 @@ export const LoginFailure = createEnum(
|
||||
"Unknown",
|
||||
);
|
||||
|
||||
function normalizeHomeserver(homeServer) {
|
||||
try {
|
||||
return new URL(homeServer).origin;
|
||||
} catch (err) {
|
||||
return new URL(`https://${homeServer}`).origin;
|
||||
}
|
||||
}
|
||||
|
||||
export class SessionContainer {
|
||||
constructor({platform, olmPromise, workerPromise}) {
|
||||
this._platform = platform;
|
||||
@ -96,6 +104,7 @@ export class SessionContainer {
|
||||
}
|
||||
await this._platform.logger.run("login", async log => {
|
||||
this._status.set(LoadStatus.Login);
|
||||
homeServer = normalizeHomeserver(homeServer);
|
||||
const clock = this._platform.clock;
|
||||
let sessionInfo;
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user