mirror of
https://github.com/zadam/trilium.git
synced 2025-01-05 23:02:43 +08:00
fix getting sync setup
This commit is contained in:
parent
947e875b6c
commit
e8797a137f
1 changed files with 4 additions and 4 deletions
|
@ -4,6 +4,7 @@ const log = require('./log');
|
||||||
const sqlInit = require('./sql_init');
|
const sqlInit = require('./sql_init');
|
||||||
const repository = require('./repository');
|
const repository = require('./repository');
|
||||||
const optionService = require('./options');
|
const optionService = require('./options');
|
||||||
|
const syncOptions = require('./sync_options');
|
||||||
|
|
||||||
async function isSyncServerInitialized() {
|
async function isSyncServerInitialized() {
|
||||||
const response = await requestToSyncServer('GET', '/api/setup/status');
|
const response = await requestToSyncServer('GET', '/api/setup/status');
|
||||||
|
@ -36,11 +37,8 @@ async function setupSyncToSyncServer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function requestToSyncServer(method, path, body = null) {
|
async function requestToSyncServer(method, path, body = null) {
|
||||||
const syncServerHost = await optionService.getOption('syncServerHost');
|
|
||||||
const syncProxy = await optionService.getOption('syncProxy');
|
|
||||||
|
|
||||||
const rpOpts = {
|
const rpOpts = {
|
||||||
uri: syncServerHost + path,
|
uri: await syncOptions.getSyncServerHost() + path,
|
||||||
method: method,
|
method: method,
|
||||||
json: true
|
json: true
|
||||||
};
|
};
|
||||||
|
@ -49,6 +47,8 @@ async function requestToSyncServer(method, path, body = null) {
|
||||||
rpOpts.body = body;
|
rpOpts.body = body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const syncProxy = await syncOptions.getSyncProxy();
|
||||||
|
|
||||||
if (syncProxy) {
|
if (syncProxy) {
|
||||||
rpOpts.proxy = syncProxy;
|
rpOpts.proxy = syncProxy;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue