Fix backup validation
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
parent
822af04eda
commit
08d5da18dc
1 changed files with 18 additions and 9 deletions
|
@ -75,6 +75,7 @@ type GetRecipientIdOptionsType =
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export class BackupExportStream extends Readable {
|
export class BackupExportStream extends Readable {
|
||||||
|
private readonly backupTimeMs = getSafeLongFromTimestamp(Date.now());
|
||||||
private readonly convoIdToRecipientId = new Map<string, number>();
|
private readonly convoIdToRecipientId = new Map<string, number>();
|
||||||
private buffers = new Array<Uint8Array>();
|
private buffers = new Array<Uint8Array>();
|
||||||
private nextRecipientId = 0;
|
private nextRecipientId = 0;
|
||||||
|
@ -102,7 +103,7 @@ export class BackupExportStream extends Readable {
|
||||||
this.push(
|
this.push(
|
||||||
Backups.BackupInfo.encodeDelimited({
|
Backups.BackupInfo.encodeDelimited({
|
||||||
version: Long.fromNumber(BACKUP_VERSION),
|
version: Long.fromNumber(BACKUP_VERSION),
|
||||||
backupTimeMs: getSafeLongFromTimestamp(Date.now()),
|
backupTimeMs: this.backupTimeMs,
|
||||||
}).finish()
|
}).finish()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -547,18 +548,26 @@ export class BackupExportStream extends Readable {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let expireStartDate: Long | undefined;
|
||||||
|
let expiresInMs: Long | undefined;
|
||||||
|
if (
|
||||||
|
message.expireTimer != null &&
|
||||||
|
message.expirationStartTimestamp != null
|
||||||
|
) {
|
||||||
|
expireStartDate = getSafeLongFromTimestamp(
|
||||||
|
message.expirationStartTimestamp
|
||||||
|
);
|
||||||
|
expiresInMs = Long.fromNumber(
|
||||||
|
DurationInSeconds.toMillis(message.expireTimer)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const result: Backups.IChatItem = {
|
const result: Backups.IChatItem = {
|
||||||
chatId,
|
chatId,
|
||||||
authorId,
|
authorId,
|
||||||
dateSent: getSafeLongFromTimestamp(message.sent_at),
|
dateSent: getSafeLongFromTimestamp(message.sent_at),
|
||||||
expireStartDate:
|
expireStartDate,
|
||||||
message.expirationStartTimestamp != null
|
expiresInMs,
|
||||||
? getSafeLongFromTimestamp(message.expirationStartTimestamp)
|
|
||||||
: null,
|
|
||||||
expiresInMs:
|
|
||||||
message.expireTimer != null
|
|
||||||
? Long.fromNumber(DurationInSeconds.toMillis(message.expireTimer))
|
|
||||||
: null,
|
|
||||||
revisions: [],
|
revisions: [],
|
||||||
sms: false,
|
sms: false,
|
||||||
standardMessage: {
|
standardMessage: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue