一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
62 行
1.6 KiB
TypeScript
62 行
1.6 KiB
TypeScript
// The Nextcloud sync target is essentially a wrapper over the WebDAV sync target,
|
|
// thus all the calls to SyncTargetWebDAV to avoid duplicate code.
|
|
|
|
import BaseSyncTarget, { CheckConfigResult } from './BaseSyncTarget';
|
|
import { _ } from './locale';
|
|
import Setting from './models/Setting';
|
|
import Synchronizer from './Synchronizer';
|
|
import SyncTargetWebDAV, { WebDavFileApiOptions } from './SyncTargetWebDAV';
|
|
|
|
export default class SyncTargetNextcloud extends BaseSyncTarget {
|
|
|
|
public static id() {
|
|
return 5;
|
|
}
|
|
|
|
public static supportsConfigCheck() {
|
|
return true;
|
|
}
|
|
|
|
public static targetName() {
|
|
return 'nextcloud';
|
|
}
|
|
|
|
public static label() {
|
|
return _('Nextcloud');
|
|
}
|
|
|
|
public static description() {
|
|
return 'A suite of client-server software for creating and using file hosting services.';
|
|
}
|
|
|
|
public async isAuthenticated() {
|
|
return true;
|
|
}
|
|
|
|
public static requiresPassword() {
|
|
return true;
|
|
}
|
|
|
|
public static override async checkConfig(options: WebDavFileApiOptions): Promise<CheckConfigResult> {
|
|
return SyncTargetWebDAV.checkConfig(options);
|
|
}
|
|
|
|
public 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'),
|
|
ignoreTlsErrors: () => Setting.value('net.ignoreTlsErrors'),
|
|
});
|
|
|
|
fileApi.setLogger(this.logger());
|
|
|
|
return fileApi;
|
|
}
|
|
|
|
public async initSynchronizer() {
|
|
return new Synchronizer(this.db(), await this.fileApi(), Setting.value('appType'));
|
|
}
|
|
|
|
}
|