Merge pull request #1675 from vector-im/rav/olmify_develop

Another go at enabling olm on vector.im/develop
This commit is contained in:
David Baker 2016-06-20 14:38:00 +01:00 committed by GitHub
commit f4a3e9a39b
2 changed files with 13 additions and 28 deletions

View File

@ -22,7 +22,7 @@ Building From Source
If you do wish to build vector 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`
1. Switch to the vector directory: `cd vector-web` 1. Switch to the vector directory: `cd vector-web`
1. Install the prerequisites: `npm install` 1. Install the prerequisites: `npm install`
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
@ -60,8 +60,6 @@ Much of the functionality in Vector is actually in the `matrix-react-sdk` and
easy to track the `develop` branches in git and to make local changes without easy to track the `develop` branches in git and to make local changes without
having to manually rebuild each time. 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`:
1. `git clone git@github.com:matrix-org/matrix-js-sdk.git` 1. `git clone git@github.com:matrix-org/matrix-js-sdk.git`
@ -123,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
@ -142,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

@ -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() { try {
var fs = require('fs'); require('olm');
try { console.log("Olm is installed; including it in webpack bundle");
fs.lstatSync(olm_path); } catch (e) {
console.log("Olm is installed; including it in webpack bundle"); module.exports.plugins.push(
} catch (e) { new webpack.IgnorePlugin(/^olm$/)
module.exports.plugins.push( );
new webpack.IgnorePlugin(/^olm$/) }
);
}
}) ();