mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-27 10:32:58 +02:00
71efff6827
* Update eslint config * Applied linter to lib * Applied eslint config to CliClient/app * Removed prettier due to https://github.com/prettier/prettier/pull/4765 * First pass on test units * Applied linter config to test units * Applied eslint config to clipper * Applied to plugin dir * Applied to root of ElectronClient * Applied on RN root * Applied on CLI root * Applied on Clipper root * Applied config to tools * test hook * test hook * test hook * Added pre-commit hook * Applied rule no-trailing-spaces * Make sure root packages are installed when installing sub-dir * Added doc
53 lines
1.2 KiB
JavaScript
53 lines
1.2 KiB
JavaScript
// The Nextcloud sync target is essentially a wrapper over the WebDAV sync target,
|
|
// thus all the calls to SyncTargetWebDAV to avoid duplicate code.
|
|
|
|
const BaseSyncTarget = require('lib/BaseSyncTarget.js');
|
|
const { _ } = require('lib/locale.js');
|
|
const Setting = require('lib/models/Setting.js');
|
|
const { Synchronizer } = require('lib/synchronizer.js');
|
|
const SyncTargetWebDAV = require('lib/SyncTargetWebDAV');
|
|
|
|
class SyncTargetNextcloud extends BaseSyncTarget {
|
|
static id() {
|
|
return 5;
|
|
}
|
|
|
|
static supportsConfigCheck() {
|
|
return true;
|
|
}
|
|
|
|
static targetName() {
|
|
return 'nextcloud';
|
|
}
|
|
|
|
static label() {
|
|
return _('Nextcloud');
|
|
}
|
|
|
|
async isAuthenticated() {
|
|
return true;
|
|
}
|
|
|
|
static async checkConfig(options) {
|
|
return SyncTargetWebDAV.checkConfig(options);
|
|
}
|
|
|
|
async initFileApi() {
|
|
const fileApi = await SyncTargetWebDAV.newFileApi_(SyncTargetNextcloud.id(), {
|
|
path: () => Setting.value('sync.5.path'),
|
|
username: () => Setting.value('sync.5.username'),
|
|
password: () => Setting.value('sync.5.password'),
|
|
});
|
|
|
|
fileApi.setLogger(this.logger());
|
|
|
|
return fileApi;
|
|
}
|
|
|
|
async initSynchronizer() {
|
|
return new Synchronizer(this.db(), await this.fileApi(), Setting.value('appType'));
|
|
}
|
|
}
|
|
|
|
module.exports = SyncTargetNextcloud;
|