This commit is contained in:
James Long 2022-09-14 23:34:16 -04:00
parent e3f1fafad9
commit 9177fb4d77
2 changed files with 4 additions and 4 deletions

View file

@ -126,7 +126,7 @@ app.post('/sync', async (req, res) => {
// encode it back... // encode it back...
let responsePb = new SyncPb.SyncResponse(); let responsePb = new SyncPb.SyncResponse();
responsePb.setMerkle(JSON.stringify(trie)); responsePb.setMerkle(JSON.stringify(trie));
newMessages.forEach(msg => responsePb.addMessages(msg)); newMessages.forEach((msg) => responsePb.addMessages(msg));
res.set('Content-Type', 'application/actual-sync'); res.set('Content-Type', 'application/actual-sync');
res.send(Buffer.from(responsePb.serializeBinary())); res.send(Buffer.from(responsePb.serializeBinary()));
@ -368,7 +368,7 @@ app.get('/list-user-files', (req, res) => {
res.send( res.send(
JSON.stringify({ JSON.stringify({
status: 'ok', status: 'ok',
data: rows.map(row => ({ data: rows.map((row) => ({
deleted: row.deleted, deleted: row.deleted,
fileId: row.id, fileId: row.id,
groupId: row.group_id, groupId: row.group_id,

View file

@ -57,7 +57,7 @@ function addMessages(db, messages) {
return returnValue; return returnValue;
} }
function getMerkle(db, group_id) { function getMerkle(db) {
let rows = db.all('SELECT * FROM messages_merkles'); let rows = db.all('SELECT * FROM messages_merkles');
if (rows.length > 0) { if (rows.length > 0) {
@ -84,7 +84,7 @@ function sync(messages, since, groupId) {
return { return {
trie, trie,
newMessages: newMessages.map(msg => { newMessages: newMessages.map((msg) => {
const envelopePb = new SyncPb.MessageEnvelope(); const envelopePb = new SyncPb.MessageEnvelope();
envelopePb.setTimestamp(msg.timestamp); envelopePb.setTimestamp(msg.timestamp);
envelopePb.setIsencrypted(msg.is_encrypted); envelopePb.setIsencrypted(msg.is_encrypted);