Update backup locator proto.

This commit is contained in:
Clark
2024-04-16 15:01:32 -04:00
committed by Greyson Parrelli
parent d8bbfe2678
commit 5f31f5966c
3 changed files with 19 additions and 9 deletions

View File

@@ -25,8 +25,10 @@ class ArchivedAttachment : Attachment {
constructor(
contentType: String?,
size: Long,
cdn: Cdn,
cdnKey: ByteArray,
cdn: Int,
key: ByteArray,
cdnKey: String?,
archiveCdn: Int?,
archiveMediaName: String,
archiveMediaId: String,
digest: ByteArray,
@@ -46,9 +48,9 @@ class ArchivedAttachment : Attachment {
transferState = AttachmentTable.TRANSFER_NEEDS_RESTORE,
size = size,
fileName = null,
cdn = cdn,
remoteLocation = null,
remoteKey = Base64.encodeWithoutPadding(cdnKey),
cdn = Cdn.fromCdnNumber(cdn),
remoteLocation = cdnKey,
remoteKey = Base64.encodeWithoutPadding(key),
remoteDigest = digest,
incrementalDigest = incrementalMac,
fastPreflightId = null,
@@ -65,7 +67,7 @@ class ArchivedAttachment : Attachment {
audioHash = null,
transformProperties = null
) {
this.archiveCdn = cdn.cdnNumber
this.archiveCdn = archiveCdn ?: Cdn.CDN_3.cdnNumber
this.archiveMediaName = archiveMediaName
this.archiveMediaId = archiveMediaId
}

View File

@@ -618,8 +618,10 @@ class ChatItemImportInserter(
return ArchivedAttachment(
contentType = contentType,
size = pointer.backupLocator.size.toLong(),
cdn = Cdn.fromCdnNumber(pointer.backupLocator.cdnNumber),
cdnKey = pointer.backupLocator.key.toByteArray(),
cdn = pointer.backupLocator.transitCdnNumber ?: Cdn.CDN_0.cdnNumber,
key = pointer.backupLocator.key.toByteArray(),
cdnKey = pointer.backupLocator.transitCdnKey,
archiveCdn = pointer.backupLocator.cdnNumber,
archiveMediaName = pointer.backupLocator.mediaName,
archiveMediaId = backupState.backupKey.deriveMediaId(MediaName(pointer.backupLocator.mediaName)).encode(),
digest = pointer.backupLocator.digest.toByteArray(),