mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
proxy support
This commit is contained in:
parent
433982e7bc
commit
f9056c6754
@ -14,6 +14,7 @@ const syncUpdate = require('./sync_update');
|
|||||||
const SYNC_SERVER = config['Sync']['syncServerHost'];
|
const SYNC_SERVER = config['Sync']['syncServerHost'];
|
||||||
const isSyncSetup = !!SYNC_SERVER;
|
const isSyncSetup = !!SYNC_SERVER;
|
||||||
const SYNC_TIMEOUT = config['Sync']['syncServerTimeout'] || 5000;
|
const SYNC_TIMEOUT = config['Sync']['syncServerTimeout'] || 5000;
|
||||||
|
const SYNC_PROXY = config['Sync']['syncProxy'];
|
||||||
|
|
||||||
let syncInProgress = false;
|
let syncInProgress = false;
|
||||||
|
|
||||||
@ -215,14 +216,20 @@ async function syncRequest(syncContext, method, uri, body) {
|
|||||||
const fullUri = SYNC_SERVER + uri;
|
const fullUri = SYNC_SERVER + uri;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return await rp({
|
const options = {
|
||||||
method: method,
|
method: method,
|
||||||
uri: fullUri,
|
uri: fullUri,
|
||||||
jar: syncContext.cookieJar,
|
jar: syncContext.cookieJar,
|
||||||
json: true,
|
json: true,
|
||||||
body: body,
|
body: body,
|
||||||
timeout: SYNC_TIMEOUT
|
timeout: SYNC_TIMEOUT
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (SYNC_PROXY) {
|
||||||
|
options.proxy = SYNC_PROXY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return await rp(options);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
throw new Error("Request to " + method + " " + fullUri + " failed, inner exception: " + e.stack);
|
throw new Error("Request to " + method + " " + fullUri + " failed, inner exception: " + e.stack);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user