Merge branch 'develop' into feature-autocomplete

This commit is contained in:
Aviral Dasgupta 2016-06-21 04:09:23 +05:30
commit 510bb5785e
9 changed files with 87 additions and 80 deletions

View File

@ -3,8 +3,23 @@ Vector/Web
Vector is a Matrix web client built using the Matrix React SDK (https://github.com/matrix-org/matrix-react-sdk). Vector is a Matrix web client built using the Matrix React SDK (https://github.com/matrix-org/matrix-react-sdk).
Getting started Getting Started
=============== ===============
Vector is a modular webapp built with modern ES6 and requires and npm build system to build.
Instructions for building are below, but building from source shouldn't be necessary
for simple deployments.
1. Download the latest version from https://vector.im/packages/
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
as desired. See below for details.
1. Enter the URL into your browser and log into vector!
Building From Source
====================
If you do wish to build vector from source:
1. Install or update `node.js` so that your `npm` is at least at version `2.0.0` 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/vector-web.git`
@ -13,19 +28,23 @@ Getting started
1. If you are using the `develop` branch of vector, you will probably need to 1. If you are using the `develop` branch of vector, you will probably need to
rebuild one of the dependencies, due to https://github.com/npm/npm/issues/3055: rebuild one of the dependencies, due to https://github.com/npm/npm/issues/3055:
`(cd node_modules/matrix-react-sdk && npm install)` `(cd node_modules/matrix-react-sdk && npm install)`
1. Start the development builder and a testing server: `npm start` 1. Configure the app by copying `config.sample.json` to `config.json` and modifying
1. Wait a few seconds for the initial build to finish (the command won't it (see below for details)
terminate: it's running a web server for you). 1. `npm run package` to build a tarball to deploy. Untaring this file will give
1. Open http://127.0.0.1:8080/ in your browser to see your newly built Vector. a version-specific directory containing all the files that need to go on your
web server.
With `npm start`, any changes you make to the source files will cause a rebuild so Note that `npm run package` is not supported on Windows, so Windows users can run `npm
your changes will show up when you refresh. This development server also disables run build`, which will build all the necessary files into the `vector`
caching, so do NOT use it in production. directory. The version of Vector will not appear in Settings without
using the package script. You can then mount the vector directory on your
webserver to actually serve up the app, which is entirely static content.
Configuring config.json
=========== ===========
Configure the app by modifying the `config.json` file: You can configure the app by copying `vector/config.sample.json` to
`vector/config.json` and customising it:
1. `default_hs_url` is the default home server url. 1. `default_hs_url` is the default home server url.
1. `default_is_url` is the default identity server url (this is the server used 1. `default_is_url` is the default identity server url (this is the server used
@ -33,33 +52,13 @@ Configure the app by modifying the `config.json` file:
registering with an email address or adding an email address to your account registering with an email address or adding an email address to your account
will not work. will not work.
You will need to re-run `npm run build` after editing `config.json`.
Deployment
==========
On a Unix-based OS, run `npm run package` to build a tarball package. Untaring
this file will give a version-specific directory containing all the files that
need to go on your web server.
The package script is not supported on Windows, so Windows users can run `npm
run build`, which will build all the necessary files into the `vector`
directory. Note that the version of Vector will not appear in Settings without
using the package script. You can then mount the vector directory on your
webserver to actually serve up the app, which is entirely static content.
Development Development
=========== ===========
For simple tweaks, you can work on any of the source files within Vector with Much of the functionality in Vector is actually in the `matrix-react-sdk` and
the setup above, and your changes will cause an instant rebuild. `matrix-js-sdk` modules. It is possible to set these up in a way that makes it
easy to track the `develop` branches in git and to make local changes without
However, much of the functionality in Vector is actually in the having to manually rebuild each time.
`matrix-react-sdk` and `matrix-js-sdk` modules. It is possible to set these up
in a way that makes it easy to track the `develop` branches in git and to make
local changes without having to manually rebuild each time.
[Be aware that there may be problems with this process under npm version 3.]
First clone and build `matrix-js-sdk`: First clone and build `matrix-js-sdk`:
@ -102,13 +101,14 @@ Finally, build and start vector itself:
+ 1013 hidden modules + 1013 hidden modules
``` ```
Remember, the command will not terminate since it runs the web server Remember, the command will not terminate since it runs the web server
and rebuilds source files when they change. and rebuilds source files when they change. This development server also
disables caching, so do NOT use it in production.
1. Open http://127.0.0.1:8080/ in your browser to see your newly built Vector. 1. Open http://127.0.0.1:8080/ in your browser to see your newly built Vector.
When you make changes to `matrix-js-sdk` or `matrix-react-sdk`, you will need When you make changes to `matrix-react-sdk`, you will need to run `npm run
to run `npm run build` in the relevant directory. You can do this automatically build` in the relevant directory. You can do this automatically by instead
by instead running `npm start` in each directory, to start a development running `npm start` in the directory, to start a development builder which
builder which will watch for changes to the files and rebuild automatically. will watch for changes to the files and rebuild automatically.
If you add or remove any components from the Vector skin, you will need to rebuild If you add or remove any components from the Vector skin, you will need to rebuild
the skin's index by running, `npm run reskindex`. the skin's index by running, `npm run reskindex`.
@ -121,10 +121,7 @@ day-to-day use; it is experimental and should be considered only as a
proof-of-concept. See https://matrix.org/jira/browse/SPEC-162 for an overview proof-of-concept. See https://matrix.org/jira/browse/SPEC-162 for an overview
of the current progress. of the current progress.
To build a version of vector with support for end-to-end encryption, install Vector is built with support for end-to-end encryption by default.
the olm module with `npm i https://matrix.org/packages/npm/olm/olm-0.1.0.tgz`
before running `npm start`. The olm library will be detected and used if
available.
To enable encryption for a room, type To enable encryption for a room, type
@ -140,4 +137,4 @@ Note that historical encrypted messages cannot currently be decoded - history
is therefore lost when the page is reloaded. is therefore lost when the page is reloaded.
There is currently no visual indication of whether encryption is enabled for a There is currently no visual indication of whether encryption is enabled for a
room, or whether a particular message was encrypted. room.

View File

@ -131,6 +131,11 @@ module.exports = function (config) {
path.resolve('./test'), path.resolve('./test'),
], ],
}, },
plugins: [
// olm may not be installed, so avoid webpack warnings by
// ignoring it.
new webpack.IgnorePlugin(/^olm$/),
],
devtool: 'inline-source-map', devtool: 'inline-source-map',
}, },
}); });

