feat(e2ee): introduce OLM encryption. refactor(storage): moved from fs to localstorage. refactor(config): added as global to registrar. chore(npm): upgraded matrix-js-sdk from 2.4.6 release to 9.5.1 release.
This commit is contained in:
parent
0cd373fb8a
commit
67b88f9c96
28 changed files with 264 additions and 1413 deletions
26
registrar.js
26
registrar.js
|
@ -1,16 +1,24 @@
|
|||
const fs = require('fs');
|
||||
global.Olm = require('olm');
|
||||
global.sdk = require('matrix-js-sdk');
|
||||
global.axios = require('axios');
|
||||
global.config = require('./config.js');
|
||||
global.auth = require('./auth.js');
|
||||
|
||||
//initializers
|
||||
if (!fs.existsSync('fediverse_auth.json')) fs.copyFileSync('fediverse_auth.example.json', 'fediverse_auth.json');
|
||||
if (!fs.existsSync('matrix_auth.json')) fs.copyFileSync('matrix_auth.example.json', 'matrix_auth.json');
|
||||
if (!fs.existsSync('config.js')) fs.copyFileSync('config.example.js', 'config.js');
|
||||
if (!fs.existsSync('timeline.json')) fs.writeFileSync('timeline.json', 0);
|
||||
if (!fs.existsSync('notification.json')) fs.writeFileSync('notification.json', 0);
|
||||
const { LocalStorage } = require('node-localstorage');
|
||||
global.localStorage = new LocalStorage('./keys');
|
||||
if (!localStorage.getItem('matrix_auth')){
|
||||
localStorage.clear();
|
||||
localStorage.setItem('matrix_auth', "{}");
|
||||
}
|
||||
if (!localStorage.getItem('fediverse_auth')) localStorage.setItem('fediverse_auth', "{}");
|
||||
if (!localStorage.getItem('timeline')) localStorage.setItem('timeline', "{}");
|
||||
if (!localStorage.getItem('notifications')) localStorage.setItem('notifications', "{}");
|
||||
|
||||
global.matrix_auth = JSON.parse(localStorage.getItem('matrix_auth'));
|
||||
global.fediverse_auth = JSON.parse(localStorage.getItem('fediverse_auth'));
|
||||
|
||||
module.exports = {
|
||||
config: require('./config.js'),
|
||||
fediverse_auth: require('./fediverse_auth.json'),
|
||||
matrix_auth: require('./matrix_auth.json'),
|
||||
archive: require('./commands/archive.js'),
|
||||
invidious: require('./commands/invidious.js'),
|
||||
nitter: require('./commands/nitter.js'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue