mirror of https://github.com/vector-im/riot-web
Merge remote-tracking branch 'origin/develop' into develop
commit
3488f04dd4
|
@ -33,8 +33,7 @@ export async function getVectorConfig(relativeLocation) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getConfig(configJsonFilename) {
|
function getConfig(configJsonFilename) {
|
||||||
let deferred = Promise.defer();
|
return new Promise(function(resolve, reject) {
|
||||||
|
|
||||||
request(
|
request(
|
||||||
{ method: "GET", url: configJsonFilename },
|
{ method: "GET", url: configJsonFilename },
|
||||||
(err, response, body) => {
|
(err, response, body) => {
|
||||||
|
@ -48,10 +47,10 @@ function getConfig(configJsonFilename) {
|
||||||
// from a file:// URI.
|
// from a file:// URI.
|
||||||
if (response) {
|
if (response) {
|
||||||
if (response.status == 404 || (response.status == 0 && body == '')) {
|
if (response.status == 404 || (response.status == 0 && body == '')) {
|
||||||
deferred.resolve({});
|
resolve({});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deferred.reject({err: err, response: response});
|
reject({err: err, response: response});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,9 +58,8 @@ function getConfig(configJsonFilename) {
|
||||||
// parameter, since this throws a parse error on empty
|
// parameter, since this throws a parse error on empty
|
||||||
// which breaks if there's no config.json and we're
|
// which breaks if there's no config.json and we're
|
||||||
// loading from the filesystem (see above).
|
// loading from the filesystem (see above).
|
||||||
deferred.resolve(JSON.parse(body));
|
resolve(JSON.parse(body));
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
});
|
||||||
return deferred.promise;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,12 +60,12 @@ import CallHandler from 'matrix-react-sdk/lib/CallHandler';
|
||||||
|
|
||||||
import {getVectorConfig} from './getconfig';
|
import {getVectorConfig} from './getconfig';
|
||||||
|
|
||||||
|
let lastLocationHashSet = null;
|
||||||
|
|
||||||
// Disable warnings for now: we use deprecated bluebird functions
|
// Disable warnings for now: we use deprecated bluebird functions
|
||||||
// and need to migrate, but they spam the console with warnings.
|
// and need to migrate, but they spam the console with warnings.
|
||||||
Promise.config({warnings: false});
|
Promise.config({warnings: false});
|
||||||
|
|
||||||
let lastLocationHashSet = null;
|
|
||||||
|
|
||||||
function initRageshake() {
|
function initRageshake() {
|
||||||
rageshake.init().then(() => {
|
rageshake.init().then(() => {
|
||||||
console.log("Initialised rageshake: See https://bugs.chromium.org/p/chromium/issues/detail?id=583193 to fix line numbers on Chrome.");
|
console.log("Initialised rageshake: See https://bugs.chromium.org/p/chromium/issues/detail?id=583193 to fix line numbers on Chrome.");
|
||||||
|
@ -179,8 +179,7 @@ function makeRegistrationUrl(params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getConfig(configJsonFilename) {
|
function getConfig(configJsonFilename) {
|
||||||
let deferred = Promise.defer();
|
return new Promise(function(resolve, reject) {
|
||||||
|
|
||||||
request(
|
request(
|
||||||
{ method: "GET", url: configJsonFilename },
|
{ method: "GET", url: configJsonFilename },
|
||||||
(err, response, body) => {
|
(err, response, body) => {
|
||||||
|
@ -194,10 +193,10 @@ function getConfig(configJsonFilename) {
|
||||||
// from a file:// URI.
|
// from a file:// URI.
|
||||||
if (response) {
|
if (response) {
|
||||||
if (response.status == 404 || (response.status == 0 && body == '')) {
|
if (response.status == 404 || (response.status == 0 && body == '')) {
|
||||||
deferred.resolve({});
|
resolve({});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deferred.reject({err: err, response: response});
|
reject({err: err, response: response});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,11 +204,10 @@ function getConfig(configJsonFilename) {
|
||||||
// parameter, since this throws a parse error on empty
|
// parameter, since this throws a parse error on empty
|
||||||
// which breaks if there's no config.json and we're
|
// which breaks if there's no config.json and we're
|
||||||
// loading from the filesystem (see above).
|
// loading from the filesystem (see above).
|
||||||
deferred.resolve(JSON.parse(body));
|
resolve(JSON.parse(body));
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
});
|
||||||
return deferred.promise;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTokenLoginCompleted() {
|
function onTokenLoginCompleted() {
|
||||||
|
|
|
@ -68,11 +68,11 @@ export default class WebPlatform extends VectorBasePlatform {
|
||||||
// annoyingly, the latest spec says this returns a
|
// annoyingly, the latest spec says this returns a
|
||||||
// promise, but this is only supported in Chrome 46
|
// promise, but this is only supported in Chrome 46
|
||||||
// and Firefox 47, so adapt the callback API.
|
// and Firefox 47, so adapt the callback API.
|
||||||
const defer = Promise.defer();
|
return new Promise(function(resolve, reject) {
|
||||||
global.Notification.requestPermission((result) => {
|
global.Notification.requestPermission((result) => {
|
||||||
defer.resolve(result);
|
resolve(result);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
return defer.promise;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
displayNotification(title: string, msg: string, avatarUrl: string, room: Object) {
|
displayNotification(title: string, msg: string, avatarUrl: string, room: Object) {
|
||||||
|
@ -103,13 +103,13 @@ export default class WebPlatform extends VectorBasePlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
_getVersion(): Promise<string> {
|
_getVersion(): Promise<string> {
|
||||||
const deferred = Promise.defer();
|
|
||||||
|
|
||||||
// We add a cachebuster to the request to make sure that we know about
|
// We add a cachebuster to the request to make sure that we know about
|
||||||
// the most recent version on the origin server. That might not
|
// the most recent version on the origin server. That might not
|
||||||
// actually be the version we'd get on a reload (particularly in the
|
// actually be the version we'd get on a reload (particularly in the
|
||||||
// presence of intermediate caching proxies), but still: we're trying
|
// presence of intermediate caching proxies), but still: we're trying
|
||||||
// to tell the user that there is a new version.
|
// to tell the user that there is a new version.
|
||||||
|
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
request(
|
request(
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
@ -119,15 +119,15 @@ export default class WebPlatform extends VectorBasePlatform {
|
||||||
(err, response, body) => {
|
(err, response, body) => {
|
||||||
if (err || response.status < 200 || response.status >= 300) {
|
if (err || response.status < 200 || response.status >= 300) {
|
||||||
if (err === null) err = { status: response.status };
|
if (err === null) err = { status: response.status };
|
||||||
deferred.reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ver = body.trim();
|
const ver = body.trim();
|
||||||
deferred.resolve(ver);
|
resolve(ver);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
return deferred.promise;
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getAppVersion(): Promise<string> {
|
getAppVersion(): Promise<string> {
|
||||||
|
|
Loading…
Reference in New Issue