From b0fb043c2b190cb37b9615195d57fcd41c4434e2 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 19 May 2020 11:54:08 +0100 Subject: [PATCH] Add localforage support for persisting dendrite data --- package.json | 1 + src/vector/dendrite-sw.js | 3 ++- webpack.config.js | 1 + yarn.lock | 19 +++++++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d71f9503..ba607f4b 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "gemini-scrollbar": "github:matrix-org/gemini-scrollbar#91e1e566", "gfm.css": "^1.1.2", "highlight.js": "^9.13.1", + "localforage": "^1.7.3", "matrix-js-sdk": "5.1.1", "matrix-react-sdk": "github:matrix-org/matrix-react-sdk#p2p", "olm": "https://packages.matrix.org/npm/olm/olm-3.1.4.tgz", diff --git a/src/vector/dendrite-sw.js b/src/vector/dendrite-sw.js index 90384254..4193558e 100644 --- a/src/vector/dendrite-sw.js +++ b/src/vector/dendrite-sw.js @@ -31,7 +31,8 @@ self.registration.addEventListener('updatefound', () => { self.importScripts(`${bundle_path}/wasm_exec.js`, `${bundle_path}/go_http_bridge.js`, - `${bundle_path}/sqlitejs.js`) + `${bundle_path}/sqlitejs.js`, + `${bundle_path}/localforage.js`) function initDendrite() { console.log(`dendrite-sw.js: v${version} SW init`) diff --git a/webpack.config.js b/webpack.config.js index 999a7ede..8d0edfe1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -36,6 +36,7 @@ module.exports = (env, argv) => { "dendrite_sw": "./src/vector/dendrite-sw.js", "mobileguide": "./src/vector/mobile_guide/index.js", "sqlitejs": "./src/vector/sqlitejs.js", + "localforage": "./node_modules/localforage/dist/localforage.min.js", "go_http_bridge": "./node_modules/go-http-js-libp2p/js/bridge.js", "sql_wasm": "./node_modules/sql.js/dist/sql-wasm.wasm", "dendrite_wasm": "./src/vector/dendrite.wasm", diff --git a/yarn.lock b/yarn.lock index b2560ef4..aa29c411 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5740,6 +5740,11 @@ ignore@^5.1.4: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A== +immediate@~3.0.5: + version "3.0.6" + resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" + integrity sha1-nbHb0Pr43m++D13V5Wu2BigN5ps= + immutable@^3.7.4: version "3.8.2" resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3" @@ -7159,6 +7164,13 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lie@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lie/-/lie-3.1.1.tgz#9a436b2cc7746ca59de7a41fa469b3efb76bd87e" + integrity sha1-mkNrLMd0bKWd56QfpGmz77dr2H4= + dependencies: + immediate "~3.0.5" + lines-and-columns@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" @@ -7219,6 +7231,13 @@ loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4 emojis-list "^3.0.0" json5 "^1.0.1" +localforage@^1.7.3: + version "1.7.3" + resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.7.3.tgz#0082b3ca9734679e1bd534995bdd3b24cf10f204" + integrity sha512-1TulyYfc4udS7ECSBT2vwJksWbkwwTX8BzeUIiq8Y07Riy7bDAAnxDaPU/tWyOVmQAcWJIEIFP9lPfBGqVoPgQ== + dependencies: + lie "3.1.1" + locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"