mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-05-29 15:04:16 +00:00
Compare commits
3 Commits
c03b96a800
...
8a7a2736e2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a7a2736e2 | ||
|
|
a03d17a9e4 | ||
|
|
364f89f1d0 |
@ -1,5 +1,7 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
## [0.14.2] - 2026-04-04
|
## [0.14.2] - 2026-04-04
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@ -8,7 +8,7 @@ plugins {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "org.asamk"
|
group = "org.asamk"
|
||||||
version = "0.14.2"
|
version = "0.14.3-SNAPSHOT"
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
|
|||||||
@ -11,11 +11,14 @@ 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;
|
||||||
@ -89,12 +92,12 @@ public class AttachmentHelper {
|
|||||||
final boolean voiceNote
|
final boolean voiceNote
|
||||||
) throws AttachmentInvalidException {
|
) throws AttachmentInvalidException {
|
||||||
try {
|
try {
|
||||||
final var streamDetails = Utils.createStreamDetails(attachment);
|
final var streamDetailsAndFileName = Utils.createStreamDetails(attachment);
|
||||||
final var uploadSpec = dependencies.getMessageSender()
|
final var streamDetails = streamDetailsAndFileName.first();
|
||||||
.getResumableUploadSpec(streamDetails.first().getLength());
|
final var uploadSpec = getResumableUploadSpec(streamDetails);
|
||||||
|
|
||||||
return AttachmentUtils.createAttachmentStream(streamDetails.first(),
|
return AttachmentUtils.createAttachmentStream(streamDetails,
|
||||||
streamDetails.second(),
|
streamDetailsAndFileName.second(),
|
||||||
voiceNote,
|
voiceNote,
|
||||||
uploadSpec);
|
uploadSpec);
|
||||||
} catch (IOException e) {
|
} 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 {
|
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);
|
||||||
|
|||||||
@ -123,7 +123,7 @@ public class GroupHelper {
|
|||||||
return Optional.empty();
|
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));
|
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.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;
|
||||||
@ -131,13 +132,14 @@ 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 uploadSpec = context.getDependencies()
|
final var streamDetails = new StreamDetails(groupsFileStream,
|
||||||
.getMessageSender()
|
MimeUtils.OCTET_STREAM,
|
||||||
.getResumableUploadSpec(groupsFile.length());
|
groupsFile.length());
|
||||||
|
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails);
|
||||||
var attachmentStream = SignalServiceAttachment.newStreamBuilder()
|
var attachmentStream = SignalServiceAttachment.newStreamBuilder()
|
||||||
.withStream(groupsFileStream)
|
.withStream(streamDetails.getStream())
|
||||||
.withContentType(MimeUtils.OCTET_STREAM)
|
.withContentType(streamDetails.getContentType())
|
||||||
.withLength(groupsFile.length())
|
.withLength(streamDetails.getLength())
|
||||||
.withResumableUploadSpec(uploadSpec)
|
.withResumableUploadSpec(uploadSpec)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@ -192,13 +194,14 @@ 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 uploadSpec = context.getDependencies()
|
final var streamDetails = new StreamDetails(contactsFileStream,
|
||||||
.getMessageSender()
|
MimeUtils.OCTET_STREAM,
|
||||||
.getResumableUploadSpec(contactsFile.length());
|
contactsFile.length());
|
||||||
|
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails);
|
||||||
var attachmentStream = SignalServiceAttachment.newStreamBuilder()
|
var attachmentStream = SignalServiceAttachment.newStreamBuilder()
|
||||||
.withStream(contactsFileStream)
|
.withStream(streamDetails.getStream())
|
||||||
.withContentType(MimeUtils.OCTET_STREAM)
|
.withContentType(streamDetails.getContentType())
|
||||||
.withLength(contactsFile.length())
|
.withLength(streamDetails.getLength())
|
||||||
.withResumableUploadSpec(uploadSpec)
|
.withResumableUploadSpec(uploadSpec)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|||||||
@ -839,8 +839,7 @@ 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 = dependencies.getMessageSender()
|
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails);
|
||||||
.getResumableUploadSpec(streamDetails.getLength());
|
|
||||||
final var textAttachment = AttachmentUtils.createAttachmentStream(streamDetails,
|
final var textAttachment = AttachmentUtils.createAttachmentStream(streamDetails,
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
uploadSpec);
|
uploadSpec);
|
||||||
@ -908,7 +907,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 = dependencies.getMessageSender().getResumableUploadSpec(streamDetails.getLength());
|
final var uploadSpec = context.getAttachmentHelper().getResumableUploadSpec(streamDetails);
|
||||||
final var stickerAttachment = AttachmentUtils.createAttachmentStream(streamDetails,
|
final var stickerAttachment = AttachmentUtils.createAttachmentStream(streamDetails,
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
uploadSpec);
|
uploadSpec);
|
||||||
|
|||||||
@ -1486,6 +1486,13 @@
|
|||||||
"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": []
|
||||||
@ -1496,6 +1503,9 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "kotlin.Pair[]"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "kotlin.SafePublicationLazyImpl",
|
"type": "kotlin.SafePublicationLazyImpl",
|
||||||
"fields": [
|
"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",
|
"type": "org.signal.libsignal.net.internal.BridgeChatListener",
|
||||||
"jniAccessible": true
|
"jniAccessible": true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user