Skip to content

Commit 6c21391

Browse files
committed
Merge branch 'develop' into markjh/attachment_iframe_css
2 parents be90bad + f9afa79 commit 6c21391

12 files changed

Lines changed: 230 additions & 41 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
1+
Changes in [0.9.0](https://github.com/vector-im/vector-web/releases/tag/v0.9.0) (2016-11-19)
2+
============================================================================================
3+
[Full Changelog](https://github.com/vector-im/vector-web/compare/v0.8.4...v0.9.0)
4+
5+
* Add a cachebuster to /version
6+
[\#2596](https://github.com/vector-im/vector-web/pull/2596)
7+
* Add a 'View decrypted source' button
8+
[\#2587](https://github.com/vector-im/vector-web/pull/2587)
9+
* Fix changelog dialog to read new version format
10+
[\#2577](https://github.com/vector-im/vector-web/pull/2577)
11+
* Build all of the vector dir in the build process
12+
[\#2558](https://github.com/vector-im/vector-web/pull/2558)
13+
* Support for get_app_version
14+
[\#2553](https://github.com/vector-im/vector-web/pull/2553)
15+
* Add CSS for mlist truncation
16+
[\#2565](https://github.com/vector-im/vector-web/pull/2565)
17+
* Add menu option for `external_url` if present
18+
[\#2560](https://github.com/vector-im/vector-web/pull/2560)
19+
* Make auto-update configureable
20+
[\#2555](https://github.com/vector-im/vector-web/pull/2555)
21+
* Missed files electron windows fixes
22+
[\#2556](https://github.com/vector-im/vector-web/pull/2556)
23+
* Add some CSS for scalar error popup
24+
[\#2554](https://github.com/vector-im/vector-web/pull/2554)
25+
* Catch unhandled errors in the electron process
26+
[\#2552](https://github.com/vector-im/vector-web/pull/2552)
27+
* Slight grab-bag of fixes for electron on Windows
28+
[\#2551](https://github.com/vector-im/vector-web/pull/2551)
29+
* Electron app (take 3)
30+
[\#2535](https://github.com/vector-im/vector-web/pull/2535)
31+
* Use webpack-dev-server instead of http-server
32+
[\#2542](https://github.com/vector-im/vector-web/pull/2542)
33+
* Better support no-config when loading from file
34+
[\#2541](https://github.com/vector-im/vector-web/pull/2541)
35+
* Fix loading with no config from HTTP
36+
[\#2540](https://github.com/vector-im/vector-web/pull/2540)
37+
* Move 'new version' support into Platform
38+
[\#2532](https://github.com/vector-im/vector-web/pull/2532)
39+
* Add Notification support to the Web Platform
40+
[\#2533](https://github.com/vector-im/vector-web/pull/2533)
41+
* Use the defaults if given a blank config file
42+
[\#2534](https://github.com/vector-im/vector-web/pull/2534)
43+
* Implement Platforms
44+
[\#2531](https://github.com/vector-im/vector-web/pull/2531)
45+
146
hanges in [0.8.4](https://github.com/vector-im/vector-web/releases/tag/v0.8.4) (2016-11-04)
247
============================================================================================
348
[Full Changelog](https://github.com/vector-im/vector-web/compare/v0.8.4-rc.2...v0.8.4)

‎config.sample.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,17 @@
3131
"nativePattern": "[^\\s]+/[^\\s]+$"
3232
},
3333
"irc:freenode": {
34+
"protocol": "irc",
35+
"domain": "chat.freenode.net",
3436
"portalRoomPattern": "#freenode_.*:matrix.org",
3537
"name": "Freenode",
3638
"icon": "//matrix.org/_matrix/media/v1/download/matrix.org/DHLHpDDgWNNejFmrewvwEAHX",
3739
"example": "#channel",
3840
"nativePattern": "^#[^\\s]+$"
3941
},
4042
"irc:mozilla": {
43+
"protocol": "irc",
44+
"domain": "irc.mozilla.org",
4145
"portalRoomPattern": "#mozilla_.*:matrix.org",
4246
"name": "Mozilla",
4347
"icon": "//matrix.org/_matrix/media/v1/download/matrix.org/DHLHpDDgWNNejFmrewvwEAHX",

‎electron/config.json‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"update_url": "https://riot.im/download/desktop/",
3+
"default_hs_url": "https://matrix.org",
4+
"default_is_url": "https://vector.im",
5+
"brand": "Riot",
6+
"integrations_ui_url": "https://scalar.vector.im/",
7+
"integrations_rest_url": "https://scalar.vector.im/api",
8+
"enableLabs": true,
9+
"roomDirectory": {
10+
"servers": [
11+
"matrix.org"
12+
],
13+
"serverConfig": {
14+
"matrix.org": {
15+
"networks": [
16+
"_matrix",
17+
"gitter",
18+
"irc:freenode",
19+
"irc:mozilla",
20+
"irc:snoonet",
21+
"irc:oftc"
22+
]
23+
}
24+
},
25+
"networks": {
26+
"gitter": {
27+
"protocol": "gitter",
28+
"portalRoomPattern": "#gitter_.*:matrix.org",
29+
"name": "Gitter",
30+
"icon": "https://gitter.im/favicon.ico",
31+
"example": "org/community",
32+
"nativePattern": "[^\\s]+/[^\\s]+$"
33+
},
34+
"irc:freenode": {
35+
"protocol": "irc",
36+
"domain": "chat.freenode.net",
37+
"portalRoomPattern": "#freenode_.*:matrix.org",
38+
"name": "Freenode",
39+
"icon": "https://matrix.org/_matrix/media/v1/download/matrix.org/DHLHpDDgWNNejFmrewvwEAHX",
40+
"example": "#channel",
41+
"nativePattern": "^#[^\\s]+$"
42+
},
43+
"irc:mozilla": {
44+
"protocol": "irc",
45+
"domain": "chat.freenode.net",
46+
"portalRoomPattern": "#mozilla_.*:matrix.org",
47+
"name": "Mozilla",
48+
"icon": "https://matrix.org/_matrix/media/v1/download/matrix.org/DHLHpDDgWNNejFmrewvwEAHX",
49+
"example": "#channel",
50+
"nativePattern": "^#[^\\s]+$"
51+
},
52+
"irc:snoonet": {
53+
"protocol": "irc",
54+
"domain": "ipv6-irc.snoonet.org",
55+
"portalRoomPattern": "#_snoonet_.*:matrix.org",
56+
"name": "Snoonet",
57+
"icon": "https://matrix.org/_matrix/media/v1/download/matrix.org/DHLHpDDgWNNejFmrewvwEAHX",
58+
"example": "#channel",
59+
"nativePattern": "^#[^\\s]+$"
60+
},
61+
"irc:oftc": {
62+
"protocol": "irc",
63+
"domain": "irc.oftc.net",
64+
"portalRoomPattern": "#_oftc_.*:matrix.org",
65+
"name": "OFTC",
66+
"icon": "https://matrix.org/_matrix/media/v1/download/matrix.org/DHLHpDDgWNNejFmrewvwEAHX",
67+
"example": "#channel",
68+
"nativePattern": "^#[^\\s]+$"
69+
}
70+
}
71+
}
72+
}

‎package.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vector-web",
33
"productName": "Riot",
44
"main": "electron/src/electron-main.js",
5-
"version": "0.8.4",
5+
"version": "0.9.0",
66
"description": "A feature-rich client for Matrix.org",
77
"author": "Vector Creations Ltd.",
88
"repository": {
@@ -35,7 +35,7 @@
3535
"build:compile": "babel --source-maps -d lib src",
3636
"build:bundle": "NODE_ENV=production webpack -p --progress",
3737
"build:bundle:dev": "webpack --optimize-occurence-order --progress",
38-
"build:electron": "build -lwm",
38+
"build:electron": "npm run clean && npm run build && cpx electron/config.json webapp/ && build -lwm",
3939
"build": "node scripts/babelcheck.js && npm run build:res && npm run build:config && npm run build:emojione && npm run build:css && npm run build:bundle",
4040
"build:dev": "node scripts/babelcheck.js && npm run build:res && npm run build:config && npm run build:emojione && npm run build:css && npm run build:bundle:dev",
4141
"dist": "scripts/package.sh",
@@ -70,10 +70,10 @@
7070
"matrix-react-sdk": "matrix-org/matrix-react-sdk#develop",
7171
"modernizr": "^3.1.0",
7272
"q": "^1.4.1",
73-
"react": "^15.2.1",
73+
"react": "^15.4.0",
7474
"react-dnd": "^2.1.4",
7575
"react-dnd-html5-backend": "^2.1.2",
76-
"react-dom": "^15.2.1",
76+
"react-dom": "^15.4.0",
7777
"react-gemini-scrollbar": "matrix-org/react-gemini-scrollbar#5e97aef",
7878
"sanitize-html": "^1.11.1",
7979
"ua-parser-js": "^0.7.10",
@@ -115,8 +115,8 @@
115115
"mocha": "^2.4.5",
116116
"parallelshell": "^1.2.0",
117117
"phantomjs-prebuilt": "^2.1.7",
118-
"react-addons-perf": "^15.0",
119-
"react-addons-test-utils": "^15.0.1",
118+
"react-addons-perf": "^15.4.0",
119+
"react-addons-test-utils": "^15.4.0",
120120
"rimraf": "^2.4.3",
121121
"source-map-loader": "^0.1.5",
122122
"webpack": "^1.12.14",

‎scripts/package.sh‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ fi
1515

1616
npm run clean
1717
npm run build$dev
18+
19+
# include the sample config in the tarball. Arguably this should be done by
20+
# `npm run build`, but it's just too painful.
21+
cp config.sample.json webapp/
22+
1823
mkdir -p dist
1924
cp -r webapp vector-$version
2025
echo $version > vector-$version/version

‎src/components/structures/ViewSource.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ module.exports = React.createClass({
2222
displayName: 'ViewSource',
2323

2424
propTypes: {
25-
onFinished: React.PropTypes.func.isRequired
25+
content: React.PropTypes.object.isRequired,
26+
onFinished: React.PropTypes.func.isRequired,
2627
},
2728

2829
componentDidMount: function() {
@@ -45,10 +46,9 @@ module.exports = React.createClass({
4546
return (
4647
<div className="mx_ViewSource">
4748
<pre>
48-
{JSON.stringify(this.props.mxEvent.event, null, 2)}
49+
{JSON.stringify(this.props.content, null, 2)}
4950
</pre>
5051
</div>
5152
);
5253
}
5354
});
54-

‎src/components/views/context_menus/MessageContextMenu.js‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,16 @@ module.exports = React.createClass({
4747
onViewSourceClick: function() {
4848
var ViewSource = sdk.getComponent('structures.ViewSource');
4949
Modal.createDialog(ViewSource, {
50-
mxEvent: this.props.mxEvent
50+
content: this.props.mxEvent.event,
51+
}, 'mx_Dialog_viewsource');
52+
if (this.props.onFinished) this.props.onFinished();
53+
},
54+
55+
onViewClearSourceClick: function() {
56+
const ViewSource = sdk.getComponent('structures.ViewSource');
57+
Modal.createDialog(ViewSource, {
58+
// FIXME: _clearEvent is private
59+
content: this.props.mxEvent._clearEvent,
5160
}, 'mx_Dialog_viewsource');
5261
if (this.props.onFinished) this.props.onFinished();
5362
},
@@ -97,6 +106,7 @@ module.exports = React.createClass({
97106
var eventStatus = this.props.mxEvent.status;
98107
var resendButton;
99108
var viewSourceButton;
109+
var viewClearSourceButton;
100110
var redactButton;
101111
var cancelButton;
102112
var permalinkButton;
@@ -133,6 +143,14 @@ module.exports = React.createClass({
133143
</div>
134144
);
135145

146+
if (this.props.mxEvent.getType() !== this.props.mxEvent.getWireType()) {
147+
viewClearSourceButton = (
148+
<div className="mx_MessageContextMenu_field" onClick={this.onViewClearSourceClick}>
149+
View Decrypted Source
150+
</div>
151+
);
152+
}
153+
136154
if (this.props.eventTileOps) {
137155
if (this.props.eventTileOps.isWidgetHidden()) {
138156
unhidePreviewButton = (
@@ -174,6 +192,7 @@ module.exports = React.createClass({
174192
{redactButton}
175193
{cancelButton}
176194
{viewSourceButton}
195+
{viewClearSourceButton}
177196
{unhidePreviewButton}
178197
{permalinkButton}
179198
{UserSettingsStore.isFeatureEnabled('rich_text_editor') ? quoteButton : null}

‎src/vector/index.js‎

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ var UpdateChecker = require("./updater");
5454
var q = require('q');
5555
var request = require('browser-request');
5656

57-
import UAParser from 'ua-parser-js';
5857
import url from 'url';
5958

6059
import {parseQs, parseQsFromFragment} from './url_utils';
@@ -120,6 +119,8 @@ var lastLoadedScreen = null;
120119
// so a web page can update the URL bar appropriately.
121120
var onNewScreen = function(screen) {
122121
console.log("newscreen "+screen);
122+
// just remember the most recent screen while we are loading, so that the
123+
// user doesn't see the URL bar doing a dance
123124
if (!loaded) {
124125
lastLoadedScreen = screen;
125126
} else {
@@ -142,33 +143,7 @@ var makeRegistrationUrl = function() {
142143
'#/register';
143144
}
144145

145-
146-
function getDefaultDeviceDisplayName() {
147-
// strip query-string and fragment from uri
148-
let u = url.parse(window.location.href);
149-
u.search = "";
150-
u.hash = "";
151-
let app_name = u.format();
152-
153-
let ua = new UAParser();
154-
return app_name + " via " + ua.getBrowser().name +
155-
" on " + ua.getOS().name;
156-
}
157-
158146
window.addEventListener('hashchange', onHashChange);
159-
window.onload = function() {
160-
console.log("window.onload");
161-
if (!validBrowser) {
162-
return;
163-
}
164-
UpdateChecker.start();
165-
routeUrl(window.location);
166-
loaded = true;
167-
if (lastLoadedScreen) {
168-
onNewScreen(lastLoadedScreen);
169-
lastLoadedScreen = null;
170-
}
171-
}
172147

173148
function getConfig() {
174149
let deferred = q.defer();
@@ -259,6 +234,8 @@ async function loadApp() {
259234
Unable to load config file: please refresh the page to try again.
260235
</div>, document.getElementById('matrixchat'));
261236
} else if (validBrowser) {
237+
UpdateChecker.start();
238+
262239
var MatrixChat = sdk.getComponent('structures.MatrixChat');
263240

264241
window.matrixChat = ReactDOM.render(
@@ -271,10 +248,19 @@ async function loadApp() {
271248
startingFragmentQueryParams={fragparts.params}
272249
enableGuest={true}
273250
onLoadCompleted={onLoadCompleted}
274-
defaultDeviceDisplayName={getDefaultDeviceDisplayName()}
251+
defaultDeviceDisplayName={PlatformPeg.get().getDefaultDeviceDisplayName()}
275252
/>,
276253
document.getElementById('matrixchat')
277254
);
255+
256+
routeUrl(window.location);
257+
258+
// we didn't propagate screen changes to the URL bar while we were loading; do it now.
259+
loaded = true;
260+
if (lastLoadedScreen) {
261+
onNewScreen(lastLoadedScreen);
262+
lastLoadedScreen = null;
263+
}
278264
}
279265
else {
280266
console.error("Browser is missing required features.");
@@ -285,7 +271,6 @@ async function loadApp() {
285271
validBrowser = true;
286272
console.log("User accepts the compatibility risks.");
287273
loadApp();
288-
window.onload(); // still do the same code paths for compatible clients
289274
}} />,
290275
document.getElementById('matrixchat')
291276
);

‎src/vector/platform/ElectronPlatform.js‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,27 @@ function onUpdateDownloaded(ev, releaseNotes, ver, date, updateURL) {
3535
});
3636
}
3737

38+
function platformFriendlyName() {
39+
console.log(window.process);
40+
switch (window.process.platform) {
41+
case 'darwin':
42+
return 'macOS';
43+
case 'freebsd':
44+
return 'FreeBSD';
45+
case 'openbsd':
46+
return 'OpenBSD';
47+
case 'sunos':
48+
return 'SunOS';
49+
case 'win32':
50+
return 'Windows';
51+
default:
52+
// Sorry, Linux users: you get lumped into here,
53+
// but only because Linux's capitalisation is
54+
// normal. We do care about you.
55+
return window.process.platform[0].toUpperCase + window.process.platform.slice(1);
56+
}
57+
}
58+
3859
export default class ElectronPlatform extends VectorBasePlatform {
3960
setNotificationCount(count: number) {
4061
super.setNotificationCount(count);
@@ -101,4 +122,8 @@ export default class ElectronPlatform extends VectorBasePlatform {
101122
// it should exit.
102123
electron.ipcRenderer.send('install_update');
103124
}
125+
126+
getDefaultDeviceDisplayName() {
127+
return "Riot Desktop on " + platformFriendlyName();
128+
}
104129
}

0 commit comments

Comments
 (0)