文件
mynode/packages/lib/SyncTargetFilesystem.ts
chen 301194963b
一些检查失败了
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
feat: Initial clean release of CHM
2026-11-04 11:29:39 +08:00

55 行
1.2 KiB
TypeScript

import BaseSyncTarget from './BaseSyncTarget';
import { _ } from './locale';
import Setting from './models/Setting';
import { FileApi } from './file-api';
import FileApiDriverLocal from './file-api-driver-local';
import Synchronizer from './Synchronizer';
export default class SyncTargetFilesystem extends BaseSyncTarget {
public static id() {
return 2;
}
public static targetName() {
return 'filesystem';
}
public static label() {
return _('File system');
}
public static unsupportedPlatforms() {
return ['ios'];
}
public async isAuthenticated() {
return true;
}
private syncPath_() {
return Setting.value('sync.2.path');
}
public async initFileApi() {
const driver = new FileApiDriverLocal();
const fileApi = new FileApi(() => {
// The sync path can be set by the user after startup, so needs to be
// determined dynamically.
return this.syncPath_();
}, driver);
fileApi.setLogger(this.logger());
fileApi.setSyncTargetId(SyncTargetFilesystem.id());
const syncPath = this.syncPath_();
await driver.mkdir(syncPath);
return fileApi;
}
public async initSynchronizer() {
const api = await this.fileApi();
return new Synchronizer(this.db(), api, Setting.value('appType'));
}
}