Skip to content

Commit 0d0b061

Browse files
author
Bernhard B
committed
Reverted last commits
* updating to signal-cli v 0.10.0 is more work than anticipated; changes will be reverted here and development continues on dedicated feature branch.
1 parent 0f0a2f0 commit 0d0b061

File tree

5 files changed

+51
-26
lines changed

5 files changed

+51
-26
lines changed

Dockerfile

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
1-
ARG SIGNAL_CLI_VERSION=0.10.0
2-
ARG LIBSIGNAL_CLIENT_VERSION=0.11.0
1+
ARG SIGNAL_CLI_VERSION=0.9.2
2+
ARG ZKGROUP_VERSION=0.8.2
3+
ARG LIBSIGNAL_CLIENT_VERSION=0.9.7
34

45
ARG SWAG_VERSION=1.6.7
5-
ARG GRAALVM_JAVA_VERSION=17
6+
ARG GRAALVM_JAVA_VERSION=11
67
ARG GRAALVM_VERSION=21.3.0
78

89
FROM golang:1.17-bullseye AS buildcontainer
910

1011
ARG SIGNAL_CLI_VERSION
12+
ARG ZKGROUP_VERSION
1113
ARG LIBSIGNAL_CLIENT_VERSION
1214
ARG SWAG_VERSION
1315
ARG GRAALVM_JAVA_VERSION
1416
ARG GRAALVM_VERSION
1517

18+
COPY ext/libraries/zkgroup/v${ZKGROUP_VERSION} /tmp/zkgroup-libraries
1619
COPY ext/libraries/libsignal-client/v${LIBSIGNAL_CLIENT_VERSION} /tmp/libsignal-client-libraries
1720

21+
# use architecture specific libzkgroup.so
22+
RUN arch="$(uname -m)"; \
23+
case "$arch" in \
24+
aarch64) echo "[DEBUG] Using arm64 zkgroup" && cp /tmp/zkgroup-libraries/arm64/libzkgroup.so /tmp/libzkgroup.so ;; \
25+
armv7l) echo "[DEBUG] Using armv7 zkgroup" && cp /tmp/zkgroup-libraries/armv7/libzkgroup.so /tmp/libzkgroup.so ;; \
26+
x86_64) echo "[DEBUG] Using x86-64 zkgroup" && cp /tmp/zkgroup-libraries/x86-64/libzkgroup.so /tmp/libzkgroup.so ;; \
27+
*) echo "Unknown architecture" && exit 1 ;; \
28+
esac;
29+
1830
# use architecture specific libsignal_jni.so
1931
RUN arch="$(uname -m)"; \
2032
case "$arch" in \
@@ -25,7 +37,7 @@ RUN arch="$(uname -m)"; \
2537
esac;
2638

