You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
All: Made WebDAV options dynamics so that changing username or password doesn't require restarting the app
This commit is contained in:
@@ -366,7 +366,7 @@ class NoteTextComponent extends React.Component {
|
|||||||
webviewReady: true,
|
webviewReady: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Setting.value('env') === 'dev') this.webview_.openDevTools();
|
// if (Setting.value('env') === 'dev') this.webview_.openDevTools();
|
||||||
}
|
}
|
||||||
|
|
||||||
webview_ref(element) {
|
webview_ref(element) {
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ app().start(bridge().processArgv()).then(() => {
|
|||||||
if (error.fileName) msg.push(error.fileName);
|
if (error.fileName) msg.push(error.fileName);
|
||||||
if (error.lineNumber) msg.push(error.lineNumber);
|
if (error.lineNumber) msg.push(error.lineNumber);
|
||||||
if (error.stack) msg.push(error.stack);
|
if (error.stack) msg.push(error.stack);
|
||||||
bridge().showErrorMessageBox(msg.join('\n'));
|
bridge().showErrorMessageBox(msg.join('\n\n'));
|
||||||
}
|
}
|
||||||
|
|
||||||
bridge().electronApp().exit(1);
|
bridge().electronApp().exit(1);
|
||||||
|
|||||||
@@ -44,4 +44,13 @@ ObjectUtils.fieldsEqual = function(o1, o2) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ObjectUtils.convertValuesToFunctions = function(o) {
|
||||||
|
const output = {};
|
||||||
|
for (let n in o) {
|
||||||
|
if (!o.hasOwnProperty(n)) continue;
|
||||||
|
output[n] = () => { return typeof o[n] === 'function' ? o[n]() : o[n]; }
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = ObjectUtils;
|
module.exports = ObjectUtils;
|
||||||
@@ -38,9 +38,9 @@ class SyncTargetNextcloud extends BaseSyncTarget {
|
|||||||
|
|
||||||
async initFileApi() {
|
async initFileApi() {
|
||||||
const fileApi = await SyncTargetWebDAV.newFileApi_(SyncTargetNextcloud.id(), {
|
const fileApi = await SyncTargetWebDAV.newFileApi_(SyncTargetNextcloud.id(), {
|
||||||
path: Setting.value('sync.5.path'),
|
path: () => Setting.value('sync.5.path'),
|
||||||
username: Setting.value('sync.5.username'),
|
username: () => Setting.value('sync.5.username'),
|
||||||
password: Setting.value('sync.5.password'),
|
password: () => Setting.value('sync.5.password'),
|
||||||
});
|
});
|
||||||
|
|
||||||
fileApi.setLogger(this.logger());
|
fileApi.setLogger(this.logger());
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ class SyncTargetWebDAV extends BaseSyncTarget {
|
|||||||
|
|
||||||
static async newFileApi_(syncTargetId, options) {
|
static async newFileApi_(syncTargetId, options) {
|
||||||
const apiOptions = {
|
const apiOptions = {
|
||||||
baseUrl: () => options.path,
|
baseUrl: () => options.path(),
|
||||||
username: () => options.username,
|
username: () => options.username(),
|
||||||
password: () => options.password,
|
password: () => options.password(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const api = new WebDavApi(apiOptions);
|
const api = new WebDavApi(apiOptions);
|
||||||
@@ -65,9 +65,9 @@ class SyncTargetWebDAV extends BaseSyncTarget {
|
|||||||
|
|
||||||
async initFileApi() {
|
async initFileApi() {
|
||||||
const fileApi = await SyncTargetWebDAV.newFileApi_(SyncTargetWebDAV.id(), {
|
const fileApi = await SyncTargetWebDAV.newFileApi_(SyncTargetWebDAV.id(), {
|
||||||
path: Setting.value('sync.6.path'),
|
path: () => Setting.value('sync.6.path'),
|
||||||
username: Setting.value('sync.6.username'),
|
username: () => Setting.value('sync.6.username'),
|
||||||
password: Setting.value('sync.6.password'),
|
password: () => Setting.value('sync.6.password'),
|
||||||
});
|
});
|
||||||
|
|
||||||
fileApi.setLogger(this.logger());
|
fileApi.setLogger(this.logger());
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const Setting = require('lib/models/Setting.js');
|
const Setting = require('lib/models/Setting.js');
|
||||||
const SyncTargetRegistry = require('lib/SyncTargetRegistry');
|
const SyncTargetRegistry = require('lib/SyncTargetRegistry');
|
||||||
|
const ObjectUtils = require('lib/ObjectUtils');
|
||||||
const { _ } = require('lib/locale.js');
|
const { _ } = require('lib/locale.js');
|
||||||
|
|
||||||
const shared = {}
|
const shared = {}
|
||||||
@@ -16,7 +17,7 @@ shared.checkSyncConfig = async function(comp, settings) {
|
|||||||
const SyncTargetClass = SyncTargetRegistry.classById(syncTargetId);
|
const SyncTargetClass = SyncTargetRegistry.classById(syncTargetId);
|
||||||
const options = Setting.subValues('sync.' + syncTargetId, settings);
|
const options = Setting.subValues('sync.' + syncTargetId, settings);
|
||||||
comp.setState({ checkSyncConfigResult: 'checking' });
|
comp.setState({ checkSyncConfigResult: 'checking' });
|
||||||
const result = await SyncTargetClass.checkConfig(options);
|
const result = await SyncTargetClass.checkConfig(ObjectUtils.convertValuesToFunctions(options));
|
||||||
comp.setState({ checkSyncConfigResult: result });
|
comp.setState({ checkSyncConfigResult: result });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user