mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 03:16:11 +01:00
#98, sync setup now doesn't copy the whole DB file, but sets up minimal database and starts off sync
This commit is contained in:
@@ -7,7 +7,7 @@ const sql = require('../../services/sql');
|
||||
const optionService = require('../../services/options');
|
||||
const contentHashService = require('../../services/content_hash');
|
||||
const log = require('../../services/log');
|
||||
const DOCUMENT_PATH = require('../../services/data_dir').DOCUMENT_PATH;
|
||||
const repository = require('../../services/repository');
|
||||
|
||||
async function testSync() {
|
||||
try {
|
||||
@@ -23,6 +23,10 @@ async function testSync() {
|
||||
}
|
||||
}
|
||||
|
||||
async function getStats() {
|
||||
return syncService.stats;
|
||||
}
|
||||
|
||||
async function checkSync() {
|
||||
return {
|
||||
hashes: await contentHashService.getHashes(),
|
||||
@@ -75,7 +79,10 @@ async function getChanged(req) {
|
||||
|
||||
const syncs = await sql.getRows("SELECT * FROM sync WHERE id > ? LIMIT 1000", [lastSyncId]);
|
||||
|
||||
return await syncService.getSyncRecords(syncs);
|
||||
return {
|
||||
syncs: await syncService.getSyncRecords(syncs),
|
||||
maxSyncId: await sql.getValue('SELECT MAX(id) FROM sync')
|
||||
};
|
||||
}
|
||||
|
||||
async function update(req) {
|
||||
@@ -87,10 +94,13 @@ async function update(req) {
|
||||
}
|
||||
}
|
||||
|
||||
async function getDocument(req, resp) {
|
||||
log.info("Serving document.");
|
||||
async function getDocument() {
|
||||
log.info("Serving document options.");
|
||||
|
||||
resp.sendFile(DOCUMENT_PATH);
|
||||
return [
|
||||
await repository.getOption('documentId'),
|
||||
await repository.getOption('documentSecret')
|
||||
];
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
@@ -102,5 +112,6 @@ module.exports = {
|
||||
forceNoteSync,
|
||||
getChanged,
|
||||
update,
|
||||
getDocument
|
||||
getDocument,
|
||||
getStats
|
||||
};
|
||||
Reference in New Issue
Block a user