Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
psrpinto committed Jun 2, 2023
1 parent ad30c8c commit 2ed7a67
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions frontend/iframe/viewmodels/RootViewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,28 @@ export class RootViewModel extends ViewModel<SegmentType, Options> {
return;
}

// Check if homeserver has guest registration enabled.
// If not, go to Login.
// TODO
const homeserver = await lookupHomeserver(this._resolvedSingleRoomId.split(':')[1], this.platform.request);
const homeserverApi = new HomeServerApi({
homeserver: homeserver,
request: this.platform.request,
accessToken: "",
reconnector: this.platform.reconnector,
});

// Attempt to log in as guest. If it fails, go to Login.
try {
const loginData = await homeserverApi.guestLogin().response();
console.log(loginData);
} catch (error) {
console.warn("Failed to login as guest. Guest registration is probably disabled on the homeserver", homeserver, error);
return;
}

// Check if room is world-readable.
// If not, go to Login.
// TODO: register guest user.

await this._showUnknownRoom(this._resolvedSingleRoomId);
// await this._showUnknownRoom(this._resolvedSingleRoomId);
return;
}

Expand Down

0 comments on commit 2ed7a67

Please sign in to comment.