From 2247d951d66a0862a8a7bc2893bdb2a6083f0162 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 2 Oct 2015 11:48:52 +0100 Subject: [PATCH] Add config file for default hs/is urls --- config.json | 4 ++++ package.json | 1 + src/skins/vector/views/templates/Login.js | 13 ++++++------- 3 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 config.json diff --git a/config.json b/config.json new file mode 100644 index 00000000..923d23ab --- /dev/null +++ b/config.json @@ -0,0 +1,4 @@ +{ + "default_hs_url": "https://matrix.org", + "default_is_url": "https://vector.im" +} diff --git a/package.json b/package.json index 7199ba1b..58e6439f 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "babel-loader": "^5.3.2", "catw": "^1.0.1", "http-server": "^0.8.4", + "json-loader": "^0.5.3", "parallelshell": "^1.2.0", "rimraf": "^2.4.3", "source-map-loader": "^0.1.5", diff --git a/src/skins/vector/views/templates/Login.js b/src/skins/vector/views/templates/Login.js index 2a0068f4..4e78dce9 100644 --- a/src/skins/vector/views/templates/Login.js +++ b/src/skins/vector/views/templates/Login.js @@ -25,10 +25,9 @@ var Loader = require("react-loader"); var LoginController = require('matrix-react-sdk/lib/controllers/templates/Login') -module.exports = React.createClass({ - DEFAULT_HS_URL: 'https://matrix.org', - DEFAULT_IS_URL: 'https://vector.im', +var config = require('../../../../../config.json'); +module.exports = React.createClass({ displayName: 'Login', mixins: [LoginController], @@ -40,15 +39,15 @@ module.exports = React.createClass({ componentWillMount: function() { this.onHSChosen(); - this.customHsUrl = this.DEFAULT_HS_URL; - this.customIsUrl = this.DEFAULT_IS_URL; + this.customHsUrl = config.default_hs_url; + this.customIsUrl = config.default_is_url; }, getHsUrl: function() { if (this.state.serverConfigVisible) { return this.customHsUrl; } else { - return this.DEFAULT_HS_URL; + return config.default_hs_url; } }, @@ -56,7 +55,7 @@ module.exports = React.createClass({ if (this.state.serverConfigVisible) { return this.customIsUrl; } else { - return this.DEFAULT_IS_URL; + return config.default_is_url; } },