mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
All: renamed sync targets
This commit is contained in:
parent
112609c5f1
commit
03251d4c40
@ -17,8 +17,8 @@ const { FileApiDriverLocal } = require('lib/file-api-driver-local.js');
|
|||||||
const { FsDriverNode } = require('lib/fs-driver-node.js');
|
const { FsDriverNode } = require('lib/fs-driver-node.js');
|
||||||
const { time } = require('lib/time-utils.js');
|
const { time } = require('lib/time-utils.js');
|
||||||
const SyncTargetRegistry = require('lib/SyncTargetRegistry.js');
|
const SyncTargetRegistry = require('lib/SyncTargetRegistry.js');
|
||||||
const SyncTarget1 = require('lib/SyncTarget1.js');
|
const SyncTargetMemory = require('lib/SyncTargetMemory.js');
|
||||||
const SyncTarget2 = require('lib/SyncTarget2.js');
|
const SyncTargetFilesystem = require('lib/SyncTargetFilesystem.js');
|
||||||
|
|
||||||
let databases_ = [];
|
let databases_ = [];
|
||||||
let synchronizers_ = [];
|
let synchronizers_ = [];
|
||||||
@ -50,8 +50,8 @@ BaseItem.loadClass('NoteTag', NoteTag);
|
|||||||
Setting.setConstant('appId', 'net.cozic.joplin-cli');
|
Setting.setConstant('appId', 'net.cozic.joplin-cli');
|
||||||
Setting.setConstant('appType', 'cli');
|
Setting.setConstant('appType', 'cli');
|
||||||
|
|
||||||
SyncTargetRegistry.addClass(SyncTarget1);
|
SyncTargetRegistry.addClass(SyncTargetMemory);
|
||||||
SyncTargetRegistry.addClass(SyncTarget2);
|
SyncTargetRegistry.addClass(SyncTargetFilesystem);
|
||||||
|
|
||||||
function syncTargetId() {
|
function syncTargetId() {
|
||||||
return syncTargetId_;
|
return syncTargetId_;
|
||||||
|
@ -22,8 +22,8 @@ const os = require('os');
|
|||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
const EventEmitter = require('events');
|
const EventEmitter = require('events');
|
||||||
const SyncTargetRegistry = require('lib/SyncTargetRegistry.js');
|
const SyncTargetRegistry = require('lib/SyncTargetRegistry.js');
|
||||||
const SyncTarget2 = require('lib/SyncTarget2.js');
|
const SyncTargetFilesystem = require('lib/SyncTargetFilesystem.js');
|
||||||
const SyncTarget3 = require('lib/SyncTarget3.js');
|
const SyncTargetOneDrive = require('lib/SyncTargetOneDrive.js');
|
||||||
|
|
||||||
class BaseApplication {
|
class BaseApplication {
|
||||||
|
|
||||||
@ -325,8 +325,8 @@ class BaseApplication {
|
|||||||
Setting.setConstant('resourceDir', resourceDir);
|
Setting.setConstant('resourceDir', resourceDir);
|
||||||
Setting.setConstant('tempDir', tempDir);
|
Setting.setConstant('tempDir', tempDir);
|
||||||
|
|
||||||
SyncTargetRegistry.addClass(SyncTarget2);
|
SyncTargetRegistry.addClass(SyncTargetFilesystem);
|
||||||
SyncTargetRegistry.addClass(SyncTarget3);
|
SyncTargetRegistry.addClass(SyncTargetOneDrive);
|
||||||
|
|
||||||
await fs.mkdirp(profileDir, 0o755);
|
await fs.mkdirp(profileDir, 0o755);
|
||||||
await fs.mkdirp(resourceDir, 0o755);
|
await fs.mkdirp(resourceDir, 0o755);
|
||||||
|
@ -5,7 +5,7 @@ const { FileApi } = require('lib/file-api.js');
|
|||||||
const { FileApiDriverLocal } = require('lib/file-api-driver-local.js');
|
const { FileApiDriverLocal } = require('lib/file-api-driver-local.js');
|
||||||
const { Synchronizer } = require('lib/synchronizer.js');
|
const { Synchronizer } = require('lib/synchronizer.js');
|
||||||
|
|
||||||
class SyncTarget2 extends BaseSyncTarget {
|
class SyncTargetFilesystem extends BaseSyncTarget {
|
||||||
|
|
||||||
static id() {
|
static id() {
|
||||||
return 2;
|
return 2;
|
||||||
@ -22,7 +22,7 @@ class SyncTarget2 extends BaseSyncTarget {
|
|||||||
async initFileApi() {
|
async initFileApi() {
|
||||||
const fileApi = new FileApi(Setting.value('sync.2.path'), new FileApiDriverLocal());
|
const fileApi = new FileApi(Setting.value('sync.2.path'), new FileApiDriverLocal());
|
||||||
fileApi.setLogger(this.logger());
|
fileApi.setLogger(this.logger());
|
||||||
fileApi.setSyncTargetId(SyncTarget2.id());
|
fileApi.setSyncTargetId(SyncTargetFilesystem.id());
|
||||||
return fileApi;
|
return fileApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,4 +32,4 @@ class SyncTarget2 extends BaseSyncTarget {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = SyncTarget2;
|
module.exports = SyncTargetFilesystem;
|
@ -5,7 +5,7 @@ const { FileApi } = require('lib/file-api.js');
|
|||||||
const { FileApiDriverMemory } = require('lib/file-api-driver-memory.js');
|
const { FileApiDriverMemory } = require('lib/file-api-driver-memory.js');
|
||||||
const { Synchronizer } = require('lib/synchronizer.js');
|
const { Synchronizer } = require('lib/synchronizer.js');
|
||||||
|
|
||||||
class SyncTarget1 extends BaseSyncTarget {
|
class SyncTargetMemory extends BaseSyncTarget {
|
||||||
|
|
||||||
static id() {
|
static id() {
|
||||||
return 1;
|
return 1;
|
||||||
@ -22,7 +22,7 @@ class SyncTarget1 extends BaseSyncTarget {
|
|||||||
initFileApi() {
|
initFileApi() {
|
||||||
const fileApi = new FileApi('/root', new FileApiDriverMemory());
|
const fileApi = new FileApi('/root', new FileApiDriverMemory());
|
||||||
fileApi.setLogger(this.logger());
|
fileApi.setLogger(this.logger());
|
||||||
fileApi.setSyncTargetId(SyncTarget1.id());
|
fileApi.setSyncTargetId(SyncTargetMemory.id());
|
||||||
return fileApi;
|
return fileApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,4 +32,4 @@ class SyncTarget1 extends BaseSyncTarget {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = SyncTarget1;
|
module.exports = SyncTargetMemory;
|
@ -7,7 +7,7 @@ const { FileApi } = require('lib/file-api.js');
|
|||||||
const { Synchronizer } = require('lib/synchronizer.js');
|
const { Synchronizer } = require('lib/synchronizer.js');
|
||||||
const { FileApiDriverOneDrive } = require('lib/file-api-driver-onedrive.js');
|
const { FileApiDriverOneDrive } = require('lib/file-api-driver-onedrive.js');
|
||||||
|
|
||||||
class SyncTarget3 extends BaseSyncTarget {
|
class SyncTargetOneDrive extends BaseSyncTarget {
|
||||||
|
|
||||||
constructor(db, options = null) {
|
constructor(db, options = null) {
|
||||||
super(db, options);
|
super(db, options);
|
||||||
@ -70,6 +70,6 @@ class SyncTarget3 extends BaseSyncTarget {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const staticSelf = SyncTarget3;
|
const staticSelf = SyncTargetOneDrive;
|
||||||
|
|
||||||
module.exports = SyncTarget3;
|
module.exports = SyncTargetOneDrive;
|
@ -38,7 +38,7 @@ const RNFetchBlob = require('react-native-fetch-blob').default;
|
|||||||
const { PoorManIntervals } = require('lib/poor-man-intervals.js');
|
const { PoorManIntervals } = require('lib/poor-man-intervals.js');
|
||||||
const { reducer, defaultState } = require('lib/reducer.js');
|
const { reducer, defaultState } = require('lib/reducer.js');
|
||||||
const SyncTargetRegistry = require('lib/SyncTargetRegistry.js');
|
const SyncTargetRegistry = require('lib/SyncTargetRegistry.js');
|
||||||
const SyncTarget3 = require('lib/SyncTarget3.js');
|
const SyncTargetOneDrive = require('lib/SyncTargetOneDrive.js');
|
||||||
|
|
||||||
const generalMiddleware = store => next => async (action) => {
|
const generalMiddleware = store => next => async (action) => {
|
||||||
if (action.type !== 'SIDE_MENU_OPEN_PERCENT') reg.logger().info('Reducer action', action.type);
|
if (action.type !== 'SIDE_MENU_OPEN_PERCENT') reg.logger().info('Reducer action', action.type);
|
||||||
@ -257,7 +257,7 @@ async function initialize(dispatch, backButtonHandler) {
|
|||||||
|
|
||||||
reg.setLogger(mainLogger);
|
reg.setLogger(mainLogger);
|
||||||
|
|
||||||
SyncTargetRegistry.addClass(SyncTarget3);
|
SyncTargetRegistry.addClass(SyncTargetOneDrive);
|
||||||
|
|
||||||
reg.logger().info('====================================');
|
reg.logger().info('====================================');
|
||||||
reg.logger().info('Starting application ' + Setting.value('appId') + ' (' + Setting.value('env') + ')');
|
reg.logger().info('Starting application ' + Setting.value('appId') + ' (' + Setting.value('env') + ')');
|
||||||
|
Loading…
Reference in New Issue
Block a user