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,29 +3,48 @@ Vector/Web
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. 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`
1. Switch to the vector directory: `cd vector-web`
1. Install the prerequisites: `npm install`
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:
`(cd node_modules/matrix-react-sdk && npm install)`
1. Start the development builder and a testing server: `npm start`
1. Wait a few seconds for the initial build to finish (the command won't
terminate: it's running a web server for you).
1. Open http://127.0.0.1:8080/ in your browser to see your newly built Vector.
1. Configure the app by copying `config.sample.json` to `config.json` and modifying
it (see below for details)
1. `npm run package` to build a tarball to deploy. Untaring this file will give
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
your changes will show up when you refresh. This development server also disables
caching, so do NOT use it in production.
Note that `npm run package` is not supported on Windows, so Windows users can run `npm
run build`, which will build all the necessary files into the `vector`
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_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
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
===========
For simple tweaks, you can work on any of the source files within Vector with
the setup above, and your changes will cause an instant rebuild.
However, much of the functionality in Vector is actually in the
`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.]
Much of the functionality in Vector is actually in the `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.
First clone and build `matrix-js-sdk`:
@ -102,13 +101,14 @@ Finally, build and start vector itself:
+ 1013 hidden modules
```
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.
When you make changes to `matrix-js-sdk` or `matrix-react-sdk`, you will need
to run `npm run build` in the relevant directory. You can do this automatically
by instead running `npm start` in each directory, to start a development
builder which will watch for changes to the files and rebuild automatically.
When you make changes to `matrix-react-sdk`, you will need to run `npm run
build` in the relevant directory. You can do this automatically by instead
running `npm start` in the directory, to start a development builder which
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
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
of the current progress.
To build a version of vector with support for end-to-end encryption, install
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.
Vector is built with support for end-to-end encryption by default.
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.
There is currently no visual indication of whether encryption is enabled for a
room, or whether a particular message was encrypted.
room.

View file

@ -36,7 +36,7 @@ module.exports = function (config) {
proxies: {
"/img/": "/base/vector/img/",
},
// preprocess matching files before serving them to the browser
// available preprocessors:
// https://npmjs.org/browse/keyword/karma-preprocessor
@ -123,7 +123,7 @@ module.exports = function (config) {
// same goes for js-sdk
"matrix-js-sdk": path.resolve('./node_modules/matrix-js-sdk'),
sinon: 'sinon/pkg/sinon.js',
},
root: [
@ -131,6 +131,11 @@ module.exports = function (config) {
path.resolve('./test'),
],
},
plugins: [
// olm may not be installed, so avoid webpack warnings by
// ignoring it.
new webpack.IgnorePlugin(/^olm$/),
],
devtool: 'inline-source-map',
},
});

View file

@ -79,5 +79,8 @@
"rimraf": "^2.4.3",
"source-map-loader": "^0.1.5",
"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
// 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({
var payload = {
oob_data: oob_data,
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) {

View file

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

View file

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

View file

@ -26,7 +26,6 @@ limitations under the License.
.mx_MemberDeviceInfo_textButton {
color: #fff;
background-color: #76cfa6;
height: 20px;
border-radius: 20px;
text-align: center;
@ -35,3 +34,11 @@ limitations under the License.
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('GET', '/sync').respond(200, {});
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
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
// 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'});
return httpBackend.flush();
}).then(() => {

View file

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