View File

@ -79,5 +79,8 @@
"rimraf": "^2.4.3", "rimraf": "^2.4.3",
"source-map-loader": "^0.1.5", "source-map-loader": "^0.1.5",
"webpack": "^1.12.14" "webpack": "^1.12.14"
},
"optionalDependencies": {
"olm": "https://matrix.org/packages/npm/olm/olm-0.1.0.tgz"
} }
} }

View File

@ -116,16 +116,20 @@ module.exports = React.createClass({
}; };
} }
// It's not really possible to join Matrix rooms by ID because the HS has no way to know var payload = {
// which servers to start querying. However, there's no other way to join rooms in
// this list without aliases at present, so if roomAlias isn't set here we'll rely
// on view_room falling back to using the ID
dis.dispatch({
oob_data: oob_data, oob_data: oob_data,
action: 'view_room', action: 'view_room',
room_id: roomId, };
room_alias: roomAlias, // It's not really possible to join Matrix rooms by ID because the HS has no way to know
}); // which servers to start querying. However, there's no other way to join rooms in
// this list without aliases at present, so if roomAlias isn't set here we have no
// choice but to supply the ID.
if (roomAlias) {
payload.room_alias = roomAlias;
} else {
payload.room_id = roomId;
}
dis.dispatch(payload);
}, },
getRows: function(filter) { getRows: function(filter) {

View File

@ -103,7 +103,7 @@ module.exports = React.createClass({
className="mx_SearchBox_search" className="mx_SearchBox_search"
value={ this.state.searchTerm } value={ this.state.searchTerm }
onChange={ this.onChange } onChange={ this.onChange }
placeholder="Search room names" placeholder="Filter room names"
/> />
]; ];
} }

View File

