mirror of
https://github.com/TriliumNext/Notes.git
synced 2026-05-03 18:59:09 -05:00
https support (with custom ca) for sync
This commit is contained in:
@@ -12,6 +12,7 @@ const notes = require('./notes');
|
||||
const syncUpdate = require('./sync_update');
|
||||
const content_hash = require('./content_hash');
|
||||
const event_log = require('./event_log');
|
||||
const fs = require('fs');
|
||||
|
||||
const SYNC_SERVER = config['Sync']['syncServerHost'];
|
||||
const isSyncSetup = !!SYNC_SERVER;
|
||||
@@ -20,6 +21,7 @@ const SYNC_PROXY = config['Sync']['syncProxy'];
|
||||
|
||||
let syncInProgress = false;
|
||||
let proxyToggle = true;
|
||||
let syncServerCertificate = null;
|
||||
|
||||
async function sync() {
|
||||
if (syncInProgress) {
|
||||
@@ -288,6 +290,10 @@ async function syncRequest(syncContext, method, uri, body) {
|
||||
timeout: SYNC_TIMEOUT
|
||||
};
|
||||
|
||||
if (syncServerCertificate) {
|
||||
options.ca = syncServerCertificate;
|
||||
}
|
||||
|
||||
if (SYNC_PROXY && proxyToggle) {
|
||||
options.proxy = SYNC_PROXY;
|
||||
}
|
||||
@@ -306,6 +312,14 @@ if (isSyncSetup) {
|
||||
log.info("Sync proxy: " + SYNC_PROXY);
|
||||
}
|
||||
|
||||
const syncCertPath = config['Sync']['syncServerCertificate'];
|
||||
|
||||
if (syncCertPath) {
|
||||
log.info('Sync certificate: ' + syncCertPath);
|
||||
|
||||
syncServerCertificate = fs.readFileSync(syncCertPath);
|
||||
}
|
||||
|
||||
setInterval(sync, 60000);
|
||||
|
||||
// kickoff initial sync immediately
|
||||
|
||||
Reference in New Issue
Block a user