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

Desktop, Mobile, Cli: Allow setting a minimum app version on the sync target (#9778)

This commit is contained in:
Laurent Cozic
2024-01-26 10:32:35 +00:00
committed by GitHub
parent 2cc4ac087b
commit 7b06090255
12 changed files with 166 additions and 10 deletions

View File

@@ -22,7 +22,7 @@ import TaskQueue from './TaskQueue';
import ItemUploader from './services/synchronizer/ItemUploader';
import { FileApi, getSupportsDeltaWithItems, PaginatedList, RemoteItem } from './file-api';
import JoplinDatabase from './JoplinDatabase';
import { fetchSyncInfo, getActiveMasterKey, localSyncInfo, mergeSyncInfos, saveLocalSyncInfo, setMasterKeyHasBeenUsed, SyncInfo, syncInfoEquals, uploadSyncInfo } from './services/synchronizer/syncInfoUtils';
import { checkIfCanSync, fetchSyncInfo, getActiveMasterKey, localSyncInfo, mergeSyncInfos, saveLocalSyncInfo, setMasterKeyHasBeenUsed, SyncInfo, syncInfoEquals, uploadSyncInfo } from './services/synchronizer/syncInfoUtils';
import { getMasterPassword, setupAndDisableEncryption, setupAndEnableEncryption } from './services/e2ee/utils';
import { generateKeyPair } from './services/e2ee/ppk';
import syncDebugLog from './services/synchronizer/syncDebugLog';
@@ -115,7 +115,9 @@ export default class Synchronizer {
}
public setLogger(l: Logger) {
const previous = this.logger_;
this.logger_ = l;
return previous;
}
public logger() {
@@ -465,6 +467,9 @@ export default class Synchronizer {
await this.migrationHandler().checkCanSync(remoteInfo);
const appVersion = shim.appVersion();
if (appVersion !== 'unknown') checkIfCanSync(remoteInfo, appVersion);
let localInfo = await localSyncInfo();
logger.info('Sync target local info:', localInfo);
@@ -1055,6 +1060,13 @@ export default class Synchronizer {
}
} // DELTA STEP
} catch (error) {
if (error.code === ErrorCode.MustUpgradeApp) {
this.dispatch({
type: 'MUST_UPGRADE_APP',
message: error.message,
});
}
if (throwOnError) {
errorToThrow = error;
} else if (error && ['cannotEncryptEncrypted', 'noActiveMasterKey', 'processingPathTwice', 'failSafe', 'lockError', 'outdatedSyncTarget'].indexOf(error.code) >= 0) {