2739
RUN apt-get update \
28-
&& apt-get install -y --no-install-recommends wget openjdk-17-jre software-properties-common git locales zip file build-essential libz-dev zlib1g-dev \
40+
&& apt-get install -y --no-install-recommends wget default-jre software-properties-common git locales zip file build-essential libz-dev zlib1g-dev \
2941
&& rm -rf /var/lib/apt/lists/*
3042

3143
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
@@ -34,10 +46,6 @@ RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
3446

3547
ENV PATH="/root/.cargo/bin:${PATH}"
3648

37-
ENV JAVA_OPTS="-Djdk.lang.Process.launchMechanism=vfork"
38-
39-
RUN bash -c '([[ ! -d $JAVA_SECURITY_DIR ]] && ln -s $JAVA_HOME/lib $JAVA_HOME/conf) || (echo "Found java conf dir, package has been fixed, remove this hack"; exit -1)'
40-
4149
ENV LANG en_US.UTF-8
4250

4351
RUN cd /tmp/ \
@@ -52,8 +60,9 @@ RUN cd /tmp/ \
5260
&& git clone https://github.com/AsamK/signal-cli.git signal-cli-${SIGNAL_CLI_VERSION} \
5361
&& cd signal-cli-${SIGNAL_CLI_VERSION} \
5462
&& git checkout v${SIGNAL_CLI_VERSION} \
63+
&& cp /tmp/libzkgroup.so ./lib/src/main/resources/libzkgroup.so \
5564
&& cp /tmp/libsignal_jni.so ./lib/src/main/resources/libsignal_jni.so \
56-
&& ./gradlew build --stacktrace \
65+
&& ./gradlew build \
5766
&& ./gradlew installDist \
5867
&& ./gradlew distTar
5968

@@ -83,6 +92,22 @@ RUN if [ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "x86_64" ]; then \
8392
echo "Unknown architecture"; \
8493
fi;
8594

95+
# replace zkgroup
96+
97+
RUN ls /tmp/signal-cli-${SIGNAL_CLI_VERSION}/build/install/signal-cli/lib/zkgroup-java-${ZKGROUP_VERSION}.jar || (echo "\n\nzkgroup jar file with version ${ZKGROUP_VERSION} not found. Maybe the version needs to be bumped in the signal-cli-rest-api Dockerfile?\n\n" && echo "Available version: \n" && ls /tmp/signal-cli-${SIGNAL_CLI_VERSION}/build/install/signal-cli/lib/zkgroup-java-* && echo "\n\n" && exit 1)
98+
99+
RUN cd /tmp/ \
100+
&& zip -u /tmp/signal-cli-${SIGNAL_CLI_VERSION}/build/install/signal-cli/lib/zkgroup-java-${ZKGROUP_VERSION}.jar libzkgroup.so
101+
102+
RUN cd /tmp/signal-cli-${SIGNAL_CLI_VERSION}/build/distributions/ \
103+
&& mkdir -p signal-cli-${SIGNAL_CLI_VERSION}/lib/ \
104+
&& cp /tmp/signal-cli-${SIGNAL_CLI_VERSION}/build/install/signal-cli/lib/zkgroup-java-${ZKGROUP_VERSION}.jar signal-cli-${SIGNAL_CLI_VERSION}/lib/ \
105+
# update zip
106+
&& zip -u /tmp/signal-cli-${SIGNAL_CLI_VERSION}/build/distributions/signal-cli-${SIGNAL_CLI_VERSION}.zip signal-cli-${SIGNAL_CLI_VERSION}/lib/zkgroup-java-${ZKGROUP_VERSION}.jar \
107+
# update tar
108+
&& tar --delete -vPf /tmp/signal-cli-${SIGNAL_CLI_VERSION}/build/distributions/signal-cli-${SIGNAL_CLI_VERSION}.tar signal-cli-${SIGNAL_CLI_VERSION}/lib/zkgroup-java-${ZKGROUP_VERSION}.jar \
109+
&& tar --owner='' --group='' -rvPf /tmp/signal-cli-${SIGNAL_CLI_VERSION}/build/distributions/signal-cli-${SIGNAL_CLI_VERSION}.tar signal-cli-${SIGNAL_CLI_VERSION}/lib/zkgroup-java-${ZKGROUP_VERSION}.jar
110+
86111
# replace libsignal-client
87112

88113
RUN ls /tmp/signal-cli-${SIGNAL_CLI_VERSION}/build/install/signal-cli/lib/signal-client-java-${LIBSIGNAL_CLIENT_VERSION}.jar || (echo "\n\nsignal-client jar file with version ${LIBSIGNAL_CLIENT_VERSION} not found. Maybe the version needs to be bumped in the signal-cli-rest-api Dockerfile?\n\n" && echo "Available version: \n" && ls /tmp/signal-cli-${SIGNAL_CLI_VERSION}/build/install/signal-cli/lib/signal-client-java-* && echo "\n\n" && exit 1)
@@ -116,7 +141,7 @@ RUN cd /tmp/signal-cli-rest-api-src/scripts && go build -o jsonrpc2-helper
116141

117142

118143
# Start a fresh container for release container
119-
FROM eclipse-temurin:17-focal
144+
FROM eclipse-temurin:11-jre-focal
120145

121146
ENV GIN_MODE=release
122147

-6.62 MB
Binary file not shown.
-6.28 MB
Binary file not shown.
-6.72 MB
Binary file not shown.

src/client/client.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ func (s *SignalClient) send(number string, message string,
430430
return nil, err
431431
}
432432
} else {
433-
cmd := []string{"--config", s.signalCliConfig, "-a", number, "send"}
433+
cmd := []string{"--config", s.signalCliConfig, "-u", number, "send"}
434434
if !isGroup {
435435
cmd = append(cmd, recipients...)
436436
} else {
@@ -471,7 +471,7 @@ func (s *SignalClient) RegisterNumber(number string, useVoice bool, captcha stri
471471
if s.signalCliMode == JsonRpc {
472472
return errors.New(endpointNotSupportedInJsonRpcMode)
473473
}
474-
command := []string{"--config", s.signalCliConfig, "-a", number, "register"}
474+
command := []string{"--config", s.signalCliConfig, "-u", number, "register"}
475475

476476
if useVoice {
477477
command = append(command, "--voice")
@@ -490,7 +490,7 @@ func (s *SignalClient) VerifyRegisteredNumber(number string, token string, pin s
490490
return errors.New(endpointNotSupportedInJsonRpcMode)
491491
}
492492

493-
cmd := []string{"--config", s.signalCliConfig, "-a", number, "verify", token}
493+
cmd := []string{"--config", s.signalCliConfig, "-u", number, "verify", token}
494494
if pin != "" {
495495
cmd = append(cmd, "--pin")
496496
cmd = append(cmd, pin)
@@ -572,7 +572,7 @@ func (s *SignalClient) Receive(number string, timeout int64) (string, error) {
572572
}
573573
return string(msg.Params), nil
574574
} else {
575-
command := []string{"--config", s.signalCliConfig, "--output", "json", "-a", number, "receive", "-t", strconv.FormatInt(timeout, 10)}
575+
command := []string{"--config", s.signalCliConfig, "--output", "json", "-u", number, "receive", "-t", strconv.FormatInt(timeout, 10)}
576576

577577
out, err := runSignalCli(true, command, "", s.signalCliMode)
578578
if err != nil {
@@ -624,7 +624,7 @@ func (s *SignalClient) CreateGroup(number string, name string, members []string,
624624
}
625625
internalGroupId = resp.GroupId
626626
} else {
627-
cmd := []string{"--config", s.signalCliConfig, "-a", number, "updateGroup", "-n", name, "-m"}
627+
cmd := []string{"--config", s.signalCliConfig, "-u", number, "updateGroup", "-n", name, "-m"}
628628
cmd = append(cmd, members...)
629629

630630
if addMembersPermission != DefaultGroupPermission {
@@ -674,7 +674,7 @@ func (s *SignalClient) GetGroups(number string) ([]GroupEntry, error) {
674674
return groupEntries, err
675675
}
676676
} else {
677-
rawData, err = runSignalCli(true, []string{"--config", s.signalCliConfig, "--output", "json", "-a", number, "listGroups", "-d"}, "", s.signalCliMode)
677+
rawData, err = runSignalCli(true, []string{"--config", s.signalCliConfig, "--output", "json", "-u", number, "listGroups", "-d"}, "", s.signalCliMode)
678678
if err != nil {
679679
return groupEntries, err
680680
}
@@ -736,7 +736,7 @@ func (s *SignalClient) GetGroup(number string, groupId string) (*GroupEntry, err
736736
}
737737

738738
func (s *SignalClient) DeleteGroup(number string, groupId string) error {
739-
_, err := runSignalCli(true, []string{"--config", s.signalCliConfig, "-a", number, "quitGroup", "-g", string(groupId)}, "", s.signalCliMode)
739+
_, err := runSignalCli(true, []string{"--config", s.signalCliConfig, "-u", number, "quitGroup", "-g", string(groupId)}, "", s.signalCliMode)
740740
return err
741741
}
742742

@@ -871,7 +871,7 @@ func (s *SignalClient) UpdateProfile(number string, profileName string, base64Av
871871
}
872872
_, err = jsonRpc2Client.getRaw("updateProfile", request)
873873
} else {
874-
cmd := []string{"--config", s.signalCliConfig, "-a", number, "updateProfile", "--name", profileName}
874+
cmd := []string{"--config", s.signalCliConfig, "-u", number, "updateProfile", "--name", profileName}
875875
if base64Avatar == "" {
876876
cmd = append(cmd, "--remove-avatar")
877877
} else {
@@ -909,7 +909,7 @@ func (s *SignalClient) ListIdentities(number string) (*[]IdentityEntry, error) {
909909
identityEntries = append(identityEntries, identityEntry)
910910
}
911911
} else {
912-
rawData, err := runSignalCli(true, []string{"--config", s.signalCliConfig, "-a", number, "listIdentities"}, "", s.signalCliMode)
912+
rawData, err := runSignalCli(true, []string{"--config", s.signalCliConfig, "-u", number, "listIdentities"}, "", s.signalCliMode)
913913
if err != nil {
914914
return nil, err
915915
}
@@ -946,7 +946,7 @@ func (s *SignalClient) TrustIdentity(number string, numberToTrust string, verifi
946946
}
947947
_, err = jsonRpc2Client.getRaw("trust", request)
948948
} else {
949-
cmd := []string{"--config", s.signalCliConfig, "-a", number, "trust", numberToTrust, "--verified-safety-number", verifiedSafetyNumber}
949+
cmd := []string{"--config", s.signalCliConfig, "-u", number, "trust", numberToTrust, "--verified-safety-number", verifiedSafetyNumber}
950950
_, err = runSignalCli(true, cmd, "", s.signalCliMode)
951951
}
952952
return err
@@ -965,7 +965,7 @@ func (s *SignalClient) BlockGroup(number string, groupId string) error {
965965
}
966966
_, err = jsonRpc2Client.getRaw("block", request)
967967
} else {
968-
_, err = runSignalCli(true, []string{"--config", s.signalCliConfig, "-a", number, "block", "-g", groupId}, "", s.signalCliMode)
968+
_, err = runSignalCli(true, []string{"--config", s.signalCliConfig, "-u", number, "block", "-g", groupId}, "", s.signalCliMode)
969969
}
970970
return err
971971
}
@@ -983,7 +983,7 @@ func (s *SignalClient) JoinGroup(number string, groupId string) error {
983983
}
984984
_, err = jsonRpc2Client.getRaw("updateGroup", request)
985985
} else {
986-
_, err = runSignalCli(true, []string{"--config", s.signalCliConfig, "-a", number, "updateGroup", "-g", groupId}, "", s.signalCliMode)
986+
_, err = runSignalCli(true, []string{"--config", s.signalCliConfig, "-u", number, "updateGroup", "-g", groupId}, "", s.signalCliMode)
987987
}
988988
return err
989989
}
@@ -1001,7 +1001,7 @@ func (s *SignalClient) QuitGroup(number string, groupId string) error {
10011001
}
10021002
_, err = jsonRpc2Client.getRaw("quitGroup", request)
10031003
} else {
1004-
_, err = runSignalCli(true, []string{"--config", s.signalCliConfig, "-a", number, "quitGroup", "-g", groupId}, "", s.signalCliMode)
1004+
_, err = runSignalCli(true, []string{"--config", s.signalCliConfig, "-u", number, "quitGroup", "-g", groupId}, "", s.signalCliMode)
10051005
}
10061006
return err
10071007
}
@@ -1053,7 +1053,7 @@ func (s *SignalClient) SendReaction(number string, recipient string, emoji strin
10531053

10541054
cmd := []string{
10551055
"--config", s.signalCliConfig,
1056-
"-a", number,
1056+
"-u", number,
10571057
"sendReaction",
10581058
}
10591059
if !isGroup {
@@ -1099,7 +1099,7 @@ func (s *SignalClient) SendStartTyping(number string, recipient string) error {
10991099
}
11001100
_, err = jsonRpc2Client.getRaw("sendTyping", request)
11011101
} else {
1102-
cmd := []string{"--config", s.signalCliConfig, "-a", number, "sendTyping"}
1102+
cmd := []string{"--config", s.signalCliConfig, "-u", number, "sendTyping"}
11031103
if !isGroup {
11041104
cmd = append(cmd, recp)
11051105
} else {
@@ -1142,7 +1142,7 @@ func (s *SignalClient) SendStopTyping(number string, recipient string) error {
11421142
}
11431143
_, err = jsonRpc2Client.getRaw("sendTyping", request)
11441144
} else {
1145-
cmd := []string{"--config", s.signalCliConfig, "-a", number, "sendTyping", "--stop"}
1145+
cmd := []string{"--config", s.signalCliConfig, "-u", number, "sendTyping", "--stop"}
11461146
if !isGroup {
11471147
cmd = append(cmd, recp)
11481148
} else {

0 commit comments

Comments
 (0)