From e3719b2527143981a46f1aad72b74609f78a4d67 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Sat, 28 Sep 2019 09:44:39 +0200 Subject: [PATCH] allow http (no sssl) homeservers --- src/domain/BrawlViewModel.js | 4 ++-- src/domain/LoginViewModel.js | 1 + src/main.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/domain/BrawlViewModel.js b/src/domain/BrawlViewModel.js index 1d8d2f09..cab4846e 100644 --- a/src/domain/BrawlViewModel.js +++ b/src/domain/BrawlViewModel.js @@ -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() }; diff --git a/src/domain/LoginViewModel.js b/src/domain/LoginViewModel.js index c6bc6356..5d0a9ef2 100644 --- a/src/domain/LoginViewModel.js +++ b/src/domain/LoginViewModel.js @@ -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) { diff --git a/src/main.js b/src/main.js index 78f5f881..6ce6cc32 100644 --- a/src/main.js +++ b/src/main.js @@ -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 });