mirror of https://github.com/vector-im/riot-web
Merge pull request #1516 from vith/static-config-json
serve config.json statically instead of bundling itpull/1609/head
commit
c6cf5febd5
|
@ -33,6 +33,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-polyfill": "^6.5.0",
|
"babel-polyfill": "^6.5.0",
|
||||||
|
"browser-request": "^0.3.3",
|
||||||
"classnames": "^2.1.2",
|
"classnames": "^2.1.2",
|
||||||
"extract-text-webpack-plugin": "^0.9.1",
|
"extract-text-webpack-plugin": "^0.9.1",
|
||||||
"filesize": "^3.1.2",
|
"filesize": "^3.1.2",
|
||||||
|
|
|
@ -40,8 +40,9 @@ var ReactDOM = require("react-dom");
|
||||||
var sdk = require("matrix-react-sdk");
|
var sdk = require("matrix-react-sdk");
|
||||||
sdk.loadSkin(require('../component-index'));
|
sdk.loadSkin(require('../component-index'));
|
||||||
var VectorConferenceHandler = require('../VectorConferenceHandler');
|
var VectorConferenceHandler = require('../VectorConferenceHandler');
|
||||||
var configJson = require("../../config.json");
|
|
||||||
var UpdateChecker = require("./updater");
|
var UpdateChecker = require("./updater");
|
||||||
|
var q = require('q');
|
||||||
|
var request = require('browser-request');
|
||||||
|
|
||||||
var qs = require("querystring");
|
var qs = require("querystring");
|
||||||
|
|
||||||
|
@ -181,7 +182,24 @@ window.onload = function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadApp() {
|
function getConfig() {
|
||||||
|
let deferred = q.defer();
|
||||||
|
|
||||||
|
request(
|
||||||
|
{ method: "GET", url: "config.json", json: true },
|
||||||
|
(err, response, body) => {
|
||||||
|
if (err || response.status < 200 || response.status >= 300) {
|
||||||
|
throw "failed to load config.json";
|
||||||
|
}
|
||||||
|
|
||||||
|
deferred.resolve(body);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadApp() {
|
||||||
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
|
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
|
||||||
if (confirm("Vector runs much better as an app on iOS. Get the app?")) {
|
if (confirm("Vector runs much better as an app on iOS. Get the app?")) {
|
||||||
window.location = "https://itunes.apple.com/us/app/vector.im/id1083446067";
|
window.location = "https://itunes.apple.com/us/app/vector.im/id1083446067";
|
||||||
|
@ -194,7 +212,9 @@ function loadApp() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let configJson = await getConfig();
|
||||||
|
|
||||||
console.log("Vector starting at "+window.location);
|
console.log("Vector starting at "+window.location);
|
||||||
if (validBrowser) {
|
if (validBrowser) {
|
||||||
var MatrixChat = sdk.getComponent('structures.MatrixChat');
|
var MatrixChat = sdk.getComponent('structures.MatrixChat');
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
../config.json
|
Loading…
Reference in New Issue