mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix sync double initialization issue
This commit is contained in:
parent
e8797a137f
commit
9b425025c9
@ -6,7 +6,8 @@ const log = require('../../services/log');
|
|||||||
|
|
||||||
async function getStatus() {
|
async function getStatus() {
|
||||||
return {
|
return {
|
||||||
isInitialized: await sqlInit.isDbInitialized()
|
isInitialized: await sqlInit.isDbInitialized(),
|
||||||
|
schemaExists: await sqlInit.schemaExists()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@ const repository = require('./repository');
|
|||||||
const optionService = require('./options');
|
const optionService = require('./options');
|
||||||
const syncOptions = require('./sync_options');
|
const syncOptions = require('./sync_options');
|
||||||
|
|
||||||
async function isSyncServerInitialized() {
|
async function hasSyncServerSchemaAndSeed() {
|
||||||
const response = await requestToSyncServer('GET', '/api/setup/status');
|
const response = await requestToSyncServer('GET', '/api/setup/status');
|
||||||
|
|
||||||
return response.isInitialized;
|
return response.schemaExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerSync() {
|
function triggerSync() {
|
||||||
@ -23,7 +23,7 @@ function triggerSync() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setupSyncToSyncServer() {
|
async function sendSeedToSyncServer() {
|
||||||
log.info("Initiating sync to server");
|
log.info("Initiating sync to server");
|
||||||
|
|
||||||
await requestToSyncServer('POST', '/api/setup/sync-seed', {
|
await requestToSyncServer('POST', '/api/setup/sync-seed', {
|
||||||
@ -105,9 +105,9 @@ async function getSyncSeedOptions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isSyncServerInitialized,
|
hasSyncServerSchemaAndSeed,
|
||||||
triggerSync,
|
triggerSync,
|
||||||
setupSyncToSyncServer,
|
sendSeedToSyncServer,
|
||||||
setupSyncFromSyncServer,
|
setupSyncFromSyncServer,
|
||||||
getSyncSeedOptions
|
getSyncSeedOptions
|
||||||
};
|
};
|
@ -71,8 +71,8 @@ async function sync() {
|
|||||||
async function login() {
|
async function login() {
|
||||||
const setupService = require('./setup'); // circular dependency issue
|
const setupService = require('./setup'); // circular dependency issue
|
||||||
|
|
||||||
if (!await setupService.isSyncServerInitialized()) {
|
if (!await setupService.hasSyncServerSchemaAndSeed()) {
|
||||||
await setupService.setupSyncToSyncServer();
|
await setupService.sendSeedToSyncServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
return await doLogin();
|
return await doLogin();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user