From bba6664b1cf685d9666da63eacb4d8bbcb0ac764 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 24 Dec 2016 18:58:42 +0000 Subject: [PATCH 01/24] bump to dep on react-sdk 0.8.3-electron --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 34df1c4e..a8197c22 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "highlight.js": "^9.0.0", "linkifyjs": "^2.1.3", "matrix-js-sdk": "0.7.2", - "matrix-react-sdk": "0.8.3", + "matrix-react-sdk": "0.8.3-electron", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.4.0", From cbf105f2a0c448dcd27302be13de299fb43e7d4b Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 24 Dec 2016 18:59:41 +0000 Subject: [PATCH 02/24] Revert "bump to dep on react-sdk 0.8.3-electron" This reverts commit bba6664b1cf685d9666da63eacb4d8bbcb0ac764. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a8197c22..34df1c4e 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "highlight.js": "^9.0.0", "linkifyjs": "^2.1.3", "matrix-js-sdk": "0.7.2", - "matrix-react-sdk": "0.8.3-electron", + "matrix-react-sdk": "0.8.3", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.4.0", From 078493912c97f83971ca225e962077daa0e2dd79 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 24 Dec 2016 03:18:12 +0000 Subject: [PATCH 03/24] make electron send email validation URLs with a nextlink of riot.im rather than file:/// --- src/vector/index.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/vector/index.js b/src/vector/index.js index b791783b..8231950b 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -136,11 +136,20 @@ var onNewScreen = function(screen) { // click back to the client having registered. // It's up to us to recognise if we're loaded with // this URL and tell MatrixClient to resume registration. +// +// If we're in electron, we should never pass through a file:// URL otherwise +// the identity server will try to 302 the browser to it, which breaks horribly. +// so in that instance, hardcode to use riot.im/app for now instead. var makeRegistrationUrl = function() { - return window.location.protocol + '//' + - window.location.host + - window.location.pathname + - '#/register'; + if (window.location.protocol === "file:") { + return 'https://riot.im/app/#/register'; + } + else { + return window.location.protocol + '//' + + window.location.host + + window.location.pathname + + '#/register'; + } } window.addEventListener('hashchange', onHashChange); From 8c523be6f52189ea0b731e6b0181d09f0b1f2a62 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 24 Dec 2016 18:13:20 +0000 Subject: [PATCH 04/24] add gnu-tar to debian electron build deps --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 50a8ff04..54709e08 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,7 @@ The only platform that can build packages for all three platforms is macOS: ``` brew install wine --without-x11 brew install mono +brew install gnu-tar npm install npm run build:electron ``` From 4de042bf587f42a9f91df4db22c536a6f8a6c0b6 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 24 Dec 2016 18:13:33 +0000 Subject: [PATCH 05/24] empirically fix win32 shortcut in start menu --- electron/src/squirrelhooks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electron/src/squirrelhooks.js b/electron/src/squirrelhooks.js index 10fb8d9e..295ef5cf 100644 --- a/electron/src/squirrelhooks.js +++ b/electron/src/squirrelhooks.js @@ -3,7 +3,7 @@ const spawn = require('child_process').spawn; const app = require('electron').app; function run_update_exe(args, done) { - const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe'); + const updateExe = path.resolve(path.dirname(process.execPath), 'Update.exe'); spawn(updateExe, args, { detached: true }).on('close', done); From 3f3772463b4c304d6d790b54a5c2d825e900facb Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 24 Dec 2016 19:04:00 +0000 Subject: [PATCH 06/24] bump react dep --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 34df1c4e..1d2bb886 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "highlight.js": "^9.0.0", "linkifyjs": "^2.1.3", "matrix-js-sdk": "0.7.2", - "matrix-react-sdk": "0.8.3", + "matrix-react-sdk": "0.8.4", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.4.0", From 0129da4dd6990e965a5572073c05ea4e767f7dc3 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 24 Dec 2016 19:07:30 +0000 Subject: [PATCH 07/24] Prepare changelog for v0.9.5 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5427b8dc..265cbe80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +Changes in [0.9.5](https://github.com/vector-im/riot-web/releases/tag/v0.9.5) (2016-12-24) +========================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.4...v0.9.5) + + * make electron send email validation URLs with a nextlink of riot.im rather than file:/// + * add gnu-tar to debian electron build deps + * fix win32 shortcut in start menu + Changes in [0.9.4](https://github.com/vector-im/riot-web/releases/tag/v0.9.4) (2016-12-22) ========================================================================================== [Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.3...v0.9.4) From 747408871d71c8d020672e39140725c136a3b709 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 24 Dec 2016 19:07:31 +0000 Subject: [PATCH 08/24] v0.9.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d2bb886..02e280a5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "riot-web", "productName": "Riot", "main": "electron/src/electron-main.js", - "version": "0.9.4", + "version": "0.9.5", "description": "A feature-rich client for Matrix.org", "author": "Vector Creations Ltd.", "repository": { From d1a9695a353aec38762fcde749e852cfc3a5c3b5 Mon Sep 17 00:00:00 2001 From: Hubert Chathi Date: Wed, 28 Dec 2016 20:57:31 -0500 Subject: [PATCH 09/24] update README to point to new names/locations --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 41f307d3..f82572fb 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ https://riot.im/develop for those who like living dangerously. To host your own copy of Riot, the quickest bet is to use a pre-built released version of Riot: -1. Download the latest version from https://github.com/vector-im/vector-web/releases +1. Download the latest version from https://github.com/vector-im/riot-web/releases 1. Untar the tarball on your web server 1. Move (or symlink) the vector-x.x.x directory to an appropriate name 1. If desired, copy `config.sample.json` to `config.json` and edit it @@ -36,7 +36,7 @@ access to Riot (or other apps) due to sharing the same domain. We have put some coarse mitigations into place to try to protect against this situation, but it's still not good practice to do it in the first place. See -https://github.com/vector-im/vector-web/issues/1977 for more details. +https://github.com/vector-im/riot-web/issues/1977 for more details. Building From Source ==================== @@ -45,7 +45,7 @@ Riot is a modular webapp built with modern ES6 and requires a npm build system to build. 1. Install or update `node.js` so that your `npm` is at least at version `2.0.0` -1. Clone the repo: `git clone https://github.com/vector-im/vector-web.git` +1. Clone the repo: `git clone https://github.com/vector-im/riot-web.git` 1. Switch to the vector-web directory: `cd vector-web` 1. Install the prerequisites: `npm install` 1. If you are using the `develop` branch of vector-web, you will probably need @@ -97,7 +97,7 @@ Running as a Desktop app ======================== Riot can also be run as a desktop app, wrapped in electron. You can download a -pre-built version from https://riot.im/download/desktop/ or, if you prefer, +pre-built version from https://riot.im/desktop.html or, if you prefer, built it yourself. To run as a desktop app: @@ -167,13 +167,13 @@ the `component-index.js` for the app (used in future for skinning) development on Riot forcing `matrix-react-sdk` to move fast at the expense of maintaining a clear abstraction between the two.** Hacking on Riot inevitably means hacking equally on `matrix-react-sdk`, and there are bits of -`matrix-react-sdk` behaviour incorrectly residing in the `vector-web` project +`matrix-react-sdk` behaviour incorrectly residing in the `riot-web` project (e.g. matrix-react-sdk specific CSS), and a bunch of Riot specific behaviour in the `matrix-react-sdk` (grep for `vector` / `riot`). This separation problem will be solved asap once development on Riot (and thus matrix-react-sdk) has stabilised. Until then, the two projects should basically be considered as a single unit. In particular, `matrix-react-sdk` issues are currently filed -against `vector-web` in github. +against `riot-web` in github. Please note that Riot is intended to run correctly without access to the public internet. So please don't depend on resources (JS libs, CSS, images, fonts) @@ -208,8 +208,8 @@ Then similarly with `matrix-react-sdk`: Finally, build and start Riot itself: -1. `git clone git@github.com:vector-im/vector-web.git` -1. `cd vector-web` +1. `git clone git@github.com:vector-im/riot-web.git` +1. `cd riot-web` 1. `git checkout develop` 1. `npm install` 1. `rm -r node_modules/matrix-js-sdk; ln -s ../../matrix-js-sdk node_modules/` From 40545bd48e45fa8f0b40841b89e6f20c1afa9599 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 13 Jan 2017 11:15:55 +0000 Subject: [PATCH 10/24] Released react-sdk & js-sdk --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fd7c3b12..823dd04d 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,8 @@ "gfm.css": "^1.1.1", "highlight.js": "^9.0.0", "linkifyjs": "^2.1.3", - "matrix-js-sdk": "matrix-org/matrix-js-sdk#develop", - "matrix-react-sdk": "matrix-org/matrix-react-sdk#develop", + "matrix-js-sdk": "0.7.4-rc.1", + "matrix-react-sdk": "0.8.5-rc.1", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.4.0", From 9471c30f89ded93656ac5bd3f29a296b77a8d894 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 13 Jan 2017 11:21:08 +0000 Subject: [PATCH 11/24] Prepare changelog for v0.9.6-rc.1 --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 265cbe80..00772055 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ +Changes in [0.9.6-rc.1](https://github.com/vector-im/riot-web/releases/tag/v0.9.6-rc.1) (2017-01-13) +==================================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.5...v0.9.6-rc.1) + + * Build the js-sdk in the CI script + [\#2920](https://github.com/vector-im/riot-web/pull/2920) + * Hopefully fix Windows shortcuts + [\#2917](https://github.com/vector-im/riot-web/pull/2917) + * Update README now the js-sdk has a transpile step + [\#2921](https://github.com/vector-im/riot-web/pull/2921) + * Use the role for 'toggle dev tools' + [\#2915](https://github.com/vector-im/riot-web/pull/2915) + * Enable screen sharing easter-egg in desktop app + [\#2909](https://github.com/vector-im/riot-web/pull/2909) + * make electron send email validation URLs with a nextlink of riot.im + [\#2808](https://github.com/vector-im/riot-web/pull/2808) + * add Debian Stretch install steps to readme + [\#2809](https://github.com/vector-im/riot-web/pull/2809) + * Update desktop build instructions fixes #2792 + [\#2793](https://github.com/vector-im/riot-web/pull/2793) + * CSS for the delete threepid button + [\#2784](https://github.com/vector-im/riot-web/pull/2784) + Changes in [0.9.5](https://github.com/vector-im/riot-web/releases/tag/v0.9.5) (2016-12-24) ========================================================================================== [Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.4...v0.9.5) From e1c1937855967e0a1da57d00728b091d9dbfdec0 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 13 Jan 2017 11:21:08 +0000 Subject: [PATCH 12/24] v0.9.6-rc.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 823dd04d..ab9e36c5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "riot-web", "productName": "Riot", "main": "electron/src/electron-main.js", - "version": "0.9.5", + "version": "0.9.6-rc.1", "description": "A feature-rich client for Matrix.org", "author": "Vector Creations Ltd.", "repository": { From ccf7db7cc227b4d5a8996d485493b0b8f0c06cc2 Mon Sep 17 00:00:00 2001 From: Hubert Chathi Date: Fri, 13 Jan 2017 15:06:29 -0500 Subject: [PATCH 13/24] Fix a couple more references to vector-web in README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f82572fb..1368589e 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,9 @@ to build. 1. Install or update `node.js` so that your `npm` is at least at version `2.0.0` 1. Clone the repo: `git clone https://github.com/vector-im/riot-web.git` -1. Switch to the vector-web directory: `cd vector-web` +1. Switch to the riot-web directory: `cd riot-web` 1. Install the prerequisites: `npm install` -1. If you are using the `develop` branch of vector-web, you will probably need +1. If you are using the `develop` branch of riot-web, you will probably need to rebuild one of the dependencies, due to https://github.com/npm/npm/issues/3055: `(cd node_modules/matrix-react-sdk && npm install)` From 231306ea7ce629fe0e58cab62f038d2b6e271dc7 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 16 Jan 2017 13:24:44 +0000 Subject: [PATCH 14/24] Update js-sdk & react-sdk --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ab9e36c5..7b2916e0 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,8 @@ "gfm.css": "^1.1.1", "highlight.js": "^9.0.0", "linkifyjs": "^2.1.3", - "matrix-js-sdk": "0.7.4-rc.1", - "matrix-react-sdk": "0.8.5-rc.1", + "matrix-js-sdk": "0.7.4", + "matrix-react-sdk": "0.8.5", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.4.0", From 3f3a31e475598237d0a44bd53746a06a48965bda Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 16 Jan 2017 13:26:21 +0000 Subject: [PATCH 15/24] Prepare changelog for v0.9.6 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00772055..ee745baa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Changes in [0.9.6](https://github.com/vector-im/riot-web/releases/tag/v0.9.6) (2017-01-16) +========================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.6-rc.1...v0.9.6) + + * Update to matrix-js-sdk 0.9.6 for video calling fix + Changes in [0.9.6-rc.1](https://github.com/vector-im/riot-web/releases/tag/v0.9.6-rc.1) (2017-01-13) ==================================================================================================== [Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.5...v0.9.6-rc.1) From 22060ac5a44b9d4fa66b8ffd74690588ca252297 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 16 Jan 2017 13:26:22 +0000 Subject: [PATCH 16/24] v0.9.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7b2916e0..f169cf9b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "riot-web", "productName": "Riot", "main": "electron/src/electron-main.js", - "version": "0.9.6-rc.1", + "version": "0.9.6", "description": "A feature-rich client for Matrix.org", "author": "Vector Creations Ltd.", "repository": { From ae7820e8f28552ca1a19fe7612a6d1c02c5b633f Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 16 Jan 2017 13:37:18 +0000 Subject: [PATCH 17/24] Fix merge --- package.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/package.json b/package.json index 054dedf9..f169cf9b 100644 --- a/package.json +++ b/package.json @@ -62,13 +62,8 @@ "gfm.css": "^1.1.1", "highlight.js": "^9.0.0", "linkifyjs": "^2.1.3", -<<<<<<< HEAD - "matrix-js-sdk": "0.7.2", - "matrix-react-sdk": "0.8.4", -======= "matrix-js-sdk": "0.7.4", "matrix-react-sdk": "0.8.5", ->>>>>>> release-v0.9.6 "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.4.0", From b3bff92cc2cbe0f8818f2ae1563335671d0a2733 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 16 Jan 2017 18:01:25 +0000 Subject: [PATCH 18/24] Put parent build hash in webpack output filenames In order to better support a world where old build artifacts are available (which is necessary to support bundle.js splitting), collect all the webpack artifacts for the build into a single directory. Then we'll be able to clear out old builds after a few weeks, knowing they won't be in use any more. --- webpack.config.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 3500fedc..9c0c6bbb 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -40,7 +40,8 @@ module.exports = { }, output: { path: path.join(__dirname, "webapp"), - filename: "[name].[chunkhash].js", + filename: "[hash]/[name].js", + chunkFilename: "[hash]/[name].js", devtoolModuleFilenameTemplate: function(info) { // Reading input source maps gives only relative paths here for // everything. Until I figure out how to fix this, this is a @@ -79,7 +80,7 @@ module.exports = { }), new ExtractTextPlugin( - "[name].[contenthash].css", + "[hash]/[name].css", { allChunks: true } From ef07a6035ed58184f94464abcee035592e666078 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 17 Jan 2017 10:48:38 +0000 Subject: [PATCH 19/24] Fix links to fonts and images from CSS https://github.com/vector-im/riot-web/pull/2961 put the CSS in a subdirectory, which meant that links from CSS to images and fonts were broken. Fix them up. --- .../views/elements/DirectorySearchBox.css | 4 ++-- .../matrix-react-sdk/views/rooms/RoomTile.css | 2 +- src/skins/vector/css/vector-web/fonts.css | 18 ++++++++++-------- .../vector-web/views/elements/ImageView.css | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/skins/vector/css/matrix-react-sdk/views/elements/DirectorySearchBox.css b/src/skins/vector/css/matrix-react-sdk/views/elements/DirectorySearchBox.css index 3a0922bc..5686ecd0 100644 --- a/src/skins/vector/css/matrix-react-sdk/views/elements/DirectorySearchBox.css +++ b/src/skins/vector/css/matrix-react-sdk/views/elements/DirectorySearchBox.css @@ -46,7 +46,7 @@ input[type=text].mx_DirectorySearchBox_input:focus { padding-right: 10px; background-color: #efefef; border-radius: 3px; - background-image: url('img/icon-return.svg'); + background-image: url('../img/icon-return.svg'); background-position: 8px 70%; background-repeat: no-repeat; text-indent: 18px; @@ -63,7 +63,7 @@ input[type=text].mx_DirectorySearchBox_input:focus { .mx_DirectorySearchBox_clear { display: inline-block; vertical-align: middle; - background: url('img/icon_context_delete.svg'); + background: url('../img/icon_context_delete.svg'); background-position: 0 50%; background-repeat: no-repeat; width: 15px; diff --git a/src/skins/vector/css/matrix-react-sdk/views/rooms/RoomTile.css b/src/skins/vector/css/matrix-react-sdk/views/rooms/RoomTile.css index 2822d82e..2411d613 100644 --- a/src/skins/vector/css/matrix-react-sdk/views/rooms/RoomTile.css +++ b/src/skins/vector/css/matrix-react-sdk/views/rooms/RoomTile.css @@ -65,7 +65,7 @@ limitations under the License. position: absolute; content: ""; border-radius: 40px; - background-image: url("img/icons_ellipsis.svg"); + background-image: url("../img/icons_ellipsis.svg"); background-size: 25px; width: 24px; height: 24px; diff --git a/src/skins/vector/css/vector-web/fonts.css b/src/skins/vector/css/vector-web/fonts.css index 719eeebc..a57d9952 100644 --- a/src/skins/vector/css/vector-web/fonts.css +++ b/src/skins/vector/css/vector-web/fonts.css @@ -3,44 +3,46 @@ * Includes extended Latin, Greek, Cyrillic and Vietnamese character sets */ +/* the 'src' links are relative to the bundle.css, which is in a subdirectory. + */ @font-face { font-family: 'Open Sans'; - src: url('fonts/Open_Sans/OpenSans-Regular.ttf') format('truetype'); + src: url('../fonts/Open_Sans/OpenSans-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; } @font-face { font-family: 'Open Sans'; - src: url('fonts/Open_Sans/OpenSans-Italic.ttf') format('truetype'); + src: url('../fonts/Open_Sans/OpenSans-Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; } @font-face { font-family: 'Open Sans'; - src: url('fonts/Open_Sans/OpenSans-Semibold.ttf') format('truetype'); + src: url('../fonts/Open_Sans/OpenSans-Semibold.ttf') format('truetype'); font-weight: 600; font-style: normal; } @font-face { font-family: 'Open Sans'; - src: url('fonts/Open_Sans/OpenSans-SemiboldItalic.ttf') format('truetype'); + src: url('../fonts/Open_Sans/OpenSans-SemiboldItalic.ttf') format('truetype'); font-weight: 600; font-style: italic; } @font-face { font-family: 'Open Sans'; - src: url('fonts/Open_Sans/OpenSans-Bold.ttf') format('truetype'); + src: url('../fonts/Open_Sans/OpenSans-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; } @font-face { font-family: 'Open Sans'; - src: url('fonts/Open_Sans/OpenSans-BoldItalic.ttf') format('truetype'); + src: url('../fonts/Open_Sans/OpenSans-BoldItalic.ttf') format('truetype'); font-weight: 700; font-style: italic; } @@ -52,14 +54,14 @@ @font-face { font-family: 'Fira Mono'; - src: url('fonts/Fira_Mono/FiraMono-Regular.ttf') format('truetype'); + src: url('../fonts/Fira_Mono/FiraMono-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; } @font-face { font-family: 'Fira Mono'; - src: url('fonts/Fira_Mono/FiraMono-Bold.ttf') format('truetype'); + src: url('../fonts/Fira_Mono/FiraMono-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; } diff --git a/src/skins/vector/css/vector-web/views/elements/ImageView.css b/src/skins/vector/css/vector-web/views/elements/ImageView.css index 03223f25..0942b593 100644 --- a/src/skins/vector/css/vector-web/views/elements/ImageView.css +++ b/src/skins/vector/css/vector-web/views/elements/ImageView.css @@ -62,7 +62,7 @@ limitations under the License. max-height: 100%; /* object-fit hack needed for Chrome due to Chrome not re-laying-out until you refresh */ object-fit: contain; - /* background-image: url('img/trans.png'); */ + /* background-image: url('../img/trans.png'); */ pointer-events: all; } From 205676a97da4a756d63eb4b050caf350668b11d4 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 17 Jan 2017 11:30:59 +0000 Subject: [PATCH 20/24] Back to develop js-sdk & react-sdk --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f169cf9b..b79db54a 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,8 @@ "gfm.css": "^1.1.1", "highlight.js": "^9.0.0", "linkifyjs": "^2.1.3", - "matrix-js-sdk": "0.7.4", - "matrix-react-sdk": "0.8.5", + "matrix-js-sdk": "matrix-org/matrix-js-sdk#develop", + "matrix-react-sdk": "matrix-org/matrix-react-sdk#develop", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.4.0", From 4a1b04e57be363f3c45f356c1862cf5853769e10 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 17 Jan 2017 11:58:30 +0000 Subject: [PATCH 21/24] Add another layer of directory to webpack chunks --- .../views/elements/DirectorySearchBox.css | 4 ++-- .../matrix-react-sdk/views/rooms/RoomTile.css | 2 +- src/skins/vector/css/vector-web/fonts.css | 16 ++++++++-------- .../css/vector-web/views/elements/ImageView.css | 2 +- webpack.config.js | 15 ++++++++++++--- 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/skins/vector/css/matrix-react-sdk/views/elements/DirectorySearchBox.css b/src/skins/vector/css/matrix-react-sdk/views/elements/DirectorySearchBox.css index 5686ecd0..c81974eb 100644 --- a/src/skins/vector/css/matrix-react-sdk/views/elements/DirectorySearchBox.css +++ b/src/skins/vector/css/matrix-react-sdk/views/elements/DirectorySearchBox.css @@ -46,7 +46,7 @@ input[type=text].mx_DirectorySearchBox_input:focus { padding-right: 10px; background-color: #efefef; border-radius: 3px; - background-image: url('../img/icon-return.svg'); + background-image: url('../../img/icon-return.svg'); background-position: 8px 70%; background-repeat: no-repeat; text-indent: 18px; @@ -63,7 +63,7 @@ input[type=text].mx_DirectorySearchBox_input:focus { .mx_DirectorySearchBox_clear { display: inline-block; vertical-align: middle; - background: url('../img/icon_context_delete.svg'); + background: url('../../img/icon_context_delete.svg'); background-position: 0 50%; background-repeat: no-repeat; width: 15px; diff --git a/src/skins/vector/css/matrix-react-sdk/views/rooms/RoomTile.css b/src/skins/vector/css/matrix-react-sdk/views/rooms/RoomTile.css index 2411d613..b752d105 100644 --- a/src/skins/vector/css/matrix-react-sdk/views/rooms/RoomTile.css +++ b/src/skins/vector/css/matrix-react-sdk/views/rooms/RoomTile.css @@ -65,7 +65,7 @@ limitations under the License. position: absolute; content: ""; border-radius: 40px; - background-image: url("../img/icons_ellipsis.svg"); + background-image: url("../../img/icons_ellipsis.svg"); background-size: 25px; width: 24px; height: 24px; diff --git a/src/skins/vector/css/vector-web/fonts.css b/src/skins/vector/css/vector-web/fonts.css index a57d9952..52ac95b5 100644 --- a/src/skins/vector/css/vector-web/fonts.css +++ b/src/skins/vector/css/vector-web/fonts.css @@ -7,42 +7,42 @@ */ @font-face { font-family: 'Open Sans'; - src: url('../fonts/Open_Sans/OpenSans-Regular.ttf') format('truetype'); + src: url('../../fonts/Open_Sans/OpenSans-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; } @font-face { font-family: 'Open Sans'; - src: url('../fonts/Open_Sans/OpenSans-Italic.ttf') format('truetype'); + src: url('../../fonts/Open_Sans/OpenSans-Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; } @font-face { font-family: 'Open Sans'; - src: url('../fonts/Open_Sans/OpenSans-Semibold.ttf') format('truetype'); + src: url('../../fonts/Open_Sans/OpenSans-Semibold.ttf') format('truetype'); font-weight: 600; font-style: normal; } @font-face { font-family: 'Open Sans'; - src: url('../fonts/Open_Sans/OpenSans-SemiboldItalic.ttf') format('truetype'); + src: url('../../fonts/Open_Sans/OpenSans-SemiboldItalic.ttf') format('truetype'); font-weight: 600; font-style: italic; } @font-face { font-family: 'Open Sans'; - src: url('../fonts/Open_Sans/OpenSans-Bold.ttf') format('truetype'); + src: url('../../fonts/Open_Sans/OpenSans-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; } @font-face { font-family: 'Open Sans'; - src: url('../fonts/Open_Sans/OpenSans-BoldItalic.ttf') format('truetype'); + src: url('../../fonts/Open_Sans/OpenSans-BoldItalic.ttf') format('truetype'); font-weight: 700; font-style: italic; } @@ -54,14 +54,14 @@ @font-face { font-family: 'Fira Mono'; - src: url('../fonts/Fira_Mono/FiraMono-Regular.ttf') format('truetype'); + src: url('../../fonts/Fira_Mono/FiraMono-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; } @font-face { font-family: 'Fira Mono'; - src: url('../fonts/Fira_Mono/FiraMono-Bold.ttf') format('truetype'); + src: url('../../fonts/Fira_Mono/FiraMono-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; } diff --git a/src/skins/vector/css/vector-web/views/elements/ImageView.css b/src/skins/vector/css/vector-web/views/elements/ImageView.css index 0942b593..73aaaa86 100644 --- a/src/skins/vector/css/vector-web/views/elements/ImageView.css +++ b/src/skins/vector/css/vector-web/views/elements/ImageView.css @@ -62,7 +62,7 @@ limitations under the License. max-height: 100%; /* object-fit hack needed for Chrome due to Chrome not re-laying-out until you refresh */ object-fit: contain; - /* background-image: url('../img/trans.png'); */ + /* background-image: url('../../img/trans.png'); */ pointer-events: all; } diff --git a/webpack.config.js b/webpack.config.js index 9c0c6bbb..2a38d139 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -40,8 +40,17 @@ module.exports = { }, output: { path: path.join(__dirname, "webapp"), - filename: "[hash]/[name].js", - chunkFilename: "[hash]/[name].js", + + // the generated js (and CSS, from the ExtractTextPlugin) are put in a + // unique subdirectory for the build. There will only be one such + // 'bundle' directory in the generated tarball; however, hosting + // servers can collect 'bundles' from multiple versions into one + // directory and symlink it into place - this allows users who loaded + // an older version of the application to continue to access webpack + // chunks even after the app is redeployed. + // + filename: "bundles/[hash]/[name].js", + chunkFilename: "bundles/[hash]/[name].js", devtoolModuleFilenameTemplate: function(info) { // Reading input source maps gives only relative paths here for // everything. Until I figure out how to fix this, this is a @@ -80,7 +89,7 @@ module.exports = { }), new ExtractTextPlugin( - "[hash]/[name].css", + "bundles/[hash]/[name].css", { allChunks: true } From 3b109f761283d1aac5f4ff26462bd4f77ff83155 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 17 Jan 2017 13:16:08 +0000 Subject: [PATCH 22/24] Include current version in update check explicitly Hopefully fix https://github.com/vector-im/riot-web/issues/2847 --- electron/src/electron-main.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/electron/src/electron-main.js b/electron/src/electron-main.js index 675640a5..3f7c0f07 100644 --- a/electron/src/electron-main.js +++ b/electron/src/electron-main.js @@ -112,7 +112,15 @@ function startAutoUpdate(update_base_url) { // 204 No Content. On windows it takes a base path and looks for // files under that path. if (process.platform == 'darwin') { - electron.autoUpdater.setFeedURL(update_base_url + 'macos/'); + // include the current version in the URL we hit. Electron doesn't add + // it anywhere (apart from the User-Agent) so it's up to us. We could + // (and previously did) just use the User-Agent, but this doesn't + // rely on NSURLConnection setting the User-Agent to what we expect, + // and also acts as a convenient cache-buster between versions. + electron.autoUpdater.setFeedURL( + update_base_url + + 'macos/?localVersion=' + encodeURIComponent(electron.app.getVersion()) + ); } else if (process.platform == 'win32') { electron.autoUpdater.setFeedURL(update_base_url + 'win32/' + process.arch + '/'); } else { From 8371006d90e37d554cc1d05e94f10f6d0f4134b7 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 17 Jan 2017 13:55:33 +0000 Subject: [PATCH 23/24] Update redeploy script to keep old bundles ... so that people using old versions of the master chunk can still load other webpack chunks. --- scripts/redeploy.py | 142 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 118 insertions(+), 24 deletions(-) diff --git a/scripts/redeploy.py b/scripts/redeploy.py index 36585f53..4394f292 100755 --- a/scripts/redeploy.py +++ b/scripts/redeploy.py @@ -1,13 +1,32 @@ #!/usr/bin/env python +# +# auto-deploy script for https://riot.im/develop +# +# Listens for HTTP hits. When it gets one, downloads the artifact from jenkins +# and deploys it as the new version. +# +# Requires the following python packages: +# +# - requests +# - flask +# from __future__ import print_function import json, requests, tarfile, argparse, os, errno +import time from urlparse import urljoin from flask import Flask, jsonify, request, abort + app = Flask(__name__) -arg_jenkins_url, arg_extract_path, arg_should_clean, arg_symlink, arg_config_location = ( - None, None, None, None, None -) +arg_jenkins_url = None +arg_extract_path = None +arg_bundles_path = None +arg_should_clean = None +arg_symlink = None +arg_config_location = None + +class DeployException(Exception): + pass def download_file(url): local_filename = url.split('/')[-1] @@ -57,6 +76,9 @@ def on_receive_jenkins_poke(): abort(400, "Missing or bad build number") return + return fetch_jenkins_build(job_name, build_num) + +def fetch_jenkins_build(job_name, build_num): artifact_url = urljoin( arg_jenkins_url, "job/%s/%s/api/json" % (job_name, build_num) ) @@ -106,7 +128,31 @@ def on_receive_jenkins_poke(): arg_jenkins_url, "job/%s/%s/artifact/%s" % (job_name, build_num, tar_gz_path) ) - print("Retrieving .tar.gz file: %s" % tar_gz_url) + # we extract into a directory based on the build number. This avoids the + # problem of multiple builds building the same git version and thus having + # the same tarball name. That would lead to two potential problems: + # (a) sometimes jenkins serves corrupted artifacts; we would replace + # a good deploy with a bad one + # (b) we'll be overwriting the live deployment, which means people might + # see half-written files. + build_dir = os.path.join(arg_extract_path, "%s-#%s" % (job_name, build_num)) + try: + deploy_tarball(tar_gz_url, build_dir) + except DeployException as e: + abort(400, e.message) + + return jsonify({}) + +def deploy_tarball(tar_gz_url, build_dir): + """Download a tarball from jenkins and deploy it as the new version + """ + print("Deploying %s to %s" % (tar_gz_url, build_dir)) + + if os.path.exists(build_dir): + raise DeployException( + "Not deploying. We have previously deployed this build." + ) + os.mkdir(build_dir) # we rely on the fact that flask only serves one request at a time to # ensure that we do not overwrite a tarball from a concurrent request. @@ -114,19 +160,6 @@ def on_receive_jenkins_poke(): print("Downloaded file: %s" % filename) try: - # we extract into a directory based on the build number. This avoids the - # problem of multiple builds building the same git version and thus having - # the same tarball name. That would lead to two potential problems: - # (a) sometimes jenkins serves corrupted artifacts; we would replace - # a good deploy with a bad one - # (b) we'll be overwriting the live deployment, which means people might - # see half-written files. - build_dir = os.path.join(arg_extract_path, "%s-#%s" % (job_name, build_num)) - if os.path.exists(build_dir): - abort(400, "Not deploying. We have previously deployed this build.") - return - os.mkdir(build_dir) - untar_to(filename, build_dir) print("Extracted to: %s" % build_dir) finally: @@ -139,9 +172,47 @@ def on_receive_jenkins_poke(): if arg_config_location: create_symlink(source=arg_config_location, linkname=os.path.join(extracted_dir, 'config.json')) + if arg_bundles_path: + extracted_bundles = os.path.join(extracted_dir, 'bundles') + move_bundles(source=extracted_bundles, dest=arg_bundles_path) + + # replace the (hopefully now empty) extracted_bundles dir with a + # symlink to the common dir. + relpath = os.path.relpath(arg_bundles_path, extracted_dir) + os.rmdir(extracted_bundles) + print ("Symlink %s -> %s" % (extracted_bundles, relpath)) + os.symlink(relpath, extracted_bundles) + create_symlink(source=extracted_dir, linkname=arg_symlink) - return jsonify({}) +def move_bundles(source, dest): + """Move the contents of the 'bundles' directory to a common dir + + We check that we will not be overwriting anything before we proceed. + + Args: + source (str): path to 'bundles' within the extracted tarball + dest (str): target common directory + """ + + if not os.path.isdir(dest): + os.mkdir(dest) + + # build a map from source to destination, checking for non-existence as we go. + renames = {} + for f in os.listdir(source): + dst = os.path.join(dest, f) + if os.path.exists(dst): + raise DeployException( + "Not deploying. The bundle includes '%s' which we have previously deployed." + % f + ) + renames[os.path.join(source, f)] = dst + + for (src, dst) in renames.iteritems(): + print ("Move %s -> %s" % (src, dst)) + os.rename(src, dst) + if __name__ == "__main__": parser = argparse.ArgumentParser("Runs a Vector redeployment server.") @@ -161,6 +232,13 @@ if __name__ == "__main__": "The location to extract .tar.gz files to." ) ) + parser.add_argument( + "-b", "--bundles-dir", dest="bundles_dir", help=( + "A directory to move the contents of the 'bundles' directory to. A \ + symlink to the bundles directory will also be written inside the \ + extracted tarball. Example: './bundles'." + ) + ) parser.add_argument( "-c", "--clean", dest="clean", action="store_true", default=False, help=( "Remove .tar.gz files after they have been downloaded and extracted." @@ -179,18 +257,34 @@ if __name__ == "__main__": To this location." ) ) + parser.add_argument( + "--test", dest="tarball_uri", help=( + "Don't start an HTTP listener. Instead download a build from Jenkins \ + immediately." + ), + ) + args = parser.parse_args() if args.jenkins.endswith("/"): # important for urljoin arg_jenkins_url = args.jenkins else: arg_jenkins_url = args.jenkins + "/" arg_extract_path = args.extract + arg_bundles_path = args.bundles_dir arg_should_clean = args.clean arg_symlink = args.symlink arg_config_location = args.config - print( - "Listening on port %s. Extracting to %s%s. Symlinking to %s. Jenkins URL: %s. Config location: %s" % - (args.port, arg_extract_path, - " (clean after)" if arg_should_clean else "", arg_symlink, arg_jenkins_url, arg_config_location) - ) - app.run(host="0.0.0.0", port=args.port, debug=True) + + if not os.path.isdir(arg_extract_path): + os.mkdir(arg_extract_path) + + if args.tarball_uri is not None: + build_dir = os.path.join(arg_extract_path, "test-%i" % (time.time())) + deploy_tarball(args.tarball_uri, build_dir) + else: + print( + "Listening on port %s. Extracting to %s%s. Symlinking to %s. Jenkins URL: %s. Config location: %s" % + (args.port, arg_extract_path, + " (clean after)" if arg_should_clean else "", arg_symlink, arg_jenkins_url, arg_config_location) + ) + app.run(host="0.0.0.0", port=args.port, debug=True) From cf92e7f64bfc480dd860ce52d8c986c9d8c708df Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 17 Jan 2017 14:04:42 +0000 Subject: [PATCH 24/24] Clarify comment --- electron/src/electron-main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/electron/src/electron-main.js b/electron/src/electron-main.js index 3f7c0f07..a03a8755 100644 --- a/electron/src/electron-main.js +++ b/electron/src/electron-main.js @@ -116,7 +116,8 @@ function startAutoUpdate(update_base_url) { // it anywhere (apart from the User-Agent) so it's up to us. We could // (and previously did) just use the User-Agent, but this doesn't // rely on NSURLConnection setting the User-Agent to what we expect, - // and also acts as a convenient cache-buster between versions. + // and also acts as a convenient cache-buster to ensure that when the + // app updates it always gets a fresh value to avoid update-looping. electron.autoUpdater.setFeedURL( update_base_url + 'macos/?localVersion=' + encodeURIComponent(electron.app.getVersion())