mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Small improvements
This commit is contained in:
parent
2e4d346bc8
commit
43face8ead
12 changed files with 35 additions and 35 deletions
|
@ -713,6 +713,13 @@
|
||||||
"allDeclaredMethods":true,
|
"allDeclaredMethods":true,
|
||||||
"allDeclaredConstructors":true
|
"allDeclaredConstructors":true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name":"org.asamk.signal.json.JsonAttachmentData",
|
||||||
|
"allDeclaredFields":true,
|
||||||
|
"queryAllDeclaredMethods":true,
|
||||||
|
"queryAllDeclaredConstructors":true,
|
||||||
|
"methods":[{"name":"data","parameterTypes":[] }]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name":"org.asamk.signal.json.JsonCallMessage",
|
"name":"org.asamk.signal.json.JsonCallMessage",
|
||||||
"allDeclaredFields":true,
|
"allDeclaredFields":true,
|
||||||
|
@ -975,6 +982,10 @@
|
||||||
{"name":"startColor","parameterTypes":[] }
|
{"name":"startColor","parameterTypes":[] }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name":"org.asamk.signal.json.JsonStreamSerializer",
|
||||||
|
"methods":[{"name":"<init>","parameterTypes":[] }]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name":"org.asamk.signal.json.JsonSyncDataMessage",
|
"name":"org.asamk.signal.json.JsonSyncDataMessage",
|
||||||
"allDeclaredFields":true,
|
"allDeclaredFields":true,
|
||||||
|
|
|
@ -43,9 +43,6 @@ public class AttachmentStore {
|
||||||
|
|
||||||
public StreamDetails retrieveAttachment(final String id) throws IOException {
|
public StreamDetails retrieveAttachment(final String id) throws IOException {
|
||||||
final var attachmentFile = new File(attachmentsPath, id);
|
final var attachmentFile = new File(attachmentsPath, id);
|
||||||
if (!attachmentFile.exists()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return Utils.createStreamDetailsFromFile(attachmentFile);
|
return Utils.createStreamDetailsFromFile(attachmentFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,9 @@ class LiveConfig {
|
||||||
new SignalCdnUrl[]{new SignalCdnUrl(CDN_URL, TRUST_STORE)},
|
new SignalCdnUrl[]{new SignalCdnUrl(CDN_URL, TRUST_STORE)},
|
||||||
2,
|
2,
|
||||||
new SignalCdnUrl[]{new SignalCdnUrl(CDN2_URL, TRUST_STORE)}),
|
new SignalCdnUrl[]{new SignalCdnUrl(CDN2_URL, TRUST_STORE)}),
|
||||||
new SignalContactDiscoveryUrl[]{new SignalContactDiscoveryUrl(SIGNAL_CONTACT_DISCOVERY_URL,
|
new SignalContactDiscoveryUrl[]{
|
||||||
TRUST_STORE)},
|
new SignalContactDiscoveryUrl(SIGNAL_CONTACT_DISCOVERY_URL, TRUST_STORE)
|
||||||
|
},
|
||||||
new SignalKeyBackupServiceUrl[]{new SignalKeyBackupServiceUrl(SIGNAL_KEY_BACKUP_URL, TRUST_STORE)},
|
new SignalKeyBackupServiceUrl[]{new SignalKeyBackupServiceUrl(SIGNAL_KEY_BACKUP_URL, TRUST_STORE)},
|
||||||
new SignalStorageUrl[]{new SignalStorageUrl(STORAGE_URL, TRUST_STORE)},
|
new SignalStorageUrl[]{new SignalStorageUrl(STORAGE_URL, TRUST_STORE)},
|
||||||
new SignalCdsiUrl[]{new SignalCdsiUrl(SIGNAL_CDSI_URL, TRUST_STORE)},
|
new SignalCdsiUrl[]{new SignalCdsiUrl(SIGNAL_CDSI_URL, TRUST_STORE)},
|
||||||
|
|
|
@ -62,8 +62,9 @@ class StagingConfig {
|
||||||
new SignalCdnUrl[]{new SignalCdnUrl(CDN_URL, TRUST_STORE)},
|
new SignalCdnUrl[]{new SignalCdnUrl(CDN_URL, TRUST_STORE)},
|
||||||
2,
|
2,
|
||||||
new SignalCdnUrl[]{new SignalCdnUrl(CDN2_URL, TRUST_STORE)}),
|
new SignalCdnUrl[]{new SignalCdnUrl(CDN2_URL, TRUST_STORE)}),
|
||||||
new SignalContactDiscoveryUrl[]{new SignalContactDiscoveryUrl(SIGNAL_CONTACT_DISCOVERY_URL,
|
new SignalContactDiscoveryUrl[]{
|
||||||
TRUST_STORE)},
|
new SignalContactDiscoveryUrl(SIGNAL_CONTACT_DISCOVERY_URL, TRUST_STORE)
|
||||||
|
},
|
||||||
new SignalKeyBackupServiceUrl[]{new SignalKeyBackupServiceUrl(SIGNAL_KEY_BACKUP_URL, TRUST_STORE)},
|
new SignalKeyBackupServiceUrl[]{new SignalKeyBackupServiceUrl(SIGNAL_KEY_BACKUP_URL, TRUST_STORE)},
|
||||||
new SignalStorageUrl[]{new SignalStorageUrl(STORAGE_URL, TRUST_STORE)},
|
new SignalStorageUrl[]{new SignalStorageUrl(STORAGE_URL, TRUST_STORE)},
|
||||||
new SignalCdsiUrl[]{new SignalCdsiUrl(SIGNAL_CDSI_URL, TRUST_STORE)},
|
new SignalCdsiUrl[]{new SignalCdsiUrl(SIGNAL_CDSI_URL, TRUST_STORE)},
|
||||||
|
|
|
@ -43,7 +43,6 @@ public class AttachmentHelper {
|
||||||
return attachmentStore.retrieveAttachment(id);
|
return attachmentStore.retrieveAttachment(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<SignalServiceAttachment> uploadAttachments(final List<String> attachments) throws AttachmentInvalidException, IOException {
|
public List<SignalServiceAttachment> uploadAttachments(final List<String> attachments) throws AttachmentInvalidException, IOException {
|
||||||
var attachmentStreams = AttachmentUtils.createAttachmentStreams(attachments);
|
var attachmentStreams = AttachmentUtils.createAttachmentStreams(attachments);
|
||||||
|
|
||||||
|
|
|
@ -637,17 +637,19 @@ The path of the manifest.json or a zip file containing the sticker pack you wish
|
||||||
|
|
||||||
=== getAttachment
|
=== getAttachment
|
||||||
|
|
||||||
Gets teh raw data for a specified attachment. This is done using the ID of the attachment the recipient or group ID.
|
Gets the raw data for a specified attachment.
|
||||||
|
This is done using the ID of the attachment the recipient or group ID.
|
||||||
The attachment data is returned as a Base64 String.
|
The attachment data is returned as a Base64 String.
|
||||||
|
|
||||||
*--id* [ID]::
|
*--id* [ID]::
|
||||||
The ID of the attachment as given in the attachment list of the message.
|
The ID of the attachment as given in the attachment list of the message.
|
||||||
|
|
||||||
*--recipient* [RECIPIENT]::
|
*--recipient* [RECIPIENT]::
|
||||||
Specify the number which sent the attachment. Referred to generally as recipient.
|
Specify the number which sent the attachment.
|
||||||
|
Referred to generally as recipient.
|
||||||
|
|
||||||
*-g* [GROUP], *--group-id* [GROUP]::
|
*-g* [GROUP], *--group-id* [GROUP]::
|
||||||
Alternatively, specify the group IDs that for which to get the attachment.
|
Alternatively, specify the group IDs for which to get the attachment.
|
||||||
|
|
||||||
=== daemon
|
=== daemon
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,11 @@ public class Commands {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
addCommand(new AddDeviceCommand());
|
addCommand(new AddDeviceCommand());
|
||||||
addCommand(new GetAttachmentCommand());
|
|
||||||
addCommand(new BlockCommand());
|
addCommand(new BlockCommand());
|
||||||
addCommand(new DaemonCommand());
|
addCommand(new DaemonCommand());
|
||||||
addCommand(new DeleteLocalAccountDataCommand());
|
addCommand(new DeleteLocalAccountDataCommand());
|
||||||
addCommand(new FinishLinkCommand());
|
addCommand(new FinishLinkCommand());
|
||||||
|
addCommand(new GetAttachmentCommand());
|
||||||
addCommand(new GetUserStatusCommand());
|
addCommand(new GetUserStatusCommand());
|
||||||
addCommand(new JoinGroupCommand());
|
addCommand(new JoinGroupCommand());
|
||||||
addCommand(new JsonRpcDispatcherCommand());
|
addCommand(new JsonRpcDispatcherCommand());
|
||||||
|
|
|
@ -26,22 +26,15 @@ public class GetAttachmentCommand implements JsonRpcLocalCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void attachToSubparser(final Subparser subparser) {
|
public void attachToSubparser(final Subparser subparser) {
|
||||||
subparser.addArgument("--id")
|
subparser.addArgument("--id").required(true).help("The ID of the attachment file.");
|
||||||
.required(true)
|
var mut = subparser.addMutuallyExclusiveGroup().required(true);
|
||||||
.help("The ID of the attachment file.");
|
mut.addArgument("--recipient").help("Sender of the attachment");
|
||||||
var mut = subparser.addMutuallyExclusiveGroup()
|
mut.addArgument("-g", "--group-id").help("Group in which the attachment was received");
|
||||||
.required(true);
|
|
||||||
mut.addArgument("--recipient")
|
|
||||||
.help("Sender of the attachment");
|
|
||||||
mut.addArgument("-g", "--group-id")
|
|
||||||
.help("Group in which the attachment was received");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleCommand(
|
public void handleCommand(
|
||||||
final Namespace ns,
|
final Namespace ns, final Manager m, final OutputWriter outputWriter
|
||||||
final Manager m,
|
|
||||||
final OutputWriter outputWriter
|
|
||||||
) throws CommandException {
|
) throws CommandException {
|
||||||
|
|
||||||
final var id = ns.getString("id");
|
final var id = ns.getString("id");
|
||||||
|
|
|
@ -43,11 +43,7 @@ record JsonStoryMessage(
|
||||||
}
|
}
|
||||||
|
|
||||||
public record Gradient(
|
public record Gradient(
|
||||||
String startColor,
|
String startColor, String endColor, List<String> colors, List<Float> positions, Integer angle
|
||||||
String endColor,
|
|
||||||
List<String> colors,
|
|
||||||
List<Float> positions,
|
|
||||||
Integer angle
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
static Gradient from(MessageEnvelope.Story.TextAttachment.Gradient gradient) {
|
static Gradient from(MessageEnvelope.Story.TextAttachment.Gradient gradient) {
|
||||||
|
|
|
@ -11,9 +11,7 @@ public class JsonStreamSerializer extends JsonSerializer<InputStream> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(
|
public void serialize(
|
||||||
final InputStream value,
|
final InputStream value, final JsonGenerator jsonGenerator, final SerializerProvider serializers
|
||||||
final JsonGenerator jsonGenerator,
|
|
||||||
final SerializerProvider serializers
|
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
jsonGenerator.writeBinary(value, -1);
|
jsonGenerator.writeBinary(value, -1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,9 @@ package org.asamk.signal.util;
|
||||||
|
|
||||||
public class Hex {
|
public class Hex {
|
||||||
|
|
||||||
private final static char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
private final static char[] HEX_DIGITS = {
|
||||||
|
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
|
||||||
|
};
|
||||||
|
|
||||||
private Hex() {
|
private Hex() {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue