From aa7da784fc376ad4bc1d3fc4aafe824c75de9162 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Wed, 20 Jun 2018 00:28:50 +0100 Subject: [PATCH] All: Fixes #343, Fixes #191: Added options to ignore TLS cert errors to allow self-signed certificates on desktop and CLI --- ReactNativeClient/lib/BaseApplication.js | 5 +++++ ReactNativeClient/lib/models/Setting.js | 2 ++ docs/clipper/index.html | 1 - readme/clipper.md | 2 -- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ReactNativeClient/lib/BaseApplication.js b/ReactNativeClient/lib/BaseApplication.js index 8e20bb936..9f0f8f26f 100644 --- a/ReactNativeClient/lib/BaseApplication.js +++ b/ReactNativeClient/lib/BaseApplication.js @@ -309,6 +309,11 @@ class BaseApplication { time.setTimeFormat(Setting.value('timeFormat')); } + if ((action.type == 'SETTING_UPDATE_ONE' && action.key == 'net.ignoreTlsErrors') || (action.type == 'SETTING_UPDATE_ALL')) { + // https://stackoverflow.com/questions/20082893/unable-to-verify-leaf-signature + process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = Setting.value('net.ignoreTlsErrors') ? '0' : '1'; + } + if ((action.type == 'SETTING_UPDATE_ONE' && (action.key.indexOf('encryption.') === 0)) || (action.type == 'SETTING_UPDATE_ALL')) { if (this.hasGui()) { await EncryptionService.instance().loadMasterKeysFromSettings(); diff --git a/ReactNativeClient/lib/models/Setting.js b/ReactNativeClient/lib/models/Setting.js index c8854e125..32ca96049 100644 --- a/ReactNativeClient/lib/models/Setting.js +++ b/ReactNativeClient/lib/models/Setting.js @@ -149,6 +149,8 @@ class Setting extends BaseModel { 'sync.5.context': { value: '', type: Setting.TYPE_STRING, public: false }, 'sync.6.context': { value: '', type: Setting.TYPE_STRING, public: false }, 'sync.7.context': { value: '', type: Setting.TYPE_STRING, public: false }, + + 'net.ignoreTlsErrors': { value: false, type: Setting.TYPE_BOOL, show: (settings) => { return [SyncTargetRegistry.nameToId('nextcloud'), SyncTargetRegistry.nameToId('webdav')].indexOf(settings['sync.target']) >= 0 }, public: true, appTypes: ['desktop', 'cli'], label: () => _('Ignore TLS certificate errors') }, }; return this.metadata_; diff --git a/docs/clipper/index.html b/docs/clipper/index.html index c93bd55be..3fb133e46 100644 --- a/docs/clipper/index.html +++ b/docs/clipper/index.html @@ -292,7 +292,6 @@ for (let portToTest = 41184; portToTest <= 41194; portToTest++) { } } -

start from 41184, then ping it (using the /ping method below)

The following methods are available:

GET /ping

Tells whether the service is active or not. It should return "JoplinClipperServer" if it works.

diff --git a/readme/clipper.md b/readme/clipper.md index 18e3b768b..cd853a31f 100644 --- a/readme/clipper.md +++ b/readme/clipper.md @@ -58,8 +58,6 @@ for (let portToTest = 41184; portToTest <= 41194; portToTest++) { } ``` -start from 41184, then ping it (using the /ping method below) - The following methods are available: ### GET /ping