refactor: update dependencies and remove unused code

- Added new dependencies: `adler2`, `crc32fast`, `flate2`, `miniz_oxide`, and `libredox`.
- Updated existing dependencies: `tokio-rustls` to version 0.26.4 and `filetime` to version 0.2.27.
- Removed the `backup.rs` file as it is no longer needed.
- Introduced tests for configuration and credential management.
- Enhanced the `identity` module to generate W3C compliant DID documents.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-12 00:19:30 +00:00
co-authored by Claude Opus 4.6
parent fd2a837bea
commit f07ce10b1a
347 changed files with 18703 additions and 46785 deletions
+58 -28
View File
@@ -28,6 +28,35 @@ set -e
DEV_SERVER="${DEV_SERVER:-archipelago@192.168.1.228}"
BUILD_FROM_SOURCE="${BUILD_FROM_SOURCE:-0}"
UNBUNDLED="${UNBUNDLED:-0}"
ARCH="${ARCH:-x86_64}"
# Architecture-dependent variables
case "$ARCH" in
x86_64|amd64)
ARCH="x86_64"
DEB_ARCH="amd64"
LINUX_IMAGE_PKG="linux-image-amd64"
GRUB_EFI_PKG="grub-efi-amd64"
GRUB_EFI_SIGNED_PKG="grub-efi-amd64-signed"
GRUB_TARGET="x86_64-efi"
CONTAINER_PLATFORM="linux/amd64"
LIB_DIR="${LIB_DIR}"
;;
arm64|aarch64)
ARCH="arm64"
DEB_ARCH="arm64"
LINUX_IMAGE_PKG="linux-image-arm64"
GRUB_EFI_PKG="grub-efi-arm64"
GRUB_EFI_SIGNED_PKG="grub-efi-arm64-signed"
GRUB_TARGET="arm64-efi"
CONTAINER_PLATFORM="linux/arm64"
LIB_DIR="aarch64-linux-gnu"
;;
*)
echo "❌ Unsupported architecture: $ARCH (use x86_64 or arm64)"
exit 1
;;
esac
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
WORK_DIR="$SCRIPT_DIR/build/auto-installer"
@@ -54,6 +83,7 @@ else
echo "📦 Mode: Capturing LIVE SERVER state"
echo " Server: $DEV_SERVER"
fi
echo "🏗️ Architecture: $ARCH ($DEB_ARCH)"
echo ""
# Check for required tools
@@ -139,16 +169,16 @@ if [ ! -f "$ROOTFS_TAR" ] || [ "$1" == "--rebuild" ]; then
echo " Using Docker to create Debian root filesystem..."
# Create a Dockerfile for building the rootfs
cat > "$WORK_DIR/Dockerfile.rootfs" <<'DOCKERFILE'
cat > "$WORK_DIR/Dockerfile.rootfs" <<DOCKERFILE
FROM debian:bookworm
ENV DEBIAN_FRONTEND=noninteractive
# Install all packages we need including nginx, podman, and openssl (for self-signed certs)
RUN apt-get update && apt-get install -y \
linux-image-amd64 \
grub-efi-amd64 \
grub-efi-amd64-signed \
${LINUX_IMAGE_PKG} \
${GRUB_EFI_PKG} \
${GRUB_EFI_SIGNED_PKG} \
shim-signed \
systemd \
systemd-sysv \
@@ -282,10 +312,10 @@ SYSTEMDSERVICE
fi
echo " Building $CONTAINER_CMD image (this may take a few minutes)..."
$CONTAINER_CMD build --platform linux/amd64 -t archipelago-rootfs -f "$WORK_DIR/Dockerfile.rootfs" "$WORK_DIR"
$CONTAINER_CMD build --platform $CONTAINER_PLATFORM -t archipelago-rootfs -f "$WORK_DIR/Dockerfile.rootfs" "$WORK_DIR"
echo " Exporting filesystem..."
$CONTAINER_CMD create --platform linux/amd64 --name archipelago-rootfs-tmp archipelago-rootfs
$CONTAINER_CMD create --platform $CONTAINER_PLATFORM --name archipelago-rootfs-tmp archipelago-rootfs
$CONTAINER_CMD export archipelago-rootfs-tmp > "$ROOTFS_TAR"
$CONTAINER_CMD rm archipelago-rootfs-tmp
@@ -321,7 +351,7 @@ if [ ! -f "$BASE_ISO" ]; then
# Use wget without -O so --continue actually works
# Download with the ugly SourceForge filename, then rename
ISO_URL="https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-13.3.0-amd64-standard.iso"
ISO_URL="https://cdimage.debian.org/debian-cd/current-live/${DEB_ARCH}/iso-hybrid/debian-live-13.3.0-${DEB_ARCH}-standard.iso"
if command -v wget >/dev/null 2>&1; then
cd "$WORK_DIR"
@@ -336,8 +366,8 @@ if [ ! -f "$BASE_ISO" ]; then
# Find the downloaded file (wget creates it with a name like "download" or the actual filename)
if [ -f "download" ]; then
mv "download" "$BASE_ISO"
elif [ -f "debian-live-13.3.0-amd64-standard.iso" ]; then
mv "debian-live-13.3.0-amd64-standard.iso" "$BASE_ISO"
elif [ -f "debian-live-13.3.0-${DEB_ARCH}-standard.iso" ]; then
mv "debian-live-13.3.0-${DEB_ARCH}-standard.iso" "$BASE_ISO"
else
echo " ❌ Downloaded file not found"
exit 1
@@ -430,9 +460,9 @@ COPY core ./core
RUN cd core && cargo build --release --bin archipelago
BACKENDFILE
if $CONTAINER_CMD build --platform linux/amd64 -t archipelago-backend -f "$BACKEND_DOCKERFILE" "$SCRIPT_DIR/.." 2>&1 | tail -20; then
if $CONTAINER_CMD build --platform $CONTAINER_PLATFORM -t archipelago-backend -f "$BACKEND_DOCKERFILE" "$SCRIPT_DIR/.." 2>&1 | tail -20; then
echo " Extracting backend binary..."
BACKEND_CONTAINER=$($CONTAINER_CMD create --platform linux/amd64 archipelago-backend)
BACKEND_CONTAINER=$($CONTAINER_CMD create --platform $CONTAINER_PLATFORM archipelago-backend)
$CONTAINER_CMD cp "$BACKEND_CONTAINER:/build/core/target/release/archipelago" "$ARCH_DIR/bin/" && \
echo " ✅ Backend binary built ($(du -h "$ARCH_DIR/bin/archipelago" | cut -f1))"
$CONTAINER_CMD rm "$BACKEND_CONTAINER"
@@ -567,7 +597,7 @@ docker.io/portainer/portainer-ce:2.19.4 portainer.tar
docker.io/tailscale/tailscale:stable tailscale.tar
"
# Pull and save each image (force AMD64 for x86_64 target) only if not already present
# Pull and save each image (force target arch) only if not already present
echo "$CONTAINER_IMAGES" | while read -r image filename; do
[ -z "$image" ] && continue
tarpath="$IMAGES_DIR/$filename"
@@ -575,8 +605,8 @@ echo "$CONTAINER_IMAGES" | while read -r image filename; do
if [ -f "$tarpath" ]; then
echo " ✅ Using cached: $filename"
else
echo " Pulling $image (linux/amd64)..."
if $CONTAINER_CMD pull --platform linux/amd64 "$image"; then
echo " Pulling $image ($CONTAINER_PLATFORM)..."
if $CONTAINER_CMD pull --platform $CONTAINER_PLATFORM "$image"; then
echo " Saving $filename..."
if $CONTAINER_CMD save "$image" -o "$tarpath" 2>/dev/null; then
echo " ✅ Saved: $(du -h "$tarpath" | cut -f1)"
@@ -1150,8 +1180,8 @@ if grep -q "^archipelago:[!*]" /mnt/target/etc/shadow 2>/dev/null; then
fi
echo " Passwords set for archipelago and root users"
chroot /mnt/target grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=archipelago --removable 2>/dev/null || \
chroot /mnt/target grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=archipelago 2>/dev/null || \
chroot /mnt/target grub-install --target=${GRUB_TARGET} --efi-directory=/boot/efi --bootloader-id=archipelago --removable 2>/dev/null || \
chroot /mnt/target grub-install --target=${GRUB_TARGET} --efi-directory=/boot/efi --bootloader-id=archipelago 2>/dev/null || \
echo " Warning: GRUB install had issues, trying alternative..."
chroot /mnt/target update-grub
@@ -1259,7 +1289,7 @@ TOOLS_DIR="$WORK_DIR/tools-extract"
rm -rf "$TOOLS_DIR"
mkdir -p "$TOOLS_DIR"
$CONTAINER_CMD run --rm --platform linux/amd64 \
$CONTAINER_CMD run --rm --platform $CONTAINER_PLATFORM \
-v "$TOOLS_DIR:/output" \
debian:bookworm \
bash -c '
@@ -1275,12 +1305,12 @@ $CONTAINER_CMD run --rm --platform linux/amd64 \
# Copy required shared libraries for parted
mkdir -p /output/lib
cp /lib/x86_64-linux-gnu/libparted.so* /output/lib/ 2>/dev/null || true
cp /usr/lib/x86_64-linux-gnu/libparted.so* /output/lib/ 2>/dev/null || true
cp /lib/x86_64-linux-gnu/libreadline.so* /output/lib/ 2>/dev/null || true
cp /usr/lib/x86_64-linux-gnu/libreadline.so* /output/lib/ 2>/dev/null || true
cp /lib/x86_64-linux-gnu/libdevmapper.so* /output/lib/ 2>/dev/null || true
cp /usr/lib/x86_64-linux-gnu/libdevmapper.so* /output/lib/ 2>/dev/null || true
cp /lib/${LIB_DIR}/libparted.so* /output/lib/ 2>/dev/null || true
cp /usr/lib/${LIB_DIR}/libparted.so* /output/lib/ 2>/dev/null || true
cp /lib/${LIB_DIR}/libreadline.so* /output/lib/ 2>/dev/null || true
cp /usr/lib/${LIB_DIR}/libreadline.so* /output/lib/ 2>/dev/null || true
cp /lib/${LIB_DIR}/libdevmapper.so* /output/lib/ 2>/dev/null || true
cp /usr/lib/${LIB_DIR}/libdevmapper.so* /output/lib/ 2>/dev/null || true
# List what parted actually needs
ldd /usr/sbin/parted 2>/dev/null | grep "=>" | awk "{print \$3}" | while read lib; do
@@ -1299,8 +1329,8 @@ cp "$TOOLS_DIR/mkfs.ext4" "$OVERLAY_DIR/usr/sbin/" 2>/dev/null || true
cp "$TOOLS_DIR/mke2fs" "$OVERLAY_DIR/usr/sbin/" 2>/dev/null || true
# Copy shared libraries
mkdir -p "$OVERLAY_DIR/usr/lib/x86_64-linux-gnu"
cp "$TOOLS_DIR/lib/"*.so* "$OVERLAY_DIR/usr/lib/x86_64-linux-gnu/" 2>/dev/null || true
mkdir -p "$OVERLAY_DIR/usr/lib/${LIB_DIR}"
cp "$TOOLS_DIR/lib/"*.so* "$OVERLAY_DIR/usr/lib/${LIB_DIR}/" 2>/dev/null || true
chmod +x "$OVERLAY_DIR/usr/sbin/"* 2>/dev/null || true
chmod +x "$OVERLAY_DIR/sbin/"* 2>/dev/null || true
@@ -1411,7 +1441,7 @@ if command -v mksquashfs >/dev/null 2>&1; then
else
# Use $CONTAINER_CMD to create squashfs on macOS
echo " Using $CONTAINER_CMD to create squashfs..."
$CONTAINER_CMD run --rm --platform linux/amd64 \
$CONTAINER_CMD run --rm --platform $CONTAINER_PLATFORM \
-v "$OVERLAY_DIR:/overlay:ro" \
-v "$LIVE_DIR:/output" \
debian:bookworm \
@@ -1461,9 +1491,9 @@ echo ""
echo "📦 Step 6: Creating bootable ISO..."
if [ "$UNBUNDLED" = "1" ]; then
OUTPUT_ISO="$OUTPUT_DIR/archipelago-installer-unbundled-x86_64.iso"
OUTPUT_ISO="$OUTPUT_DIR/archipelago-installer-unbundled-${ARCH}.iso"
else
OUTPUT_ISO="$OUTPUT_DIR/archipelago-installer-x86_64.iso"
OUTPUT_ISO="$OUTPUT_DIR/archipelago-installer-${ARCH}.iso"
fi
# Extract MBR from original Debian Live ISO (most reliable for hybrid boot)
@@ -0,0 +1,14 @@
[Unit]
Description=Archipelago Kiosk Watchdog
After=archipelago.service
Wants=archipelago.service
[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/archipelago-kiosk-watchdog
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,22 @@
[Unit]
Description=Archipelago Kiosk (X11 + Chromium)
After=archipelago.service graphical.target
Wants=archipelago.service
ConditionPathExists=/usr/local/bin/archipelago-kiosk-x11
Conflicts=getty@tty1.service
[Service]
Type=simple
User=archipelago
Environment="HOME=/home/archipelago"
Environment="DISPLAY=:0"
# Wait for backend before launching UI
ExecStartPre=/bin/bash -c 'for i in $(seq 1 30); do curl -sf http://localhost/health >/dev/null 2>&1 && exit 0; sleep 2; done; exit 0'
ExecStart=/usr/bin/startx /usr/local/bin/archipelago-kiosk-x11 -- -nocursor vt1
Restart=always
RestartSec=5
StandardInput=tty
TTYPath=/dev/tty1
[Install]
WantedBy=multi-user.target
+70 -1
View File
@@ -14,10 +14,12 @@ server {
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' ws: wss:; frame-src *" always;
# AIUI SPA (Chat mode iframe)
# Use =404 fallback instead of index.html to prevent serving HTML with wrong
# MIME type when JS/CSS files are missing (causes module script MIME errors)
location /aiui/ {
alias /opt/archipelago/web-ui/aiui/;
index index.html;
try_files $uri $uri/ /aiui/index.html;
try_files $uri $uri/ =404;
}
# AIUI Claude API proxy — requires valid session cookie
@@ -403,6 +405,39 @@ server {
proxy_send_timeout 86400s;
}
# External site proxies — strip X-Frame-Options so iframe embedding works.
# add_header here prevents inheritance of server-level X-Frame-Options.
location /ext/botfights/ {
proxy_pass https://botfights.net/;
proxy_http_version 1.1;
proxy_set_header Host botfights.net;
proxy_ssl_server_name on;
proxy_hide_header X-Frame-Options;
proxy_hide_header Content-Security-Policy;
proxy_hide_header Cross-Origin-Embedder-Policy;
proxy_hide_header Cross-Origin-Opener-Policy;
proxy_hide_header Cross-Origin-Resource-Policy;
add_header X-Content-Type-Options "nosniff" always;
}
location /ext/484-kitchen/ {
proxy_pass https://484.kitchen/;
proxy_http_version 1.1;
proxy_set_header Host 484.kitchen;
proxy_ssl_server_name on;
proxy_hide_header X-Frame-Options;
proxy_hide_header Content-Security-Policy;
add_header X-Content-Type-Options "nosniff" always;
}
location /ext/arch-presentation/ {
proxy_pass https://present.l484.com/;
proxy_http_version 1.1;
proxy_set_header Host present.l484.com;
proxy_ssl_server_name on;
proxy_hide_header X-Frame-Options;
proxy_hide_header Content-Security-Policy;
add_header X-Content-Type-Options "nosniff" always;
}
# Proxy WebSocket
location /ws {
proxy_pass http://127.0.0.1:5678;
@@ -600,6 +635,40 @@ server {
}
# All remaining app proxies (mempool, fedimint, lnd, bitcoin-ui, etc.)
include snippets/archipelago-https-app-proxies.conf;
# External site proxies — strip X-Frame-Options so iframe embedding works.
# add_header here prevents inheritance of server-level X-Frame-Options.
location /ext/botfights/ {
proxy_pass https://botfights.net/;
proxy_http_version 1.1;
proxy_set_header Host botfights.net;
proxy_ssl_server_name on;
proxy_hide_header X-Frame-Options;
proxy_hide_header Content-Security-Policy;
proxy_hide_header Cross-Origin-Embedder-Policy;
proxy_hide_header Cross-Origin-Opener-Policy;
proxy_hide_header Cross-Origin-Resource-Policy;
add_header X-Content-Type-Options "nosniff" always;
}
location /ext/484-kitchen/ {
proxy_pass https://484.kitchen/;
proxy_http_version 1.1;
proxy_set_header Host 484.kitchen;
proxy_ssl_server_name on;
proxy_hide_header X-Frame-Options;
proxy_hide_header Content-Security-Policy;
add_header X-Content-Type-Options "nosniff" always;
}
location /ext/arch-presentation/ {
proxy_pass https://present.l484.com/;
proxy_http_version 1.1;
proxy_set_header Host present.l484.com;
proxy_ssl_server_name on;
proxy_hide_header X-Frame-Options;
proxy_hide_header Content-Security-Policy;
add_header X-Content-Type-Options "nosniff" always;
}
location /ws {
proxy_pass http://127.0.0.1:5678;
proxy_http_version 1.1;