1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-15 09:04:04 +02:00
joplin/packages/lib/SyncTargetFilesystem.js

45 lines
1.0 KiB
JavaScript
Raw Normal View History

const BaseSyncTarget = require('./BaseSyncTarget').default;
2020-11-05 18:58:23 +02:00
const { _ } = require('./locale');
const Setting = require('./models/Setting').default;
const { FileApi } = require('./file-api.js');
const { FileApiDriverLocal } = require('./file-api-driver-local');
2020-11-05 18:58:23 +02:00
const Synchronizer = require('./Synchronizer').default;
2017-11-24 21:09:15 +02:00
class SyncTargetFilesystem extends BaseSyncTarget {
static id() {
return 2;
}
static targetName() {
return 'filesystem';
}
static label() {
return _('File system');
}
static unsupportedPlatforms() {
return ['ios'];
}
2018-03-26 19:33:55 +02:00
async isAuthenticated() {
return true;
}
async initFileApi() {
const syncPath = Setting.value('sync.2.path');
const driver = new FileApiDriverLocal();
const fileApi = new FileApi(syncPath, driver);
fileApi.setLogger(this.logger());
2017-11-24 21:09:15 +02:00
fileApi.setSyncTargetId(SyncTargetFilesystem.id());
await driver.mkdir(syncPath);
return fileApi;
}
async initSynchronizer() {
return new Synchronizer(this.db(), await this.fileApi(), Setting.value('appType'));
}
}
2019-07-29 15:43:53 +02:00
module.exports = SyncTargetFilesystem;