Skip to content

Commit 2b18aa7

Browse files
committed
Merge branch 'release-v0.16.4'
2 parents 588369d + 0f9c823 commit 2b18aa7

11 files changed

Lines changed: 567 additions & 85 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
Changes in [0.16.4](https://github.com/vector-im/riot-web/releases/tag/v0.16.4) (2018-09-10)
2+
============================================================================================
3+
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.16.4-rc.1...v0.16.4)
4+
5+
* No changes since rc.1
6+
7+
Changes in [0.16.4-rc.1](https://github.com/vector-im/riot-web/releases/tag/v0.16.4-rc.1) (2018-09-07)
8+
======================================================================================================
9+
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.16.3...v0.16.4-rc.1)
10+
11+
* Update from Weblate.
12+
[\#7296](https://github.com/vector-im/riot-web/pull/7296)
13+
* Fix config not loading & mobileguide script being loaded in riot
14+
[\#7288](https://github.com/vector-im/riot-web/pull/7288)
15+
* Instructions for installing mobile apps
16+
[\#7272](https://github.com/vector-im/riot-web/pull/7272)
17+
* Tidy up index.js
18+
[\#7265](https://github.com/vector-im/riot-web/pull/7265)
19+
120
Changes in [0.16.3](https://github.com/vector-im/riot-web/releases/tag/v0.16.3) (2018-09-03)
221
============================================================================================
322
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.16.3-rc.2...v0.16.3)

‎electron_app/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "riot-web",
33
"productName": "Riot",
44
"main": "src/electron-main.js",
5-
"version": "0.16.3",
5+
"version": "0.16.4",
66
"description": "A feature-rich client for Matrix.org",
77
"author": "Vector Creations Ltd.",
88
"dependencies": {

‎package-lock.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "riot-web",
33
"productName": "Riot",
44
"main": "electron_app/src/electron-main.js",
5-
"version": "0.16.3",
5+
"version": "0.16.4",
66
"description": "A feature-rich client for Matrix.org",
77
"author": "New Vector Ltd.",
88
"repository": {
@@ -64,8 +64,8 @@
6464
"gemini-scrollbar": "matrix-org/gemini-scrollbar#b302279",
6565
"gfm.css": "^1.1.1",
6666
"highlight.js": "^9.0.0",
67-
"matrix-js-sdk": "0.10.9",
68-
"matrix-react-sdk": "0.13.3",
67+
"matrix-js-sdk": "0.11.0",
68+
"matrix-react-sdk": "0.13.4",
6969
"modernizr": "^3.1.0",
7070
"prop-types": "^15.5.10",
7171
"react": "^15.6.0",

‎src/i18n/strings/en_US.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,7 @@
3333
"Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!": "Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!",
3434
"Riot/Android & matrix-android-sdk chat": "Riot/Android & matrix-android-sdk chat",
3535
"Riot/Web & Desktop chat": "Riot/Web & Desktop chat",
36-
"Riot/iOS & matrix-ios-sdk chat": "Riot/iOS & matrix-ios-sdk chat"
36+
"Riot/iOS & matrix-ios-sdk chat": "Riot/iOS & matrix-ios-sdk chat",
37+
"You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.<br/>This allows you to use Riot with an existing Matrix account on a different home server.<br/><br/>You can also set a custom identity server but you won't be able to invite users by email address, or be invited by email address yourself.": "You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.<br/>This allows you to use Riot with an existing Matrix account on a different home server.<br/><br/>You can also set a custom identity server but you won't be able to invite users by email address, or be invited by email address yourself.",
38+
"Co-ordination for Riot translators": "Co-ordination for Riot translators"
3739
}

‎src/i18n/strings/id.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@
3434
"Dev chat for the Riot/Web dev team": "Obrolan Developer untuk tim developer Riot/Web",
3535
"Dev chat for the Dendrite dev team": "Obrolan Developer untuk tim developer Dendrite",
3636
"Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!": "Banyak ruang sudah tersedia di Matrix, terhubung ke jaringan yang sudah ada (Slack, IRC, Gitter dls) atau independen. Cek direktori!",
37-
"You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.<br/>This allows you to use Riot with an existing Matrix account on a different home server.<br/><br/>You can also set a custom identity server but you won't be able to invite users by email address, or be invited by email address yourself.": "Anda dapat menggunakan opsi lain untuk mendaftar pada server Matrix yang berbeda dengan memasukkan URL server yang sesuai. <br/>Hal ini memungkinkan anda untuk menggunakan Riot dengan akun matrix yang telah tersedia pada Home server yang berbeda.<br/><br/>Anda juga dapat melakukan pengubahan identitas server akan tetapi akan berakibat tidak dapat mengundang pengguna melalui email, atau diundang melalui email."
37+
"You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.<br/>This allows you to use Riot with an existing Matrix account on a different home server.<br/><br/>You can also set a custom identity server but you won't be able to invite users by email address, or be invited by email address yourself.": "Anda dapat menggunakan opsi lain untuk mendaftar pada server Matrix yang berbeda dengan memasukkan URL server yang sesuai. <br/>Hal ini memungkinkan anda untuk menggunakan Riot dengan akun matrix yang telah tersedia pada Home server yang berbeda.<br/><br/>Anda juga dapat melakukan pengubahan identitas server akan tetapi akan berakibat tidak dapat mengundang pengguna melalui email, atau diundang melalui email.",
38+
"Co-ordination for Riot translators": "Koordinasi dengan penerjemah Riot"
3839
}

‎src/vector/getconfig.js‎

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
Copyright 2018 New Vector Ltd
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
import Promise from 'bluebird';
18+
import request from 'browser-request';
19+
20+
export async function getVectorConfig(relativeLocation) {
21+
if (relativeLocation === undefined) relativeLocation = '';
22+
if (relativeLocation !== '' && !relativeLocation.endsWith('/')) relativeLocation += '/';
23+
try {
24+
const configJson = await getConfig(`${relativeLocation}config.${document.domain}.json`);
25+
// 404s succeed with an empty json config, so check that there are keys
26+
if (Object.keys(configJson).length === 0) {
27+
throw new Error(); // throw to enter the catch
28+
}
29+
return configJson;
30+
} catch (e) {
31+
return await getConfig(relativeLocation + "config.json");
32+
}
33+
}
34+
35+
function getConfig(configJsonFilename) {
36+
let deferred = Promise.defer();
37+
38+
request(
39+
{ method: "GET", url: configJsonFilename },
40+
(err, response, body) => {
41+
if (err || response.status < 200 || response.status >= 300) {
42+
// Lack of a config isn't an error, we should
43+
// just use the defaults.
44+
// Also treat a blank config as no config, assuming
45+
// the status code is 0, because we don't get 404s
46+
// from file: URIs so this is the only way we can
47+
// not fail if the file doesn't exist when loading
48+
// from a file:// URI.
49+
if (response) {
50+
if (response.status == 404 || (response.status == 0 && body == '')) {
51+
deferred.resolve({});
52+
}
53+
}
54+
deferred.reject({err: err, response: response});
55+
return;
56+
}
57+
58+
// We parse the JSON ourselves rather than use the JSON
59+
// parameter, since this throws a parse error on empty
60+
// which breaks if there's no config.json and we're
61+
// loading from the filesystem (see above).
62+
deferred.resolve(JSON.parse(body));
63+
}
64+
);
65+
66+
return deferred.promise;
67+
}

‎src/vector/index.js‎

Lines changed: 54 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
Copyright 2015, 2016 OpenMarket Ltd
33
Copyright 2017 Vector Creations Ltd
4+
Copyright 2018 New Vector Ltd
45
56
Licensed under the Apache License, Version 2.0 (the "License");
67
you may not use this file except in compliance with the License.
@@ -15,8 +16,6 @@ See the License for the specific language governing permissions and
1516
limitations under the License.
1617
*/
1718

18-
'use strict';
19-
2019
// Require common CSS here; this will make webpack process it into bundle.css.
2120
// Our own CSS (which is themed) is imported via separate webpack entry points
2221
// in webpack.config.js
@@ -25,36 +24,22 @@ require('gfm.css/gfm.css');
2524
require('highlight.js/styles/github.css');
2625
require('draft-js/dist/Draft.css');
2726

28-
const rageshake = require("matrix-react-sdk/lib/rageshake/rageshake");
29-
rageshake.init().then(() => {
30-
console.log("Initialised rageshake: See https://bugs.chromium.org/p/chromium/issues/detail?id=583193 to fix line numbers on Chrome.");
31-
rageshake.cleanup();
32-
}, (err) => {
33-
console.error("Failed to initialise rageshake: " + err);
34-
});
35-
36-
window.addEventListener('beforeunload', (e) => {
37-
console.log('riot-web closing');
38-
// try to flush the logs to indexeddb
39-
rageshake.flush();
40-
});
41-
42-
43-
// add React and ReactPerf to the global namespace, to make them easier to
44-
// access via the console
45-
global.React = require("react");
27+
import React from 'react';
28+
// add React and ReactPerf to the global namespace, to make them easier to
29+
// access via the console
30+
global.React = React;
4631
if (process.env.NODE_ENV !== 'production') {
47-
global.Perf = require("react-addons-perf");
32+
global.Perf = require('react-addons-perf');
4833
}
4934

50-
var RunModernizrTests = require("./modernizr"); // this side-effects a global
51-
var ReactDOM = require("react-dom");
52-
var sdk = require("matrix-react-sdk");
53-
const PlatformPeg = require("matrix-react-sdk/lib/PlatformPeg");
35+
import RunModernizrTests from './modernizr'; // this side-effects a global
36+
import ReactDOM from 'react-dom';
37+
import sdk from 'matrix-react-sdk';
38+
import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg';
5439
sdk.loadSkin(require('../component-index'));
55-
var VectorConferenceHandler = require('matrix-react-sdk/lib/VectorConferenceHandler');
40+
import VectorConferenceHandler from 'matrix-react-sdk/lib/VectorConferenceHandler';
5641
import Promise from 'bluebird';
57-
var request = require('browser-request');
42+
import request from 'browser-request';
5843
import * as languageHandler from 'matrix-react-sdk/lib/languageHandler';
5944
// Also import _t directly so we can call it just `_t` as this is what gen-i18n.js expects
6045
import { _t } from 'matrix-react-sdk/lib/languageHandler';
@@ -69,12 +54,29 @@ import SettingsStore, {SettingLevel} from "matrix-react-sdk/lib/settings/Setting
6954
import Tinter from 'matrix-react-sdk/lib/Tinter';
7055
import SdkConfig from "matrix-react-sdk/lib/SdkConfig";
7156

72-
var lastLocationHashSet = null;
57+
import rageshake from "matrix-react-sdk/lib/rageshake/rageshake";
7358

74-
var CallHandler = require("matrix-react-sdk/lib/CallHandler");
75-
CallHandler.setConferenceHandler(VectorConferenceHandler);
59+
import CallHandler from 'matrix-react-sdk/lib/CallHandler';
7660

77-
MatrixClientPeg.setIndexedDbWorkerScript(window.vector_indexeddb_worker_script);
61+
import {getVectorConfig} from './getconfig';
62+
63+
let lastLocationHashSet = null;
64+
65+
function initRageshake() {
66+
rageshake.init().then(() => {
67+
console.log("Initialised rageshake: See https://bugs.chromium.org/p/chromium/issues/detail?id=583193 to fix line numbers on Chrome.");
68+
69+
window.addEventListener('beforeunload', (e) => {
70+
console.log('riot-web closing');
71+
// try to flush the logs to indexeddb
72+
rageshake.flush();
73+
});
74+
75+
rageshake.cleanup();
76+
}, (err) => {
77+
console.error("Failed to initialise rageshake: " + err);
78+
});
79+
}
7880

7981
function checkBrowserFeatures(featureList) {
8082
if (!window.Modernizr) {
@@ -100,11 +102,6 @@ function checkBrowserFeatures(featureList) {
100102
return featureComplete;
101103
}
102104

103-
var validBrowser = checkBrowserFeatures([
104-
"displaytable", "flexbox", "es5object", "es5function", "localstorage",
105-
"objectfit", "indexeddb", "webworkers",
106-
]);
107-
108105
// Parse the given window.location and return parameters that can be used when calling
109106
// MatrixChat.showScreen(screen, params)
110107
function getScreenFromLocation(location) {
@@ -135,7 +132,7 @@ function onHashChange(ev) {
135132

136133
// This will be called whenever the SDK changes screens,
137134
// so a web page can update the URL bar appropriately.
138-
var onNewScreen = function(screen) {
135+
function onNewScreen(screen) {
139136
console.log("newscreen "+screen);
140137
var hash = '#/' + screen;
141138
lastLocationHashSet = hash;
@@ -151,7 +148,7 @@ var onNewScreen = function(screen) {
151148
// If we're in electron, we should never pass through a file:// URL otherwise
152149
// the identity server will try to 302 the browser to it, which breaks horribly.
153150
// so in that instance, hardcode to use riot.im/app for now instead.
154-
var makeRegistrationUrl = function(params) {
151+
function makeRegistrationUrl(params) {
155152
let url;
156153
if (window.location.protocol === "file:") {
157154
url = 'https://riot.im/app/#/register';
@@ -177,8 +174,6 @@ var makeRegistrationUrl = function(params) {
177174
return url;
178175
}
179176

180-
window.addEventListener('hashchange', onHashChange);
181-
182177
function getConfig(configJsonFilename) {
183178
let deferred = Promise.defer();
184179

@@ -226,6 +221,12 @@ function onTokenLoginCompleted() {
226221
}
227222

228223
async function loadApp() {
224+
initRageshake();
225+
MatrixClientPeg.setIndexedDbWorkerScript(window.vector_indexeddb_worker_script);
226+
CallHandler.setConferenceHandler(VectorConferenceHandler);
227+
228+
window.addEventListener('hashchange', onHashChange);
229+
229230
await loadLanguage();
230231

231232
const fragparts = parseQsFromFragment(window.location);
@@ -239,15 +240,7 @@ async function loadApp() {
239240
let configJson;
240241
let configError;
241242
try {
242-
try {
243-
configJson = await getConfig(`config.${document.domain}.json`);
244-
// 404s succeed with an empty json config, so check that there are keys
245-
if (Object.keys(configJson).length === 0) {
246-
throw new Error(); // throw to enter the catch
247-
}
248-
} catch (e) {
249-
configJson = await getConfig("config.json");
250-
}
243+
configJson = await getVectorConfig();
251244
} catch (e) {
252245
configError = e;
253246
}
@@ -261,31 +254,13 @@ async function loadApp() {
261254
const preventRedirect = Boolean(fragparts.params.client_secret);
262255

263256
if (!preventRedirect) {
264-
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
265-
// FIXME: ugly status hardcoding
266-
if (SettingsStore.getValue("theme") === 'status') {
267-
window.location = "https://status.im/join-riot.html";
268-
return;
269-
}
270-
else {
271-
if (confirm(_t("Riot is not supported on mobile web. Install the app?"))) {
272-
window.location = "https://itunes.apple.com/us/app/vector.im/id1083446067";
273-
return;
274-
}
275-
}
276-
}
277-
else if (/Android/.test(navigator.userAgent)) {
278-
// FIXME: ugly status hardcoding
279-
if (SettingsStore.getValue("theme") === 'status') {
280-
window.location = "https://status.im/join-riot.html";
257+
const isIos = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
258+
const isAndroid = /Android/.test(navigator.userAgent);
259+
if (isIos || isAndroid) {
260+
if (!document.cookie.split(';').some((c) => c.startsWith('mobile_redirect_to_guide'))) {
261+
window.location = "mobile_guide/";
281262
return;
282263
}
283-
else {
284-
if (confirm(_t("Riot is not supported on mobile web. Install the app?"))) {
285-
window.location = "https://play.google.com/store/apps/details?id=im.vector.alpha";
286-
return;
287-
}
288-
}
289264
}
290265
}
291266

@@ -325,17 +300,19 @@ async function loadApp() {
325300
}
326301
}
327302

328-
if (window.localStorage && window.localStorage.getItem('mx_accepts_unsupported_browser')) {
329-
console.log('User has previously accepted risks in using an unsupported browser');
330-
validBrowser = true;
331-
}
303+
const validBrowser = checkBrowserFeatures([
304+
"displaytable", "flexbox", "es5object", "es5function", "localstorage",
305+
"objectfit", "indexeddb", "webworkers",
306+
]);
307+
308+
const acceptInvalidBrowser = window.localStorage && window.localStorage.getItem('mx_accepts_unsupported_browser');
332309

333310
console.log("Vector starting at "+window.location);
334311
if (configError) {
335312
window.matrixChat = ReactDOM.render(<div className="error">
336313
Unable to load config file: please refresh the page to try again.
337314
</div>, document.getElementById('matrixchat'));
338-
} else if (validBrowser) {
315+
} else if (validBrowser || acceptInvalidBrowser) {
339316
const platform = PlatformPeg.get();
340317
platform.startUpdater();
341318

@@ -362,7 +339,6 @@ async function loadApp() {
362339
window.matrixChat = ReactDOM.render(
363340
<CompatibilityPage onAccept={function() {
364341
if (window.localStorage) window.localStorage.setItem('mx_accepts_unsupported_browser', true);
365-
validBrowser = true;
366342
console.log("User accepts the compatibility risks.");
367343
loadApp();
368344
}} />,

0 commit comments

Comments
 (0)