Merge pull request #307 from vector-im/hs/deault-hs-url

Allow specifying a custom defaultHomeServer
This commit is contained in:
Bruno Windels 2021-04-01 13:03:46 +00:00 committed by GitHub
commit 1505f2d101
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 2 deletions

View file

@ -3,5 +3,6 @@
"appId": "io.element.hydrogen.web",
"gatewayUrl": "https://matrix.org",
"applicationServerKey": "BC-gpSdVHEXhvHSHS0AzzWrQoukv2BE7KzpoPO_FfPacqOo3l1pdqz7rSgmB04pZCWaHPz7XRe6fjLaC-WPDopM"
}
},
"defaultHomeServer": "matrix.org"
}

View file

@ -24,6 +24,7 @@
main(new Platform(document.body, {
worker: "src/worker.js",
downloadSandbox: "assets/download-sandbox.html",
defaultHomeServer: "matrix.org",
// NOTE: uncomment this if you want the service worker for local development
// serviceWorker: "sw.js",
// NOTE: provide push config if you want push notifs for local development

View file

@ -99,7 +99,7 @@ export class RootViewModel extends ViewModel {
_showLogin() {
this._setSection(() => {
this._loginViewModel = new LoginViewModel(this.childOptions({
defaultHomeServer: "https://matrix.org",
defaultHomeServer: this.platform.config["defaultHomeServer"],
createSessionContainer: this._createSessionContainer,
ready: sessionContainer => {
// we don't want to load the session container again,

View file

@ -125,6 +125,10 @@ export class Platform {
return loadOlm(this._config.olm);
}
get config() {
return this._config;
}
async loadOlmWorker() {
if (!window.WebAssembly) {
return await loadOlmWorker(this._config);