1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-27 23:28:38 +02:00

Server: Add support for sharing notes via a link

This commit is contained in:
Laurent Cozic
2021-01-29 18:45:11 +00:00
parent 4a847a096b
commit ccbc329cbf
136 changed files with 4713 additions and 5561 deletions

View File

@ -3,7 +3,6 @@ const SyncTargetRegistry = require('../../SyncTargetRegistry');
const ObjectUtils = require('../../ObjectUtils');
const { _ } = require('../../locale');
const { createSelector } = require('reselect');
const { reg } = require('../../registry');
const shared = {};
@ -32,7 +31,7 @@ shared.checkSyncConfig = async function(comp, settings) {
comp.setState({ checkSyncConfigResult: result });
if (result.ok) {
await shared.checkNextcloudApp(comp, settings);
// await shared.checkNextcloudApp(comp, settings);
// Users often expect config to be auto-saved at this point, if the config check was successful
shared.saveSettings(comp);
}
@ -54,30 +53,6 @@ shared.checkSyncConfigMessages = function(comp) {
return output;
};
shared.checkNextcloudApp = async function(comp, settings) {
if (settings['sync.target'] !== 5) return;
comp.setState({ checkNextcloudAppResult: 'checking' });
let result = null;
const appApi = await reg.syncTargetNextcloud().appApi(settings);
try {
result = await appApi.setupSyncTarget(settings['sync.5.path']);
} catch (error) {
reg.logger().error('Could not setup sync target:', error);
result = { error: error.message };
}
const newSyncTargets = Object.assign({}, settings['sync.5.syncTargets']);
newSyncTargets[settings['sync.5.path']] = result;
shared.updateSettingValue(comp, 'sync.5.syncTargets', newSyncTargets);
// Also immediately save the result as this is most likely what the user would expect
Setting.setValue('sync.5.syncTargets', newSyncTargets);
comp.setState({ checkNextcloudAppResult: 'done' });
};
shared.updateSettingValue = function(comp, key, value) {
comp.setState(state => {
const settings = Object.assign({}, state.settings);