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

View file

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

View file

@ -8,7 +8,7 @@ export default async function main(container) {
try {
const vm = new BrawlViewModel({
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"),
clock: Date //just for `now` fn
});