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
|
@ -1,20 +1,18 @@
|
|||
const axios = require('axios');
|
||||
const fs = require('fs');
|
||||
|
||||
exports.runQuery = function (matrixClient, room, registrar) {
|
||||
exports.runQuery = function (matrixClient, room) {
|
||||
setInterval(() => {
|
||||
axios({
|
||||
method: 'GET',
|
||||
url: `${registrar.config.fediverse.domain}/api/v1/timelines/home`,
|
||||
headers: { Authorization: `Bearer ${registrar.fediverse_auth.access_token}` },
|
||||
url: `${config.fediverse.domain}/api/v1/timelines/home`,
|
||||
headers: { Authorization: `Bearer ${fediverse_auth.access_token}` },
|
||||
}).then((events) => {
|
||||
const event = fs.readFileSync('timeline.json', 'utf8');
|
||||
fs.writeFileSync('timeline.json', events.data[0].created_at, 'utf8');
|
||||
if (event !== events.data[0].created_at) {
|
||||
let lastEvent = JSON.parse(localStorage.getItem('timeline'));
|
||||
localStorage.setItem('timeline', JSON.stringify(events.data[0].created_at, null, 2));
|
||||
|
||||
if (lastEvent !== events.data[0].created_at) {
|
||||
if (events.data[0].reblog === null) {
|
||||
matrixClient.sendHtmlNotice(room.roomId,
|
||||
'',
|
||||
`<b><a href="${registrar.config.fediverse.domain}/notice/${events.data[0].id}">${events.data[0].account.acct}</a>
|
||||
`<b><a href="${config.fediverse.domain}/notice/${events.data[0].id}">${events.data[0].account.acct}</a>
|
||||
<blockquote><i>${events.data[0].content}</i><br>
|
||||
${events.data[0].media_attachments.map(media =>
|
||||
`<a href="${media.remote_url}">`+`${media.description}`+'</a>'
|
||||
|
@ -24,9 +22,9 @@ exports.runQuery = function (matrixClient, room, registrar) {
|
|||
} else {
|
||||
matrixClient.sendHtmlNotice(room.roomId,
|
||||
'',
|
||||
`<b><a href="${registrar.config.fediverse.domain}/${events.data[0].account.id}">
|
||||
`<b><a href="${config.fediverse.domain}/${events.data[0].account.id}">
|
||||
${events.data[0].account.acct}</a>
|
||||
<font color="#7886D7">has <a href="${registrar.config.fediverse.domain}/notice/${events.data[0].id}">repeated</a>:
|
||||
<font color="#7886D7">has <a href="${config.fediverse.domain}/notice/${events.data[0].id}">repeated</a>:
|
||||
<blockquote><a href="${events.data[0].reblog.account.url}">${events.data[0].reblog.account.acct}</a></blockquote>
|
||||
<blockquote>${events.data[0].content}<br>
|
||||
${events.data[0].media_attachments.map(media =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue