2019-11-26 12:00:15 +03:00
|
|
|
# Native Node Modules
|
2019-11-21 12:56:25 +03:00
|
|
|
|
2020-07-17 14:28:10 +03:00
|
|
|
For some features, the desktop version of Element can make use of native Node
|
2019-11-26 12:03:45 +03:00
|
|
|
modules. These allow Riot to integrate with the desktop in ways that a browser
|
|
|
|
cannot.
|
2019-11-21 12:56:25 +03:00
|
|
|
|
2019-11-26 12:13:38 +03:00
|
|
|
While native modules enable powerful new features, they must be complied for
|
2020-07-17 14:28:10 +03:00
|
|
|
each operating system. For official Element releases, we will always build these
|
2019-11-26 12:13:38 +03:00
|
|
|
modules from source to ensure we can trust the compiled output. In the future,
|
|
|
|
we may offer a pre-compiled path for those who want to use these features in a
|
2020-07-17 14:28:10 +03:00
|
|
|
custom build of Element without installing the various build tools required.
|
2019-11-21 12:56:25 +03:00
|
|
|
|
|
|
|
Do note that compiling a module for a particular operating system
|
2019-11-26 12:38:49 +03:00
|
|
|
(Linux/macOS/Windows) will need to be done on that operating system.
|
2019-11-26 12:12:52 +03:00
|
|
|
Cross-compiling from a host OS for a different target OS may be possible, but
|
2020-07-17 14:28:10 +03:00
|
|
|
we don't support this flow with Element dependencies at this time.
|
2019-11-21 12:56:25 +03:00
|
|
|
|
2020-07-17 14:28:10 +03:00
|
|
|
At the moment, we need to make some changes to the Element release process before
|
2019-11-26 12:19:15 +03:00
|
|
|
we can support native Node modules at release time, so these features are
|
|
|
|
currently disabled by default until that is resolved. The following sections
|
2020-07-17 14:28:10 +03:00
|
|
|
explain the manual steps you can use with a custom build of Element to enable
|
2019-11-26 12:19:15 +03:00
|
|
|
these features if you'd like to try them out.
|
|
|
|
|
2019-11-26 12:19:45 +03:00
|
|
|
## Adding Seshat for search in E2E encrypted rooms
|
2019-11-21 12:56:25 +03:00
|
|
|
|
2019-11-26 12:20:56 +03:00
|
|
|
Seshat is a native Node module that adds support for local event indexing and
|
2019-11-21 12:56:25 +03:00
|
|
|
full text search in E2E encrypted rooms.
|
|
|
|
|
2019-11-26 12:21:15 +03:00
|
|
|
Since Seshat is written in Rust, the Rust compiler and related tools need to be
|
|
|
|
installed before installing Seshat itself. To install Rust please consult the
|
|
|
|
official Rust [documentation](https://www.rust-lang.org/tools/install).
|
|
|
|
|
2019-11-26 20:02:49 +03:00
|
|
|
Seshat also depends on the SQLCipher library to store its data in encrypted form
|
|
|
|
on disk. You'll need to install it via your OS package manager.
|
|
|
|
|
|
|
|
After installing the Rust compiler and SQLCipher, Seshat support can be added
|
|
|
|
using yarn inside the `electron_app/` directory:
|
2019-11-21 12:56:25 +03:00
|
|
|
|
|
|
|
yarn add matrix-seshat
|
|
|
|
|
2019-11-27 05:22:41 +03:00
|
|
|
You will have to rebuild the native libraries against electron's version of
|
|
|
|
of node rather than your system node, using the `electron-build-env` tool.
|
|
|
|
This is also needed to when pulling in changes to Seshat using `yarn link`.
|
|
|
|
Again from the `electron_app/` directory:
|
2019-11-21 12:56:25 +03:00
|
|
|
|
|
|
|
yarn add electron-build-env
|
|
|
|
|
|
|
|
Recompiling Seshat itself can be done like so:
|
|
|
|
|
2020-01-31 16:04:00 +03:00
|
|
|
yarn run electron-build-env -- --electron 6.1.1 -- neon build matrix-seshat --release
|
2019-11-21 12:56:25 +03:00
|
|
|
|
|
|
|
Please make sure to include all the `--` as well as the `--release` command line
|
|
|
|
switch at the end. Modify your electron version accordingly depending on the
|
|
|
|
version that is installed on your system.
|
2019-11-27 05:22:41 +03:00
|
|
|
|
2020-07-17 14:28:10 +03:00
|
|
|
After this is done the Electron version of Element can be run from the main folder
|
2019-11-27 05:22:41 +03:00
|
|
|
as usual using:
|
|
|
|
|
|
|
|
yarn electron
|
|
|
|
|