1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Minor CLI bug fixes and improvements

This commit is contained in:
Laurent Cozic
2017-07-26 22:07:27 +01:00
parent 76a9264239
commit 89f1d5e6e7
10 changed files with 113 additions and 38 deletions

View File

@ -97,7 +97,7 @@ reg.synchronizer = async (syncTargetId) => {
return sync;
}
reg.syncHasAuth = async (syncTargetId) => {
reg.syncHasAuth = (syncTargetId) => {
if (syncTargetId == Setting.SYNC_TARGET_ONEDRIVE && !reg.oneDriveApi().auth()) {
return false;
}
@ -121,7 +121,7 @@ reg.scheduleSync = async (delay = null) => {
const syncTargetId = Setting.value('sync.target');
if (!reg.syncHasAuth()) {
if (!reg.syncHasAuth(syncTargetId)) {
reg.logger().info('Synchronizer is missing credentials - manual sync required to authenticate.');
return;
}
@ -135,7 +135,7 @@ reg.scheduleSync = async (delay = null) => {
Setting.setValue('sync.context', JSON.stringify(newContext));
} catch (error) {
if (error.code == 'alreadyStarted') {
reg.logger.info(error.message);
reg.logger().info(error.message);
} else {
throw error;
}
@ -152,8 +152,9 @@ reg.scheduleSync = async (delay = null) => {
}
reg.syncStarted = async () => {
if (!reg.syncHasAuth()) return false;
const sync = await reg.synchronizer(Setting.value('sync.target'));
const syncTarget = Setting.value('sync.target');
if (!reg.syncHasAuth(syncTarget)) return false;
const sync = await reg.synchronizer(syncTarget);
return sync.state() != 'idle';
}