mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-05-25 14:24:36 +00:00
Compare commits
2 Commits
d0ee90dbbc
...
a03d17a9e4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a03d17a9e4 | ||
|
|
364f89f1d0 |
@ -1,5 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.14.2] - 2026-04-04
|
||||
|
||||
### Added
|
||||
|
||||
@ -8,7 +8,7 @@ plugins {
|
||||
|
||||
allprojects {
|
||||
group = "org.asamk"
|
||||
version = "0.14.2"
|
||||
version = "0.14.3-SNAPSHOT"
|
||||
}
|
||||
|
||||
java {
|
||||
|
||||
@ -11,11 +11,14 @@ 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;
|
||||
@ -89,12 +92,12 @@ public class AttachmentHelper {
|
||||
final boolean voiceNote
|
||||
) throws AttachmentInvalidException {
|
||||
try {
|
||||
final var streamDetails = Utils.createStreamDetails(attachment);
|
||||
final var uploadSpec = dependencies.getMessageSender()
|
||||
.getResumableUploadSpec(streamDetails.first().getLength());
|
||||
final var streamDetailsAndFileName = Utils.createStreamDetails(attachment);
|
||||
final var streamDetails = streamDetailsAndFileName.first();
|
||||
final var uploadSpec = getResumableUploadSpec(streamDetails);
|
||||
|
||||
return AttachmentUtils.createAttachmentStream(streamDetails.first(),
|
||||
streamDetails.second(),
|
||||
return AttachmentUtils.createAttachmentStream(streamDetails,
|
||||
streamDetailsAndFileName.second(),
|
||||
voiceNote,
|
||||
uploadSpec);
|
||||
} catch (IOException e) {
|
||||
@ -102,6 +105,13 @@ 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);
|
||||
|
||||
@ -123,7 +123,7 @@ public class GroupHelper {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
final var uploadSpec = dependencies.getMessageSender().getResumableUploadSpec(streamDetails.getLength());
|
||||
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails);
|
||||
return Optional.of(AttachmentUtils.createAttachmentStream(streamDetails, Optional.empty(), uploadSpec));
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ 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;
|
||||
@ -131,13 +132,14 @@ public class SyncHelper {
|
||||
|
||||
if (groupsFile.exists() && groupsFile.length() > 0) {
|
||||
try (var groupsFileStream = new FileInputStream(groupsFile)) {
|
||||
final var uploadSpec = context.getDependencies()
|
||||
.getMessageSender()
|
||||
.getResumableUploadSpec(groupsFile.length());
|
||||
final var streamDetails = new StreamDetails(groupsFileStream,
|
||||
MimeUtils.OCTET_STREAM,
|
||||
groupsFile.length());
|
||||
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails);
|
||||
var attachmentStream = SignalServiceAttachment.newStreamBuilder()
|
||||
.withStream(groupsFileStream)
|
||||
.withContentType(MimeUtils.OCTET_STREAM)
|
||||
.withLength(groupsFile.length())
|
||||
.withStream(streamDetails.getStream())
|
||||
.withContentType(streamDetails.getContentType())
|
||||
.withLength(streamDetails.getLength())
|
||||
.withResumableUploadSpec(uploadSpec)
|
||||
.build();
|
||||
|
||||
@ -192,13 +194,14 @@ public class SyncHelper {
|
||||
|
||||
if (contactsFile.exists() && contactsFile.length() > 0) {
|
||||
try (var contactsFileStream = new FileInputStream(contactsFile)) {
|
||||
final var uploadSpec = context.getDependencies()
|
||||
.getMessageSender()
|
||||
.getResumableUploadSpec(contactsFile.length());
|
||||
final var streamDetails = new StreamDetails(contactsFileStream,
|
||||
MimeUtils.OCTET_STREAM,
|
||||
contactsFile.length());
|
||||
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails);
|
||||
var attachmentStream = SignalServiceAttachment.newStreamBuilder()
|
||||
.withStream(contactsFileStream)
|
||||
.withContentType(MimeUtils.OCTET_STREAM)
|
||||
.withLength(contactsFile.length())
|
||||
.withStream(streamDetails.getStream())
|
||||
.withContentType(streamDetails.getContentType())
|
||||
.withLength(streamDetails.getLength())
|
||||
.withResumableUploadSpec(uploadSpec)
|
||||
.build();
|
||||
|
||||
|
||||
@ -839,8 +839,7 @@ public class ManagerImpl implements Manager {
|
||||
final var streamDetails = new StreamDetails(new ByteArrayInputStream(messageBytes),
|
||||
MimeUtils.LONG_TEXT,
|
||||
messageBytes.length);
|
||||
final var uploadSpec = dependencies.getMessageSender()
|
||||
.getResumableUploadSpec(streamDetails.getLength());
|
||||
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails);
|
||||
final var textAttachment = AttachmentUtils.createAttachmentStream(streamDetails,
|
||||
Optional.empty(),
|
||||
uploadSpec);
|
||||
@ -908,7 +907,7 @@ public class ManagerImpl implements Manager {
|
||||
if (streamDetails == null) {
|
||||
throw new InvalidStickerException("Missing local sticker file");
|
||||
}
|
||||
final var uploadSpec = dependencies.getMessageSender().getResumableUploadSpec(streamDetails.getLength());
|
||||
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails);
|
||||
final var stickerAttachment = AttachmentUtils.createAttachmentStream(streamDetails,
|
||||
Optional.empty(),
|
||||
uploadSpec);
|
||||
|
||||
@ -1486,6 +1486,13 @@
|
||||
"type": "kotlin.Pair",
|
||||
"jniAccessible": true,
|
||||
"methods": [
|
||||
{
|
||||
"name": "<init>",
|
||||
"parameterTypes": [
|
||||
"java.lang.Object",
|
||||
"java.lang.Object"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "getFirst",
|
||||
"parameterTypes": []
|
||||
@ -1496,6 +1503,9 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "kotlin.Pair[]"
|
||||
},
|
||||
{
|
||||
"type": "kotlin.SafePublicationLazyImpl",
|
||||
"fields": [
|
||||
@ -5821,6 +5831,21 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user