Compare commits

..

No commits in common. "a03d17a9e4d9c420ba0e23f2d9c69d26315e0ec8" and "d0ee90dbbcf04d91b1683646eb13b0e7c4794642" have entirely different histories.

7 changed files with 22 additions and 61 deletions

View File

@ -1,7 +1,5 @@
# Changelog # Changelog
## [Unreleased]
## [0.14.2] - 2026-04-04 ## [0.14.2] - 2026-04-04
### Added ### Added

View File

@ -8,7 +8,7 @@ plugins {
allprojects { allprojects {
group = "org.asamk" group = "org.asamk"
version = "0.14.3-SNAPSHOT" version = "0.14.2"
} }
java { java {

View File

@ -11,14 +11,11 @@ import org.signal.libsignal.protocol.InvalidMessageException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.whispersystems.signalservice.api.crypto.AttachmentCipherInputStream; import org.whispersystems.signalservice.api.crypto.AttachmentCipherInputStream;
import org.whispersystems.signalservice.api.crypto.AttachmentCipherStreamUtil;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment; import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer; import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentStream; import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentStream;
import org.whispersystems.signalservice.api.push.exceptions.MissingConfigurationException; import org.whispersystems.signalservice.api.push.exceptions.MissingConfigurationException;
import org.whispersystems.signalservice.api.util.StreamDetails; import org.whispersystems.signalservice.api.util.StreamDetails;
import org.whispersystems.signalservice.internal.crypto.PaddingInputStream;
import org.whispersystems.signalservice.internal.push.http.ResumableUploadSpec;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -92,12 +89,12 @@ public class AttachmentHelper {
final boolean voiceNote final boolean voiceNote
) throws AttachmentInvalidException { ) throws AttachmentInvalidException {
try { try {
final var streamDetailsAndFileName = Utils.createStreamDetails(attachment); final var streamDetails = Utils.createStreamDetails(attachment);
final var streamDetails = streamDetailsAndFileName.first(); final var uploadSpec = dependencies.getMessageSender()
final var uploadSpec = getResumableUploadSpec(streamDetails); .getResumableUploadSpec(streamDetails.first().getLength());
return AttachmentUtils.createAttachmentStream(streamDetails, return AttachmentUtils.createAttachmentStream(streamDetails.first(),
streamDetailsAndFileName.second(), streamDetails.second(),
voiceNote, voiceNote,
uploadSpec); uploadSpec);
} catch (IOException e) { } catch (IOException e) {
@ -105,13 +102,6 @@ public class AttachmentHelper {
} }
} }
public ResumableUploadSpec getResumableUploadSpec(final StreamDetails streamDetails) throws IOException {
final var streamLength = streamDetails.getLength();
final var ciphertextLength = AttachmentCipherStreamUtil.getCiphertextLength(PaddingInputStream.getPaddedSize(
streamLength));
return dependencies.getMessageSender().getResumableUploadSpec(ciphertextLength);
}
public SignalServiceAttachmentPointer uploadAttachment(String attachment) throws IOException, AttachmentInvalidException { public SignalServiceAttachmentPointer uploadAttachment(String attachment) throws IOException, AttachmentInvalidException {
final var attachmentStream = getAttachmentStream(attachment, false); final var attachmentStream = getAttachmentStream(attachment, false);
return uploadAttachment(attachmentStream); return uploadAttachment(attachmentStream);

View File

@ -123,7 +123,7 @@ public class GroupHelper {
return Optional.empty(); return Optional.empty();
} }
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails); final var uploadSpec = dependencies.getMessageSender().getResumableUploadSpec(streamDetails.getLength());
return Optional.of(AttachmentUtils.createAttachmentStream(streamDetails, Optional.empty(), uploadSpec)); return Optional.of(AttachmentUtils.createAttachmentStream(streamDetails, Optional.empty(), uploadSpec));
} }

View File

@ -38,7 +38,6 @@ import org.whispersystems.signalservice.api.messages.multidevice.StickerPackOper
import org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage; import org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage;
import org.whispersystems.signalservice.api.messages.multidevice.ViewedMessage; import org.whispersystems.signalservice.api.messages.multidevice.ViewedMessage;
import org.whispersystems.signalservice.api.push.SignalServiceAddress; import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.util.StreamDetails;
import org.whispersystems.signalservice.internal.push.SyncMessage; import org.whispersystems.signalservice.internal.push.SyncMessage;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -132,14 +131,13 @@ public class SyncHelper {
if (groupsFile.exists() && groupsFile.length() > 0) { if (groupsFile.exists() && groupsFile.length() > 0) {
try (var groupsFileStream = new FileInputStream(groupsFile)) { try (var groupsFileStream = new FileInputStream(groupsFile)) {
final var streamDetails = new StreamDetails(groupsFileStream, final var uploadSpec = context.getDependencies()
MimeUtils.OCTET_STREAM, .getMessageSender()
groupsFile.length()); .getResumableUploadSpec(groupsFile.length());
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails);
var attachmentStream = SignalServiceAttachment.newStreamBuilder() var attachmentStream = SignalServiceAttachment.newStreamBuilder()
.withStream(streamDetails.getStream()) .withStream(groupsFileStream)
.withContentType(streamDetails.getContentType()) .withContentType(MimeUtils.OCTET_STREAM)
.withLength(streamDetails.getLength()) .withLength(groupsFile.length())
.withResumableUploadSpec(uploadSpec) .withResumableUploadSpec(uploadSpec)
.build(); .build();
@ -194,14 +192,13 @@ public class SyncHelper {
if (contactsFile.exists() && contactsFile.length() > 0) { if (contactsFile.exists() && contactsFile.length() > 0) {
try (var contactsFileStream = new FileInputStream(contactsFile)) { try (var contactsFileStream = new FileInputStream(contactsFile)) {
final var streamDetails = new StreamDetails(contactsFileStream, final var uploadSpec = context.getDependencies()
MimeUtils.OCTET_STREAM, .getMessageSender()
contactsFile.length()); .getResumableUploadSpec(contactsFile.length());
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails);
var attachmentStream = SignalServiceAttachment.newStreamBuilder() var attachmentStream = SignalServiceAttachment.newStreamBuilder()
.withStream(streamDetails.getStream()) .withStream(contactsFileStream)
.withContentType(streamDetails.getContentType()) .withContentType(MimeUtils.OCTET_STREAM)
.withLength(streamDetails.getLength()) .withLength(contactsFile.length())
.withResumableUploadSpec(uploadSpec) .withResumableUploadSpec(uploadSpec)
.build(); .build();

View File

@ -839,7 +839,8 @@ public class ManagerImpl implements Manager {
final var streamDetails = new StreamDetails(new ByteArrayInputStream(messageBytes), final var streamDetails = new StreamDetails(new ByteArrayInputStream(messageBytes),
MimeUtils.LONG_TEXT, MimeUtils.LONG_TEXT,
messageBytes.length); messageBytes.length);
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails); final var uploadSpec = dependencies.getMessageSender()
.getResumableUploadSpec(streamDetails.getLength());
final var textAttachment = AttachmentUtils.createAttachmentStream(streamDetails, final var textAttachment = AttachmentUtils.createAttachmentStream(streamDetails,
Optional.empty(), Optional.empty(),
uploadSpec); uploadSpec);
@ -907,7 +908,7 @@ public class ManagerImpl implements Manager {
if (streamDetails == null) { if (streamDetails == null) {
throw new InvalidStickerException("Missing local sticker file"); throw new InvalidStickerException("Missing local sticker file");
} }
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails); final var uploadSpec = dependencies.getMessageSender().getResumableUploadSpec(streamDetails.getLength());
final var stickerAttachment = AttachmentUtils.createAttachmentStream(streamDetails, final var stickerAttachment = AttachmentUtils.createAttachmentStream(streamDetails,
Optional.empty(), Optional.empty(),
uploadSpec); uploadSpec);

View File

@ -1486,13 +1486,6 @@
"type": "kotlin.Pair", "type": "kotlin.Pair",
"jniAccessible": true, "jniAccessible": true,
"methods": [ "methods": [
{
"name": "<init>",
"parameterTypes": [
"java.lang.Object",
"java.lang.Object"
]
},
{ {
"name": "getFirst", "name": "getFirst",
"parameterTypes": [] "parameterTypes": []
@ -1503,9 +1496,6 @@
} }
] ]
}, },
{
"type": "kotlin.Pair[]"
},
{ {
"type": "kotlin.SafePublicationLazyImpl", "type": "kotlin.SafePublicationLazyImpl",
"fields": [ "fields": [
@ -5831,21 +5821,6 @@
} }
] ]
}, },
{
"type": "org.signal.libsignal.net.UploadForm",
"jniAccessible": true,
"methods": [
{
"name": "fromNative",
"parameterTypes": [
"int",
"java.lang.String",
"java.lang.Object[]",
"java.lang.String"
]
}
]
},
{ {
"type": "org.signal.libsignal.net.internal.BridgeChatListener", "type": "org.signal.libsignal.net.internal.BridgeChatListener",
"jniAccessible": true "jniAccessible": true