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
## [Unreleased]
## [0.14.2] - 2026-04-04
### Added

View File

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

View File

@ -11,14 +11,11 @@ import org.signal.libsignal.protocol.InvalidMessageException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.SignalServiceAttachmentPointer;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentStream;
import org.whispersystems.signalservice.api.push.exceptions.MissingConfigurationException;
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.IOException;
@ -92,12 +89,12 @@ public class AttachmentHelper {
final boolean voiceNote
) throws AttachmentInvalidException {
try {
final var streamDetailsAndFileName = Utils.createStreamDetails(attachment);
final var streamDetails = streamDetailsAndFileName.first();
final var uploadSpec = getResumableUploadSpec(streamDetails);
final var streamDetails = Utils.createStreamDetails(attachment);
final var uploadSpec = dependencies.getMessageSender()
.getResumableUploadSpec(streamDetails.first().getLength());
return AttachmentUtils.createAttachmentStream(streamDetails,
streamDetailsAndFileName.second(),
return AttachmentUtils.createAttachmentStream(streamDetails.first(),
streamDetails.second(),
voiceNote,
uploadSpec);
} 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 {
final var attachmentStream = getAttachmentStream(attachment, false);
return uploadAttachment(attachmentStream);

View File

@ -123,7 +123,7 @@ public class GroupHelper {
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));
}

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

View File

@ -839,7 +839,8 @@ public class ManagerImpl implements Manager {
final var streamDetails = new StreamDetails(new ByteArrayInputStream(messageBytes),
MimeUtils.LONG_TEXT,
messageBytes.length);
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails);
final var uploadSpec = dependencies.getMessageSender()
.getResumableUploadSpec(streamDetails.getLength());
final var textAttachment = AttachmentUtils.createAttachmentStream(streamDetails,
Optional.empty(),
uploadSpec);
@ -907,7 +908,7 @@ public class ManagerImpl implements Manager {
if (streamDetails == null) {
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,
Optional.empty(),
uploadSpec);

View File

@ -1486,13 +1486,6 @@
"type": "kotlin.Pair",
"jniAccessible": true,
"methods": [
{
"name": "<init>",
"parameterTypes": [
"java.lang.Object",
"java.lang.Object"
]
},
{
"name": "getFirst",
"parameterTypes": []
@ -1503,9 +1496,6 @@
}
]
},
{
"type": "kotlin.Pair[]"
},
{
"type": "kotlin.SafePublicationLazyImpl",
"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",
"jniAccessible": true