mirror of
https://github.com/zadam/trilium.git
synced 2025-11-16 10:15:52 +01:00
#98, test sync impl
This commit is contained in:
@@ -35,7 +35,7 @@ async function setupSyncFromServer(req) {
|
||||
auth: username + ':' + password
|
||||
};
|
||||
|
||||
log.info("Getting document from: " + serverAddress + JSON.stringify(options));
|
||||
log.info("Getting document from: " + serverAddress);
|
||||
|
||||
http.request(options, function(response) {
|
||||
response.pipe(file);
|
||||
|
||||
@@ -9,6 +9,20 @@ const contentHashService = require('../../services/content_hash');
|
||||
const log = require('../../services/log');
|
||||
const DOCUMENT_PATH = require('../../services/data_dir').DOCUMENT_PATH;
|
||||
|
||||
async function testSync() {
|
||||
try {
|
||||
await syncService.login();
|
||||
|
||||
return { connection: "Success" };
|
||||
}
|
||||
catch (e) {
|
||||
return {
|
||||
connection: "Failure",
|
||||
error: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async function checkSync() {
|
||||
return {
|
||||
hashes: await contentHashService.getHashes(),
|
||||
@@ -80,6 +94,7 @@ async function getDocument(req, resp) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
testSync,
|
||||
checkSync,
|
||||
syncNow,
|
||||
fillSyncRows,
|
||||
|
||||
Reference in New Issue
Block a user