Populate sourceDevice field of ManifestRecord

This commit is contained in:
Fedor Indutny 2022-05-25 12:20:45 -07:00 committed by GitHub
parent 68f705e6ad
commit fcc60202c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -45,8 +45,10 @@ message ManifestRecord {
optional Type type = 2;
}
optional uint64 version = 1;
repeated Identifier keys = 2;
optional uint64 version = 1;
optional uint32 sourceDevice = 3;
repeated Identifier keys = 2;
// Next ID: 4
}
message StorageRecord {

View file

@ -498,6 +498,7 @@ async function generateManifest(
const manifestRecord = new Proto.ManifestRecord();
manifestRecord.version = Long.fromNumber(version);
manifestRecord.sourceDevice = window.storage.user.getDeviceId() ?? 0;
manifestRecord.keys = Array.from(manifestRecordKeys);
const storageKeyBase64 = window.storage.get('storageKey');
@ -1335,7 +1336,8 @@ async function sync(
const version = manifest.version?.toNumber() ?? 0;
log.info(
`storageService.sync: updating to remoteVersion=${version} from ` +
`storageService.sync: updating to remoteVersion=${version} ` +
`sourceDevice=${manifest.sourceDevice ?? '?'} from ` +
`version=${localManifestVersion}`
);