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 {
|
||||
private readonly backupTimeMs = getSafeLongFromTimestamp(Date.now());
|
||||
private readonly convoIdToRecipientId = new Map<string, number>();
|
||||
private buffers = new Array<Uint8Array>();
|
||||
private nextRecipientId = 0;
|
||||
|
@ -102,7 +103,7 @@ export class BackupExportStream extends Readable {
|
|||
this.push(
|
||||
Backups.BackupInfo.encodeDelimited({
|
||||
version: Long.fromNumber(BACKUP_VERSION),
|
||||
backupTimeMs: getSafeLongFromTimestamp(Date.now()),
|
||||
backupTimeMs: this.backupTimeMs,
|
||||
}).finish()
|
||||
);
|
||||
|
||||
|
@ -547,18 +548,26 @@ export class BackupExportStream extends Readable {
|
|||
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 = {
|
||||
chatId,
|
||||
authorId,
|
||||
dateSent: getSafeLongFromTimestamp(message.sent_at),
|
||||
expireStartDate:
|
||||
message.expirationStartTimestamp != null
|
||||
? getSafeLongFromTimestamp(message.expirationStartTimestamp)
|
||||
: null,
|
||||
expiresInMs:
|
||||
message.expireTimer != null
|
||||
? Long.fromNumber(DurationInSeconds.toMillis(message.expireTimer))
|
||||
: null,
|
||||
expireStartDate,
|
||||
expiresInMs,
|
||||
revisions: [],
|
||||
sms: false,
|
||||
standardMessage: {
|
||||
|
|
Loading…
Add table
Reference in a new issue