@ -17,7 +17,7 @@ limitations under the License.
.mx_EventTile { .mx_EventTile {
max-width: 100%; max-width: 100%;
clear: both; clear: both;
margin-top: 24px; padding-top: 24px;
margin-left: 65px; margin-left: 65px;
} }
@ -33,7 +33,7 @@ limitations under the License.
} }
.mx_EventTile_continuation { .mx_EventTile_continuation {
margin-top: 8px ! important; padding-top: 8px ! important;
} }
.mx_EventTile_verified { .mx_EventTile_verified {

View File

@ -26,7 +26,6 @@ limitations under the License.
.mx_MemberDeviceInfo_textButton { .mx_MemberDeviceInfo_textButton {
color: #fff; color: #fff;
background-color: #76cfa6;
height: 20px; height: 20px;
border-radius: 20px; border-radius: 20px;
text-align: center; text-align: center;
@ -35,3 +34,11 @@ limitations under the License.
cursor: pointer; cursor: pointer;
} }
.mx_MemberDeviceInfo_verify {
background-color: #76cfa6;
}
.mx_MemberDeviceInfo_unverify {
background-color: #e55e5e;
}

View File

@ -77,6 +77,7 @@ describe('joining a room', function () {
httpBackend.when('POST', '/filter').respond(200, { filter_id: 'fid' }); httpBackend.when('POST', '/filter').respond(200, { filter_id: 'fid' });
httpBackend.when('GET', '/sync').respond(200, {}); httpBackend.when('GET', '/sync').respond(200, {});
httpBackend.when('GET', '/publicRooms').respond(200, {chunk: []}); httpBackend.when('GET', '/publicRooms').respond(200, {chunk: []});
httpBackend.when('GET', '/directory/room/'+encodeURIComponent(ROOM_ALIAS)).respond(200, { room_id: ROOM_ID });
// start with a logged-in client // start with a logged-in client
peg.replaceUsingAccessToken(HS_URL, IS_URL, USER_ID, ACCESS_TOKEN); peg.replaceUsingAccessToken(HS_URL, IS_URL, USER_ID, ACCESS_TOKEN);
@ -102,7 +103,7 @@ describe('joining a room', function () {
// that should create a roomview which will start a peek; wait // that should create a roomview which will start a peek; wait
// for the peek. // for the peek.
httpBackend.when('GET', '/rooms/'+encodeURIComponent(ROOM_ALIAS)+"/initialSync") httpBackend.when('GET', '/rooms/'+encodeURIComponent(ROOM_ID)+"/initialSync")
.respond(401, {errcode: 'M_GUEST_ACCESS_FORBIDDEN'}); .respond(401, {errcode: 'M_GUEST_ACCESS_FORBIDDEN'});
return httpBackend.flush(); return httpBackend.flush();
}).then(() => { }).then(() => {

View File

@ -2,8 +2,6 @@ var path = require('path');
var webpack = require('webpack'); var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin"); var ExtractTextPlugin = require("extract-text-webpack-plugin");
var olm_path = path.resolve('./node_modules/olm');
module.exports = { module.exports = {
module: { module: {
preLoaders: [ preLoaders: [
@ -45,11 +43,6 @@ module.exports = {
// same goes for js-sdk // same goes for js-sdk
"matrix-js-sdk": path.resolve('./node_modules/matrix-js-sdk'), "matrix-js-sdk": path.resolve('./node_modules/matrix-js-sdk'),
// matrix-js-sdk will use olm if it is available,
// but does not explicitly depend on it. Pull it
// in from node_modules if it's there.
olm: olm_path,
}, },
}, },
plugins: [ plugins: [
@ -65,20 +58,17 @@ module.exports = {
// olm.js includes "require 'fs'", which is never // olm.js includes "require 'fs'", which is never
// executed in the browser. Ignore it. // executed in the browser. Ignore it.
new webpack.IgnorePlugin(/^fs$/, /node_modules\/olm$/) new webpack.IgnorePlugin(/^fs$/, /\/olm$/)
], ],
devtool: 'source-map' devtool: 'source-map'
}; };
// ignore olm.js if it's not installed. // ignore olm.js if it's not installed, to avoid a scary-looking error.
(function() {
var fs = require('fs');
try { try {
fs.lstatSync(olm_path); require('olm');
console.log("Olm is installed; including it in webpack bundle"); console.log("Olm is installed; including it in webpack bundle");
} catch (e) { } catch (e) {
module.exports.plugins.push( module.exports.plugins.push(
new webpack.IgnorePlugin(/^olm$/) new webpack.IgnorePlugin(/^olm$/)
); );
} }
}) ();