mirror of
https://github.com/lone-cloud/prism
synced 2026-06-04 12:13:28 -07:00
more fixes
This commit is contained in:
parent
a506e5b13c
commit
a201ea6dc5
3 changed files with 20 additions and 17 deletions
|
|
@ -1,4 +1,4 @@
|
|||
FROM oven/bun:1.3.6-alpine AS builder
|
||||
FROM oven/bun:1.3.6-debian AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
|
@ -9,11 +9,16 @@ COPY server .
|
|||
|
||||
RUN bun build --compile index.ts --outfile sup-server
|
||||
|
||||
FROM alpine:3.23
|
||||
FROM debian:13.3-slim
|
||||
|
||||
ARG SIGNAL_CLI_VERSION=0.13.22
|
||||
|
||||
RUN apk add --no-cache openjdk21-jre curl libstdc++ libgcc gcompat
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
openjdk-21-jre-headless \
|
||||
curl \
|
||||
ca-certificates \
|
||||
zip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN curl -L https://github.com/AsamK/signal-cli/releases/download/v${SIGNAL_CLI_VERSION}/signal-cli-${SIGNAL_CLI_VERSION}.tar.gz | tar xz -C /tmp \
|
||||
&& mv /tmp/signal-cli-${SIGNAL_CLI_VERSION} /usr/local/signal-cli \
|
||||
|
|
@ -22,17 +27,15 @@ RUN curl -L https://github.com/AsamK/signal-cli/releases/download/v${SIGNAL_CLI_
|
|||
RUN ARCH=$(uname -m) && \
|
||||
if [ "$ARCH" = "aarch64" ]; then \
|
||||
echo "Installing ARM64 native library for signal-cli..." && \
|
||||
apk add --no-cache unzip zip && \
|
||||
curl -L -o /tmp/libsignal_jni.so https://github.com/exquo/signal-libs-build/releases/latest/download/libsignal_jni_linux_aarch64.so && \
|
||||
unzip -q /usr/local/signal-cli/lib/libsignal-client-*.jar -d /tmp/jar && \
|
||||
rm /usr/local/signal-cli/lib/libsignal-client-*.jar && \
|
||||
cp /tmp/libsignal_jni.so /tmp/jar/libsignal_jni_aarch64.so && \
|
||||
cd /tmp/jar && zip -qr /usr/local/signal-cli/lib/libsignal-client.jar . && \
|
||||
cd - && rm -rf /tmp/jar /tmp/libsignal_jni.so && \
|
||||
apk del unzip zip; \
|
||||
LIBSIGNAL_VERSION=$(ls /usr/local/signal-cli/lib/libsignal-client-*.jar | sed 's/.*libsignal-client-\(.*\)\.jar/\1/') && \
|
||||
curl -L https://github.com/exquo/signal-libs-build/releases/download/libsignal_v${LIBSIGNAL_VERSION}/libsignal_jni.so-v${LIBSIGNAL_VERSION}-aarch64-unknown-linux-gnu.tar.gz | tar xz -C /tmp && \
|
||||
mv /tmp/libsignal_jni.so /tmp/libsignal_jni_aarch64.so && \
|
||||
cd /tmp && zip -u /usr/local/signal-cli/lib/libsignal-client-*.jar libsignal_jni_aarch64.so && \
|
||||
rm /tmp/libsignal_jni_aarch64.so; \
|
||||
fi
|
||||
|
||||
COPY --from=builder /app/sup-server /usr/local/bin/sup-server
|
||||
COPY --from=builder /app/templates /templates
|
||||
|
||||
ENV PATH="/usr/local/signal-cli/bin:${PATH}"
|
||||
ENV LD_LIBRARY_PATH="/usr/local/signal-cli/lib:${LD_LIBRARY_PATH}"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { existsSync, unlinkSync } from 'node:fs';
|
||||
import { rm } from 'node:fs/promises';
|
||||
import { rm, unlink } from 'node:fs/promises';
|
||||
import { DEVICE_NAME, VERBOSE } from '../constants/config';
|
||||
import { SIGNAL_CLI, SIGNAL_CLI_DATA, SIGNAL_CLI_SOCKET } from '../constants/paths';
|
||||
import type { ListAccountsResult, StartLinkResult, UpdateGroupResult } from '../types';
|
||||
|
|
@ -71,7 +70,7 @@ export async function unlinkDevice() {
|
|||
account = null;
|
||||
currentLinkUri = null;
|
||||
|
||||
if (existsSync(SIGNAL_CLI_DATA)) {
|
||||
if (await Bun.file(SIGNAL_CLI_DATA).exists()) {
|
||||
logWarn('⚠ Unlinking device and removing account data...');
|
||||
|
||||
try {
|
||||
|
|
@ -132,9 +131,9 @@ export async function startDaemon() {
|
|||
let authError = false;
|
||||
let cleaned = false;
|
||||
|
||||
if (existsSync(SIGNAL_CLI_SOCKET)) {
|
||||
if (await Bun.file(SIGNAL_CLI_SOCKET).exists()) {
|
||||
try {
|
||||
unlinkSync(SIGNAL_CLI_SOCKET);
|
||||
await unlink(SIGNAL_CLI_SOCKET);
|
||||
logVerbose('Removed stale socket file');
|
||||
} catch (error) {
|
||||
logError('Failed to remove stale socket file:', error);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { API_KEY } from '../constants/config';
|
||||
import { SIGNAL_CLI_DATA } from '../constants/paths';
|
||||
import { ROUTES, TEMPLATES } from '../constants/server';
|
||||
import {
|
||||
finishLink,
|
||||
|
|
@ -29,7 +30,7 @@ export const handleLink = async () => {
|
|||
|
||||
export const handleLinkQR = async (restartDaemon: () => Promise<void>) => {
|
||||
const linked = await hasValidAccount();
|
||||
if (!linked) {
|
||||
if (!linked && (await Bun.file(SIGNAL_CLI_DATA).exists())) {
|
||||
await unlinkDevice();
|
||||
await restartDaemon();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue