From 1dbdd0a36641181a0ac576ec75c0300228bd0142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 11 Oct 2019 16:05:14 +0200 Subject: [PATCH 01/32] ElectronPlatform: Add support for a event index using Seshat. --- electron_app/package.json | 8 +- electron_app/src/electron-main.js | 116 ++++++++++++++++++++++++ package.json | 4 +- src/vector/platform/ElectronPlatform.js | 44 +++++++++ 4 files changed, 170 insertions(+), 2 deletions(-) diff --git a/electron_app/package.json b/electron_app/package.json index f7a70bce61..7986b1fd03 100644 --- a/electron_app/package.json +++ b/electron_app/package.json @@ -5,11 +5,17 @@ "version": "1.4.2", "description": "A feature-rich client for Matrix.org", "author": "New Vector Ltd.", + "scripts": { + "build": "electron-build-env --electron 6.0.3 neon build seshat-node --release", + "postinstall": "yarn build" + }, "dependencies": { "auto-launch": "^5.0.1", "electron-store": "^2.0.0", "electron-window-state": "^4.1.0", "minimist": "^1.2.0", - "png-to-ico": "^1.0.2" + "png-to-ico": "^1.0.2", + "make-dir": "^3.0.0", + "seshat-node": "^0.2.0" } } diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index f061acd5f9..81647fe31c 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -39,6 +39,8 @@ const { migrateFromOldOrigin } = require('./originMigrator'); const windowStateKeeper = require('electron-window-state'); const Store = require('electron-store'); +const seshat = require('seshat-node'); +const makeDir = require('make-dir'); if (argv["help"]) { console.log("Options:"); @@ -82,8 +84,12 @@ try { // Could not load local config, this is expected in most cases. } + +const eventStorePath = path.join(app.getPath('userData'), 'EventStore'); const store = new Store({ name: "electron-config" }); +let eventIndex = null; + let mainWindow = null; global.appQuitting = false; global.minimizeToTray = store.get('minimizeToTray', true); @@ -149,6 +155,17 @@ autoUpdater.on('update-downloaded', (ev, releaseNotes, releaseName, releaseDate, ipcMain.on('ipcCall', async function(ev, payload) { if (!mainWindow) return; + const send_error = (id, e) => { + const error = { + message: e.message + } + + mainWindow.webContents.send('ipcReply', { + id:id, + error: error + }); + } + const args = payload.args || []; let ret; @@ -200,6 +217,105 @@ ipcMain.on('ipcCall', async function(ev, payload) { case 'getConfig': ret = vectorConfig; break; + + case 'initEventIndex': + if (args[0] && eventIndex === null) { + let p = path.normalize(path.join(eventStorePath, args[0])); + try { + await makeDir(p); + eventIndex = new seshat(p); + console.log("Initialized event store"); + } catch (e) { + send_error(payload.id, e); + return; + } + } + break; + + case 'deleteEventIndex': + await eventIndex.delete(); + eventIndex = null; + + case 'isEventIndexEmpty': + if (eventIndex === null) ret = true; + else ret = await eventIndex.isEmpty(); + break; + + case 'addEventToIndex': + try { + eventIndex.addEvent(args[0], args[1]); + } catch (e) { + send_error(payload.id, e); + return; + } + break; + + case 'commitLiveEvents': + try { + ret = await eventIndex.commit(); + } catch (e) { + send_error(payload.id, e); + return; + } + break; + + case 'searchEventIndex': + try { + ret = await eventIndex.search(args[0]); + } catch (e) { + send_error(payload.id, e); + return; + } + break; + + case 'addHistoricEvents': + if (eventIndex === null) ret = false; + else { + try { + ret = await eventIndex.addHistoricEvents( + args[0], args[1], args[2]); + } catch (e) { + send_error(payload.id, e); + return; + } + } + break; + + case 'removeCrawlerCheckpoint': + if (eventIndex === null) ret = false; + else { + try { + ret = await eventIndex.removeCrawlerCheckpoint(args[0]); + } catch (e) { + send_error(payload.id, e); + return; + } + } + break; + + case 'addCrawlerCheckpoint': + if (eventIndex === null) ret = false; + else { + try { + ret = await eventIndex.addCrawlerCheckpoint(args[0]); + } catch (e) { + send_error(payload.id, e); + return; + } + } + break; + + case 'loadCheckpoints': + if (eventIndex === null) ret = []; + else { + try { + ret = await eventIndex.loadCheckpoints(); + } catch (e) { + ret = []; + } + } + break; + default: mainWindow.webContents.send('ipcReply', { id: payload.id, diff --git a/package.json b/package.json index bd05b090df..0026891285 100644 --- a/package.json +++ b/package.json @@ -148,7 +148,9 @@ "source-map-loader": "^0.2.4", "webpack": "^4.23.1", "webpack-cli": "^3.1.2", - "webpack-dev-server": "^3.1.11" + "webpack-dev-server": "^3.1.11", + "electron-build-env": "^0.2.0", + "neon-cli": "^0.3.1" }, "build": { "appId": "im.riot.app", diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index 8b01f86417..e50f287f1a 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -293,4 +293,48 @@ export default class ElectronPlatform extends VectorBasePlatform { callbacks.resolve(payload.reply); } } + + async initEventIndex(user_id: string): void { + return this._ipcCall('initEventIndex', user_id); + } + + supportsEventIndexing(): boolean { + return true + } + + async addEventToIndex(ev: {}, profile: {}) { + return this._ipcCall('addEventToIndex', ev, profile); + } + + async isEventIndexEmpty(): Promise { + return this._ipcCall('isEventIndexEmpty'); + } + + async commitLiveEvents(): Promise<{}> { + return this._ipcCall('commitLiveEvents'); + } + + async searchEventIndex(term: string): Promise<{}> { + return this._ipcCall('searchEventIndex', term); + } + + async addHistoricEvents(events: string, checkpoint = null, oldCheckpoint = null): Promise<{}> { + return this._ipcCall('addHistoricEvents', events, checkpoint, oldCheckpoint); + } + + async addCrawlerCheckpoint(checkpoint: {}): Promise<{}> { + return this._ipcCall('addCrawlerCheckpoint', checkpoint); + } + + async removeCrawlerCheckpoint(checkpoint: {}): Promise<{}> { + return this._ipcCall('removeCrawlerCheckpoint', checkpoint); + } + + async loadCheckpoints(checkpoint: {}): Promise<[{}]> { + return this._ipcCall('loadCheckpoints'); + } + + async deleteEventIndex(): Promise<> { + return this._ipcCall('deleteEventIndex'); + } } From 71023ae9dfc7cf5cc85897f6481536ecfddde6e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 11 Oct 2019 17:17:24 +0200 Subject: [PATCH 02/32] ElectronPlatform: Fix lint errors. --- src/vector/platform/ElectronPlatform.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index e50f287f1a..d6a689fc7d 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -294,15 +294,15 @@ export default class ElectronPlatform extends VectorBasePlatform { } } - async initEventIndex(user_id: string): void { - return this._ipcCall('initEventIndex', user_id); + async initEventIndex(userId: string): void { + return this._ipcCall('initEventIndex', userId); } supportsEventIndexing(): boolean { - return true + return true; } - async addEventToIndex(ev: {}, profile: {}) { + async addEventToIndex(ev: {}, profile: {}): void { return this._ipcCall('addEventToIndex', ev, profile); } @@ -318,7 +318,7 @@ export default class ElectronPlatform extends VectorBasePlatform { return this._ipcCall('searchEventIndex', term); } - async addHistoricEvents(events: string, checkpoint = null, oldCheckpoint = null): Promise<{}> { + async addHistoricEvents(events: string, checkpoint: {} = null, oldCheckpoint: {} = null): Promise<{}> { return this._ipcCall('addHistoricEvents', events, checkpoint, oldCheckpoint); } From 94196eb11bc2d94a1859ea677a9a09762b95ab57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 8 Nov 2019 13:45:06 +0100 Subject: [PATCH 03/32] electron-main: Use camle-case for the send_error method. --- electron_app/src/electron-main.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index 81647fe31c..bd42316fef 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -155,7 +155,7 @@ autoUpdater.on('update-downloaded', (ev, releaseNotes, releaseName, releaseDate, ipcMain.on('ipcCall', async function(ev, payload) { if (!mainWindow) return; - const send_error = (id, e) => { + const sendError = (id, e) => { const error = { message: e.message } @@ -226,7 +226,7 @@ ipcMain.on('ipcCall', async function(ev, payload) { eventIndex = new seshat(p); console.log("Initialized event store"); } catch (e) { - send_error(payload.id, e); + sendError(payload.id, e); return; } } @@ -245,7 +245,7 @@ ipcMain.on('ipcCall', async function(ev, payload) { try { eventIndex.addEvent(args[0], args[1]); } catch (e) { - send_error(payload.id, e); + sendError(payload.id, e); return; } break; @@ -254,7 +254,7 @@ ipcMain.on('ipcCall', async function(ev, payload) { try { ret = await eventIndex.commit(); } catch (e) { - send_error(payload.id, e); + sendError(payload.id, e); return; } break; @@ -263,7 +263,7 @@ ipcMain.on('ipcCall', async function(ev, payload) { try { ret = await eventIndex.search(args[0]); } catch (e) { - send_error(payload.id, e); + sendError(payload.id, e); return; } break; @@ -275,7 +275,7 @@ ipcMain.on('ipcCall', async function(ev, payload) { ret = await eventIndex.addHistoricEvents( args[0], args[1], args[2]); } catch (e) { - send_error(payload.id, e); + sendError(payload.id, e); return; } } @@ -287,7 +287,7 @@ ipcMain.on('ipcCall', async function(ev, payload) { try { ret = await eventIndex.removeCrawlerCheckpoint(args[0]); } catch (e) { - send_error(payload.id, e); + sendError(payload.id, e); return; } } @@ -299,7 +299,7 @@ ipcMain.on('ipcCall', async function(ev, payload) { try { ret = await eventIndex.addCrawlerCheckpoint(args[0]); } catch (e) { - send_error(payload.id, e); + sendError(payload.id, e); return; } } From a6839afc1f745d3bc3601a01a967988f9051ea77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 8 Nov 2019 13:57:41 +0100 Subject: [PATCH 04/32] electron-main: Use a capital letter for the seshat import. --- electron_app/src/electron-main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index bd42316fef..175dc27158 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -39,7 +39,7 @@ const { migrateFromOldOrigin } = require('./originMigrator'); const windowStateKeeper = require('electron-window-state'); const Store = require('electron-store'); -const seshat = require('seshat-node'); +const Seshat = require('seshat-node'); const makeDir = require('make-dir'); if (argv["help"]) { @@ -223,7 +223,7 @@ ipcMain.on('ipcCall', async function(ev, payload) { let p = path.normalize(path.join(eventStorePath, args[0])); try { await makeDir(p); - eventIndex = new seshat(p); + eventIndex = new Seshat(p); console.log("Initialized event store"); } catch (e) { sendError(payload.id, e); From c3c5756c7a183890fc3de7ac2f0b1d45e5b7182c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 13 Nov 2019 12:15:26 +0100 Subject: [PATCH 05/32] ElectronPlatform: Implement the EventIndexManager for Seshat. --- electron_app/src/electron-main.js | 53 +++++++--- src/vector/platform/ElectronPlatform.js | 133 ++++++++++++++++-------- 2 files changed, 131 insertions(+), 55 deletions(-) diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index 175dc27158..832b350efa 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -155,17 +155,6 @@ autoUpdater.on('update-downloaded', (ev, releaseNotes, releaseName, releaseDate, ipcMain.on('ipcCall', async function(ev, payload) { if (!mainWindow) return; - const sendError = (id, e) => { - const error = { - message: e.message - } - - mainWindow.webContents.send('ipcReply', { - id:id, - error: error - }); - } - const args = payload.args || []; let ret; @@ -218,12 +207,50 @@ ipcMain.on('ipcCall', async function(ev, payload) { ret = vectorConfig; break; + default: + mainWindow.webContents.send('ipcReply', { + id: payload.id, + error: "Unknown IPC Call: " + payload.name, + }); + return; + } + + mainWindow.webContents.send('ipcReply', { + id: payload.id, + reply: ret, + }); +}); + +ipcMain.on('seshat', async function(ev, payload) { + if (!mainWindow) return; + + const sendError = (id, e) => { + const error = { + message: e.message + } + + mainWindow.webContents.send('seshatReply', { + id:id, + error: error + }); + } + + const args = payload.args || []; + let ret; + + switch (payload.name) { + case 'supportsEventIndexing': + if (Seshat === null) ret = false; + else ret = true; + break; + case 'initEventIndex': if (args[0] && eventIndex === null) { let p = path.normalize(path.join(eventStorePath, args[0])); try { await makeDir(p); eventIndex = new Seshat(p); + // eventIndex = new Seshat(p, {passphrase: "DEFAULT_PASSPHRASE"}); console.log("Initialized event store"); } catch (e) { sendError(payload.id, e); @@ -317,14 +344,14 @@ ipcMain.on('ipcCall', async function(ev, payload) { break; default: - mainWindow.webContents.send('ipcReply', { + mainWindow.webContents.send('seshatReply', { id: payload.id, error: "Unknown IPC Call: " + payload.name, }); return; } - mainWindow.webContents.send('ipcReply', { + mainWindow.webContents.send('seshatReply', { id: payload.id, reply: ret, }); diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index d6a689fc7d..14f37442e8 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -20,6 +20,7 @@ limitations under the License. */ import VectorBasePlatform, {updateCheckStatusEnum} from './VectorBasePlatform'; +import BaseEventIndexManager from 'matrix-react-sdk/lib/BaseEventIndexManager'; import dis from 'matrix-react-sdk/lib/dispatcher'; import { _t } from 'matrix-react-sdk/lib/languageHandler'; import Promise from 'bluebird'; @@ -66,12 +67,100 @@ function getUpdateCheckStatus(status) { } } +class SeshatIndexerManager extends BaseEventIndexManager { + constructor() { + super(); + + this._pendingIpcCalls = {}; + this._nextIpcCallId = 0; + ipcRenderer.on('seshatReply', this._onIpcReply.bind(this)); + } + + async _ipcCall(name: string, ...args: []): Promise<{}> { + // TODO this should be moved into the preload.js file. + const ipcCallId = ++this._nextIpcCallId; + return new Promise((resolve, reject) => { + this._pendingIpcCalls[ipcCallId] = {resolve, reject}; + window.ipcRenderer.send('seshat', {id: ipcCallId, name, args}); + }); + } + + _onIpcReply(ev: {}, payload: {}) { + if (payload.id === undefined) { + console.warn("Ignoring IPC reply with no ID"); + return; + } + + if (this._pendingIpcCalls[payload.id] === undefined) { + console.warn("Unknown IPC payload ID: " + payload.id); + return; + } + + const callbacks = this._pendingIpcCalls[payload.id]; + delete this._pendingIpcCalls[payload.id]; + if (payload.error) { + callbacks.reject(payload.error); + } else { + callbacks.resolve(payload.reply); + } + } + + async supportsEventIndexing(): Promise { + return this._ipcCall('supportsEventIndexing'); + } + + async initEventIndex(userId: string): Promise<> { + return this._ipcCall('initEventIndex', userId); + } + + async addEventToIndex(ev: MatrixEvent, profile: MatrixProfile): Promise<> { + return this._ipcCall('addEventToIndex', ev, profile); + } + + async isEventIndexEmpty(): Promise { + return this._ipcCall('isEventIndexEmpty'); + } + + async commitLiveEvents(): Promise<> { + return this._ipcCall('commitLiveEvents'); + } + + async searchEventIndex(searchConfig: SearchConfig): Promise { + return this._ipcCall('searchEventIndex', searchConfig); + } + + async addHistoricEvents( + events: [HistoricEvent], + checkpoint: CrawlerCheckpoint | null = null, + oldCheckpoint: CrawlerCheckpoint | null = null, + ): Promise<> { + return this._ipcCall('addHistoricEvents', events, checkpoint, oldCheckpoint); + } + + async addCrawlerCheckpoint(checkpoint: CrawlerCheckpoint): Promise<> { + return this._ipcCall('addCrawlerCheckpoint', checkpoint); + } + + async removeCrawlerCheckpoint(checkpoint: CrawlerCheckpoint): Promise<> { + return this._ipcCall('removeCrawlerCheckpoint', checkpoint); + } + + async loadCheckpoints(): Promise<[CrawlerCheckpoint]> { + return this._ipcCall('loadCheckpoints'); + } + + async deleteEventIndex(): Promise<> { + return this._ipcCall('deleteEventIndex'); + } +} + export default class ElectronPlatform extends VectorBasePlatform { constructor() { super(); this._pendingIpcCalls = {}; this._nextIpcCallId = 0; + this.eventIndexManager = new SeshatIndexerManager(); dis.register(_onAction); /* @@ -294,47 +383,7 @@ export default class ElectronPlatform extends VectorBasePlatform { } } - async initEventIndex(userId: string): void { - return this._ipcCall('initEventIndex', userId); - } - - supportsEventIndexing(): boolean { - return true; - } - - async addEventToIndex(ev: {}, profile: {}): void { - return this._ipcCall('addEventToIndex', ev, profile); - } - - async isEventIndexEmpty(): Promise { - return this._ipcCall('isEventIndexEmpty'); - } - - async commitLiveEvents(): Promise<{}> { - return this._ipcCall('commitLiveEvents'); - } - - async searchEventIndex(term: string): Promise<{}> { - return this._ipcCall('searchEventIndex', term); - } - - async addHistoricEvents(events: string, checkpoint: {} = null, oldCheckpoint: {} = null): Promise<{}> { - return this._ipcCall('addHistoricEvents', events, checkpoint, oldCheckpoint); - } - - async addCrawlerCheckpoint(checkpoint: {}): Promise<{}> { - return this._ipcCall('addCrawlerCheckpoint', checkpoint); - } - - async removeCrawlerCheckpoint(checkpoint: {}): Promise<{}> { - return this._ipcCall('removeCrawlerCheckpoint', checkpoint); - } - - async loadCheckpoints(checkpoint: {}): Promise<[{}]> { - return this._ipcCall('loadCheckpoints'); - } - - async deleteEventIndex(): Promise<> { - return this._ipcCall('deleteEventIndex'); + getEventIndexingManager(): BaseEventIndexManager | null { + return this.eventIndexManager; } } From 449eca6fb4b8a03500d3a13f341449de29f1b275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 13 Nov 2019 15:59:59 +0100 Subject: [PATCH 06/32] electron-main: Add a missing break. --- electron_app/src/electron-main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index 832b350efa..1ab8bb8deb 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -262,6 +262,7 @@ ipcMain.on('seshat', async function(ev, payload) { case 'deleteEventIndex': await eventIndex.delete(); eventIndex = null; + break; case 'isEventIndexEmpty': if (eventIndex === null) ret = true; From 437c59f0874fd1bf73d4f2717087c40d313348e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 13 Nov 2019 17:05:32 +0100 Subject: [PATCH 07/32] electron-main: Check for seshat existence instead of erroring out. --- electron_app/src/electron-main.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index 1ab8bb8deb..3bb95b1d7b 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -39,8 +39,15 @@ const { migrateFromOldOrigin } = require('./originMigrator'); const windowStateKeeper = require('electron-window-state'); const Store = require('electron-store'); -const Seshat = require('seshat-node'); -const makeDir = require('make-dir'); + +let Seshat = null; +let makeDir = null; + +try { + Seshat = require('seshat-node'); + makeDir = require('make-dir'); +} catch (e) { +} if (argv["help"]) { console.log("Options:"); From e9352fca9a218d1c190975fa277678a432a63dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 14 Nov 2019 12:12:54 +0100 Subject: [PATCH 08/32] electron-main: Switch to matrix-seshat. --- electron_app/package.json | 2 +- electron_app/src/electron-main.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/electron_app/package.json b/electron_app/package.json index 7986b1fd03..63a3610fa0 100644 --- a/electron_app/package.json +++ b/electron_app/package.json @@ -16,6 +16,6 @@ "minimist": "^1.2.0", "png-to-ico": "^1.0.2", "make-dir": "^3.0.0", - "seshat-node": "^0.2.0" + "matrix-seshat": "^0.3.0" } } diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index 3bb95b1d7b..7190a5a257 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -44,7 +44,7 @@ let Seshat = null; let makeDir = null; try { - Seshat = require('seshat-node'); + Seshat = require('matrix-seshat'); makeDir = require('make-dir'); } catch (e) { } From b90a94bdd9b286baa578c2a4488a273dd95c7c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 14 Nov 2019 12:13:40 +0100 Subject: [PATCH 09/32] electron-main: Enable encryption for Seshat. --- electron_app/src/electron-main.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index 7190a5a257..22538be7f0 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -256,8 +256,7 @@ ipcMain.on('seshat', async function(ev, payload) { let p = path.normalize(path.join(eventStorePath, args[0])); try { await makeDir(p); - eventIndex = new Seshat(p); - // eventIndex = new Seshat(p, {passphrase: "DEFAULT_PASSPHRASE"}); + eventIndex = new Seshat(p, {passphrase: "DEFAULT_PASSPHRASE"}); console.log("Initialized event store"); } catch (e) { sendError(payload.id, e); From 7147af8f8037727c9987b2398b125755035c63fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 14 Nov 2019 14:14:59 +0100 Subject: [PATCH 10/32] ElectronPlatform: Don't scope the event index per user. --- electron_app/src/electron-main.js | 4 ++-- src/vector/platform/ElectronPlatform.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index 22538be7f0..76b8006a1a 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -252,8 +252,8 @@ ipcMain.on('seshat', async function(ev, payload) { break; case 'initEventIndex': - if (args[0] && eventIndex === null) { - let p = path.normalize(path.join(eventStorePath, args[0])); + if (eventIndex === null) { + let p = path.normalize(eventStorePath); try { await makeDir(p); eventIndex = new Seshat(p, {passphrase: "DEFAULT_PASSPHRASE"}); diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index 14f37442e8..1d405c76cd 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -109,8 +109,8 @@ class SeshatIndexerManager extends BaseEventIndexManager { return this._ipcCall('supportsEventIndexing'); } - async initEventIndex(userId: string): Promise<> { - return this._ipcCall('initEventIndex', userId); + async initEventIndex(): Promise<> { + return this._ipcCall('initEventIndex'); } async addEventToIndex(ev: MatrixEvent, profile: MatrixProfile): Promise<> { From dd2c210cfb8f767f7e6fecba1707038116b0ef88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 14 Nov 2019 16:14:48 +0100 Subject: [PATCH 11/32] electron-main: Rework the event index initialization and deletion. --- electron_app/package.json | 1 - electron_app/src/electron-main.js | 26 +++++++++++++++++++------ src/vector/platform/ElectronPlatform.js | 4 ++++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/electron_app/package.json b/electron_app/package.json index 63a3610fa0..cd1b8b2f35 100644 --- a/electron_app/package.json +++ b/electron_app/package.json @@ -15,7 +15,6 @@ "electron-window-state": "^4.1.0", "minimist": "^1.2.0", "png-to-ico": "^1.0.2", - "make-dir": "^3.0.0", "matrix-seshat": "^0.3.0" } } diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index 76b8006a1a..af174fe7ab 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -40,12 +40,13 @@ const { migrateFromOldOrigin } = require('./originMigrator'); const windowStateKeeper = require('electron-window-state'); const Store = require('electron-store'); +const fs = require('fs'); +const afs = fs.promises; + let Seshat = null; -let makeDir = null; try { Seshat = require('matrix-seshat'); - makeDir = require('make-dir'); } catch (e) { } @@ -255,9 +256,8 @@ ipcMain.on('seshat', async function(ev, payload) { if (eventIndex === null) { let p = path.normalize(eventStorePath); try { - await makeDir(p); + await afs.mkdir(p, {recursive: true}); eventIndex = new Seshat(p, {passphrase: "DEFAULT_PASSPHRASE"}); - console.log("Initialized event store"); } catch (e) { sendError(payload.id, e); return; @@ -265,11 +265,25 @@ ipcMain.on('seshat', async function(ev, payload) { } break; - case 'deleteEventIndex': - await eventIndex.delete(); + case 'closeEventIndex': eventIndex = null; break; + case 'deleteEventIndex': + const deleteFolderRecursive = async(p) => { + for (let entry of await afs.readdir(p)) { + const curPath = path.join(p, entry); + await afs.unlink(curPath); + } + } + + try { + await deleteFolderRecursive(path.normalize(eventStorePath)); + } catch (e) { + } + + break; + case 'isEventIndexEmpty': if (eventIndex === null) ret = true; else ret = await eventIndex.isEmpty(); diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index 1d405c76cd..3db0e4f7ca 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -149,6 +149,10 @@ class SeshatIndexerManager extends BaseEventIndexManager { return this._ipcCall('loadCheckpoints'); } + async closeEventIndex(): Promise<> { + return this._ipcCall('closeEventIndex'); + } + async deleteEventIndex(): Promise<> { return this._ipcCall('deleteEventIndex'); } From 076bf6f0e59692f1b15c6fc13c20dd8a522e6a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 19 Nov 2019 12:25:45 +0100 Subject: [PATCH 12/32] develop: Enable the event indexing feature in labs. --- riot.im/develop/config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/riot.im/develop/config.json b/riot.im/develop/config.json index f028ab970e..cf8a9d20c9 100644 --- a/riot.im/develop/config.json +++ b/riot.im/develop/config.json @@ -27,7 +27,8 @@ "feature_sas": "labs", "feature_room_breadcrumbs": "labs", "feature_state_counters": "labs", - "feature_many_integration_managers": "labs" + "feature_many_integration_managers": "labs", + "feature_event_indexing": "labs" }, "welcomeUserId": "@riot-bot:matrix.org", "piwik": { From 0813aff1bde5a39cdb227e99b5ae6ae30d7938d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 19 Nov 2019 12:36:11 +0100 Subject: [PATCH 13/32] electron-main: Remove an extra newline. --- electron_app/src/electron-main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index af174fe7ab..6c487b3a6b 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -92,7 +92,6 @@ try { // Could not load local config, this is expected in most cases. } - const eventStorePath = path.join(app.getPath('userData'), 'EventStore'); const store = new Store({ name: "electron-config" }); From b17a403bcdcf4d472c061286cf1bf702f9462ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 19 Nov 2019 12:36:31 +0100 Subject: [PATCH 14/32] electron-main: No need to normalize the path. --- electron_app/src/electron-main.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index 6c487b3a6b..b1ed76c8f0 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -253,10 +253,9 @@ ipcMain.on('seshat', async function(ev, payload) { case 'initEventIndex': if (eventIndex === null) { - let p = path.normalize(eventStorePath); try { - await afs.mkdir(p, {recursive: true}); - eventIndex = new Seshat(p, {passphrase: "DEFAULT_PASSPHRASE"}); + await afs.mkdir(eventStorePath, {recursive: true}); + eventIndex = new Seshat(eventStorePath, {passphrase: "DEFAULT_PASSPHRASE"}); } catch (e) { sendError(payload.id, e); return; @@ -277,7 +276,7 @@ ipcMain.on('seshat', async function(ev, payload) { } try { - await deleteFolderRecursive(path.normalize(eventStorePath)); + await deleteFolderRecursive(eventStorePath); } catch (e) { } From 4a252526266b09b57432717462c9a83c0eaf8b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 19 Nov 2019 12:43:01 +0100 Subject: [PATCH 15/32] ElectronPlatform: Rename the SeshatIndexerManager. --- src/vector/platform/ElectronPlatform.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index 3db0e4f7ca..6a0e7a0c78 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -67,7 +67,7 @@ function getUpdateCheckStatus(status) { } } -class SeshatIndexerManager extends BaseEventIndexManager { +class SeshatIndexManager extends BaseEventIndexManager { constructor() { super(); @@ -164,7 +164,7 @@ export default class ElectronPlatform extends VectorBasePlatform { this._pendingIpcCalls = {}; this._nextIpcCallId = 0; - this.eventIndexManager = new SeshatIndexerManager(); + this.eventIndexManager = new SeshatIndexManager(); dis.register(_onAction); /* From 73b302f43288e062fd1bb96a7d4972416115329e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 19 Nov 2019 12:43:43 +0100 Subject: [PATCH 16/32] ElectronPlatform: Fix some type annotations. --- src/vector/platform/ElectronPlatform.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index 6a0e7a0c78..ff73725648 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -131,8 +131,8 @@ class SeshatIndexManager extends BaseEventIndexManager { async addHistoricEvents( events: [HistoricEvent], - checkpoint: CrawlerCheckpoint | null = null, - oldCheckpoint: CrawlerCheckpoint | null = null, + checkpoint: CrawlerCheckpoint | null, + oldCheckpoint: CrawlerCheckpoint | null, ): Promise<> { return this._ipcCall('addHistoricEvents', events, checkpoint, oldCheckpoint); } From 137bedb3f99198732521d92fafb6c68e4400df00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 19 Nov 2019 12:53:55 +0100 Subject: [PATCH 17/32] ElectronPlatform: Update the path for the BaseEventIndexManager class. --- src/vector/platform/ElectronPlatform.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index ff73725648..43a2dcd55a 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -20,7 +20,7 @@ limitations under the License. */ import VectorBasePlatform, {updateCheckStatusEnum} from './VectorBasePlatform'; -import BaseEventIndexManager from 'matrix-react-sdk/lib/BaseEventIndexManager'; +import BaseEventIndexManager from 'matrix-react-sdk/lib/indexing/BaseEventIndexManager'; import dis from 'matrix-react-sdk/lib/dispatcher'; import { _t } from 'matrix-react-sdk/lib/languageHandler'; import Promise from 'bluebird'; From 2f2cbade96ca83e6eea495f174c67708129fc1ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 21 Nov 2019 10:51:23 +0100 Subject: [PATCH 18/32] electron_app: Remove Seshat from the dependencies. --- electron_app/package.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/electron_app/package.json b/electron_app/package.json index cd1b8b2f35..f7a70bce61 100644 --- a/electron_app/package.json +++ b/electron_app/package.json @@ -5,16 +5,11 @@ "version": "1.4.2", "description": "A feature-rich client for Matrix.org", "author": "New Vector Ltd.", - "scripts": { - "build": "electron-build-env --electron 6.0.3 neon build seshat-node --release", - "postinstall": "yarn build" - }, "dependencies": { "auto-launch": "^5.0.1", "electron-store": "^2.0.0", "electron-window-state": "^4.1.0", "minimist": "^1.2.0", - "png-to-ico": "^1.0.2", - "matrix-seshat": "^0.3.0" + "png-to-ico": "^1.0.2" } } From d0b53916e3036d7d319b3a36e011298d730bda0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 21 Nov 2019 10:56:25 +0100 Subject: [PATCH 19/32] docs: Add documentation explaining how to enable Seshat support. --- docs/native-node-modules.md | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 docs/native-node-modules.md diff --git a/docs/native-node-modules.md b/docs/native-node-modules.md new file mode 100644 index 0000000000..39606024e7 --- /dev/null +++ b/docs/native-node-modules.md @@ -0,0 +1,44 @@ +Native Node Modules + +Since v???, the electron version of Riot can make use of native node modules. +These allow Riot to integrate with the desktop in ways that a browser cannot. + +While handy, these modules must be compiled and are thus downloaded +pre-compiled during build so that a single OS can compile Riot for all +platforms. If you would like to compile the native node modules from source, +as is done for Riot releases, instead of trusting binaries hosted on npm, +then please read on. + +Do note that compiling a module for a particular operating system +(Linux/Mac/Windows) and will need to be done on that operating system. + +## Adding Seshat support + +Seshat is a native node library that adds support for local event indexing and +full text search in E2E encrypted rooms. + +Since Seshat is written in rust the rust compiler and cargo tool-chain need to be +installed before installing Seshat itself. After installing the compiler Seshat +support can be added using yarn inside the `electron_app/` directory: + + yarn add matrix-seshat + +After this is done the electron version of riot can be run from the main folder +as usual using: + + yarn electron + +If for some reason recompilation of Seshat is needed, e.g. when using a +development version of Seshat using `yarn link`, or if the initial compilation was +done for the wrong electron version, Seshat can be recompiled with the +`electron-build-env` tool. Again from the `electron_app/` directory: + + yarn add electron-build-env + +Recompiling Seshat itself can be done like so: + + yarn run electron-build-env -- --electron 6.1.1 -- neon build matrix-seshat --release` + +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. From e96c44c1f2bafd1acb10383c49ea844298b56979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 26 Nov 2019 09:56:02 +0100 Subject: [PATCH 20/32] package.json: Remove the unneeded Neon/Seshat dependencies. --- package.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index 0026891285..bd05b090df 100644 --- a/package.json +++ b/package.json @@ -148,9 +148,7 @@ "source-map-loader": "^0.2.4", "webpack": "^4.23.1", "webpack-cli": "^3.1.2", - "webpack-dev-server": "^3.1.11", - "electron-build-env": "^0.2.0", - "neon-cli": "^0.3.1" + "webpack-dev-server": "^3.1.11" }, "build": { "appId": "im.riot.app", From 4c629e82c80cba8f9a7f188f1b6965f8e189bec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 26 Nov 2019 10:00:15 +0100 Subject: [PATCH 21/32] native-node-modules: Add a header level to the title. --- docs/native-node-modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/native-node-modules.md b/docs/native-node-modules.md index 39606024e7..a66fa95d94 100644 --- a/docs/native-node-modules.md +++ b/docs/native-node-modules.md @@ -1,4 +1,4 @@ -Native Node Modules +# Native Node Modules Since v???, the electron version of Riot can make use of native node modules. These allow Riot to integrate with the desktop in ways that a browser cannot. From da4b4037a8d8a142e2bc0802970d8f8a82f7b84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 26 Nov 2019 10:03:45 +0100 Subject: [PATCH 22/32] native-node-modules: Don't mention the riot version that supports native modules. --- docs/native-node-modules.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/native-node-modules.md b/docs/native-node-modules.md index a66fa95d94..41c3789f35 100644 --- a/docs/native-node-modules.md +++ b/docs/native-node-modules.md @@ -1,7 +1,8 @@ # Native Node Modules -Since v???, the electron version of Riot can make use of native node modules. -These allow Riot to integrate with the desktop in ways that a browser cannot. +For some features, the desktop version of Riot can make use of native Node +modules. These allow Riot to integrate with the desktop in ways that a browser +cannot. While handy, these modules must be compiled and are thus downloaded pre-compiled during build so that a single OS can compile Riot for all From b52141d6a851ae5f4d1d34442ab784a8e46b03d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 26 Nov 2019 10:12:52 +0100 Subject: [PATCH 23/32] native-node-modules: Add a section about cross compilation. --- docs/native-node-modules.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/native-node-modules.md b/docs/native-node-modules.md index 41c3789f35..76bd5a1607 100644 --- a/docs/native-node-modules.md +++ b/docs/native-node-modules.md @@ -11,7 +11,9 @@ as is done for Riot releases, instead of trusting binaries hosted on npm, then please read on. Do note that compiling a module for a particular operating system -(Linux/Mac/Windows) and will need to be done on that operating system. +(Linux/macOS/Windows) and will need to be done on that operating system. +Cross-compiling from a host OS for a different target OS may be possible, but +we don't support this flow with Riot dependencies at this time. ## Adding Seshat support From 5f6636e28bd75c5bf38552bf6efa2017ae8a181b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 26 Nov 2019 10:13:38 +0100 Subject: [PATCH 24/32] native-node-modules: Reword the second paragraph. --- docs/native-node-modules.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/native-node-modules.md b/docs/native-node-modules.md index 76bd5a1607..6585928180 100644 --- a/docs/native-node-modules.md +++ b/docs/native-node-modules.md @@ -4,11 +4,11 @@ For some features, the desktop version of Riot can make use of native Node modules. These allow Riot to integrate with the desktop in ways that a browser cannot. -While handy, these modules must be compiled and are thus downloaded -pre-compiled during build so that a single OS can compile Riot for all -platforms. If you would like to compile the native node modules from source, -as is done for Riot releases, instead of trusting binaries hosted on npm, -then please read on. +While native modules enable powerful new features, they must be complied for +each operating system. For official Riot releases, we will always build these +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 +custom build of Riot without installing the various build tools required. Do note that compiling a module for a particular operating system (Linux/macOS/Windows) and will need to be done on that operating system. From b1aff2995d9c96923aadbad4a11ddb3211e80a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 26 Nov 2019 10:19:15 +0100 Subject: [PATCH 25/32] native-node-modules: Explain the packaging situation a bit. --- docs/native-node-modules.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/native-node-modules.md b/docs/native-node-modules.md index 6585928180..c80347d5e2 100644 --- a/docs/native-node-modules.md +++ b/docs/native-node-modules.md @@ -15,6 +15,12 @@ Do note that compiling a module for a particular operating system Cross-compiling from a host OS for a different target OS may be possible, but we don't support this flow with Riot dependencies at this time. +At the moment, we need to make some changes to the Riot release process before +we can support native Node modules at release time, so these features are +currently disabled by default until that is resolved. The following sections +explain the manual steps you can use with a custom build of Riot to enable +these features if you'd like to try them out. + ## Adding Seshat support Seshat is a native node library that adds support for local event indexing and From 40f2648fd373fd4f4e2ab15d1b5c5ee779663b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 26 Nov 2019 10:19:45 +0100 Subject: [PATCH 26/32] native-node-modules: Expand the Seshat subtitle a bit. --- docs/native-node-modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/native-node-modules.md b/docs/native-node-modules.md index c80347d5e2..35bda927e5 100644 --- a/docs/native-node-modules.md +++ b/docs/native-node-modules.md @@ -21,7 +21,7 @@ currently disabled by default until that is resolved. The following sections explain the manual steps you can use with a custom build of Riot to enable these features if you'd like to try them out. -## Adding Seshat support +## Adding Seshat for search in E2E encrypted rooms Seshat is a native node library that adds support for local event indexing and full text search in E2E encrypted rooms. From f0fe96894478c921da0dcdae8a8a724ab4ea6292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 26 Nov 2019 10:20:56 +0100 Subject: [PATCH 27/32] native-node-modules: Capitalize some project names. --- docs/native-node-modules.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/native-node-modules.md b/docs/native-node-modules.md index 35bda927e5..f993a068c3 100644 --- a/docs/native-node-modules.md +++ b/docs/native-node-modules.md @@ -23,7 +23,7 @@ these features if you'd like to try them out. ## Adding Seshat for search in E2E encrypted rooms -Seshat is a native node library that adds support for local event indexing and +Seshat is a native Node module that adds support for local event indexing and full text search in E2E encrypted rooms. Since Seshat is written in rust the rust compiler and cargo tool-chain need to be @@ -32,7 +32,7 @@ support can be added using yarn inside the `electron_app/` directory: yarn add matrix-seshat -After this is done the electron version of riot can be run from the main folder +After this is done the Electron version of Riot can be run from the main folder as usual using: yarn electron From 5b8e918d6e580b48ed8001c3de86771f6ce62109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 26 Nov 2019 10:21:15 +0100 Subject: [PATCH 28/32] native-node-modules: Explain how to install Rust and link to its docs. --- docs/native-node-modules.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/native-node-modules.md b/docs/native-node-modules.md index f993a068c3..43724b6a26 100644 --- a/docs/native-node-modules.md +++ b/docs/native-node-modules.md @@ -26,9 +26,12 @@ these features if you'd like to try them out. Seshat is a native Node module that adds support for local event indexing and full text search in E2E encrypted rooms. -Since Seshat is written in rust the rust compiler and cargo tool-chain need to be -installed before installing Seshat itself. After installing the compiler Seshat -support can be added using yarn inside the `electron_app/` directory: +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). + +After installing the compiler, Seshat support can be added using yarn inside +the `electron_app/` directory: yarn add matrix-seshat From 1869350a9b547458bd2d8619cb55e5b25720b419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 26 Nov 2019 10:38:49 +0100 Subject: [PATCH 29/32] native-node-modules: Remove a spurious and. --- docs/native-node-modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/native-node-modules.md b/docs/native-node-modules.md index 43724b6a26..1f7d54f07a 100644 --- a/docs/native-node-modules.md +++ b/docs/native-node-modules.md @@ -11,7 +11,7 @@ we may offer a pre-compiled path for those who want to use these features in a custom build of Riot without installing the various build tools required. Do note that compiling a module for a particular operating system -(Linux/macOS/Windows) and will need to be done on that operating system. +(Linux/macOS/Windows) will need to be done on that operating system. Cross-compiling from a host OS for a different target OS may be possible, but we don't support this flow with Riot dependencies at this time. From b0783a8995370e2be1191ee83c39e64ea0107471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 26 Nov 2019 18:02:49 +0100 Subject: [PATCH 30/32] native-node-modules: Mention that Seshat requires SQLCipher. --- docs/native-node-modules.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/native-node-modules.md b/docs/native-node-modules.md index 1f7d54f07a..6e3dce4525 100644 --- a/docs/native-node-modules.md +++ b/docs/native-node-modules.md @@ -30,8 +30,11 @@ 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). -After installing the compiler, Seshat support can be added using yarn inside -the `electron_app/` directory: +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: yarn add matrix-seshat From f28f27a87b5f512c531d8dee93d7dc095768ac28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 26 Nov 2019 18:03:46 +0100 Subject: [PATCH 31/32] labs: Document the event indexing labs feature. --- docs/labs.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/labs.md b/docs/labs.md index ae2c72a488..1561021403 100644 --- a/docs/labs.md +++ b/docs/labs.md @@ -49,3 +49,11 @@ That's it. Now should see your new counter under the header. ## Multiple integration managers (`feature_many_integration_managers`) Exposes a way to access all the integration managers known to Riot. This is an implementation of [MSC1957](https://github.com/matrix-org/matrix-doc/pull/1957). + +## Event indexing or E2EE search support using Seshat (`feature_event_indexing`) + +Adds support for search in E2E encrypted rooms. This enables an event indexer +that downloads, stores, and indexes room messages for E2E encrypted rooms. + +The existing search will transparently work for encrypted rooms just like it +does for non-encrypted. From e5956de7441b618bba104956781d2e73070271e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 26 Nov 2019 18:39:22 +0100 Subject: [PATCH 32/32] labs: Clarify that the event indexing feature supports E2EE search. --- docs/labs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/labs.md b/docs/labs.md index 1561021403..f7601078b5 100644 --- a/docs/labs.md +++ b/docs/labs.md @@ -50,7 +50,7 @@ That's it. Now should see your new counter under the header. Exposes a way to access all the integration managers known to Riot. This is an implementation of [MSC1957](https://github.com/matrix-org/matrix-doc/pull/1957). -## Event indexing or E2EE search support using Seshat (`feature_event_indexing`) +## Event indexing and E2EE search support using Seshat (`feature_event_indexing`) Adds support for search in E2E encrypted rooms. This enables an event indexer that downloads, stores, and indexes room messages for E2E encrypted rooms.