allow http (no sssl) homeservers

This commit is contained in:
Bruno Windels 2019-09-28 09:44:39 +02:00
parent d8696bea1d
commit e3719b2527
3 changed files with 4 additions and 3 deletions

View File

@ -48,7 +48,7 @@ export default class BrawlViewModel extends EventEmitter {
this._clearSections(); this._clearSections();
this._loginViewModel = new LoginViewModel({ this._loginViewModel = new LoginViewModel({
createHsApi: this._createHsApi, createHsApi: this._createHsApi,
defaultHomeServer: "matrix.org", defaultHomeServer: "https://matrix.org",
loginCallback: loginData => this._onLoginFinished(loginData) loginCallback: loginData => this._onLoginFinished(loginData)
}); });
this.emit("change", "activeSection"); this.emit("change", "activeSection");
@ -97,7 +97,7 @@ export default class BrawlViewModel extends EventEmitter {
id: sessionId, id: sessionId,
deviceId: loginData.device_id, deviceId: loginData.device_id,
userId: loginData.user_id, userId: loginData.user_id,
homeServer: loginData.home_server, homeServer: loginData.homeServerUrl,
accessToken: loginData.access_token, accessToken: loginData.access_token,
lastUsed: this._clock.now() lastUsed: this._clock.now()
}; };

View File

@ -23,6 +23,7 @@ export default class LoginViewModel extends EventEmitter {
this._loading = true; this._loading = true;
this.emit("change", "loading"); this.emit("change", "loading");
const loginData = await hsApi.passwordLogin(username, password).response(); const loginData = await hsApi.passwordLogin(username, password).response();
loginData.homeServerUrl = homeserver;
this._loginCallback(loginData); this._loginCallback(loginData);
// wait for parent view model to switch away here // wait for parent view model to switch away here
} catch (err) { } catch (err) {

View File

@ -8,7 +8,7 @@ export default async function main(container) {
try { try {
const vm = new BrawlViewModel({ const vm = new BrawlViewModel({
createStorage: sessionId => createIdbStorage(`brawl_session_${sessionId}`), createStorage: sessionId => createIdbStorage(`brawl_session_${sessionId}`),
createHsApi: (homeServer, accessToken = null) => new HomeServerApi(`https://${homeServer}`, accessToken), createHsApi: (homeServer, accessToken = null) => new HomeServerApi(homeServer, accessToken),
sessionStore: new SessionsStore("brawl_sessions_v1"), sessionStore: new SessionsStore("brawl_sessions_v1"),
clock: Date //just for `now` fn clock: Date //just for `now` fn
}); });