diff --git a/Dockerfile b/Dockerfile index 9c02305..5a1d129 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,9 @@ COPY . . # Clone effects repo RUN git clone https://git.rose-ash.com/art-dag/effects.git /app/artdag-effects +# Build client tarball for download +RUN ./build-client.sh + # Create cache directory RUN mkdir -p /data/cache diff --git a/app/routers/home.py b/app/routers/home.py index c421f37..108ee1f 100644 --- a/app/routers/home.py +++ b/app/routers/home.py @@ -5,8 +5,8 @@ Home and root routes for L1 server. from pathlib import Path import markdown -from fastapi import APIRouter, Request, Depends -from fastapi.responses import HTMLResponse, RedirectResponse +from fastapi import APIRouter, Request, Depends, HTTPException +from fastapi.responses import HTMLResponse, RedirectResponse, FileResponse from artdag_common import render from artdag_common.middleware import wants_html @@ -77,3 +77,19 @@ async def login_redirect(request: Request): "

No L2 server configured for authentication.

", status_code=503 ) + + +# Client tarball path +CLIENT_TARBALL = Path(__file__).parent.parent.parent / "artdag-client.tar.gz" + + +@router.get("/download/client") +async def download_client(): + """Download the Art DAG CLI client.""" + if not CLIENT_TARBALL.exists(): + raise HTTPException(404, "Client package not found. Run build-client.sh to create it.") + return FileResponse( + CLIENT_TARBALL, + media_type="application/gzip", + filename="artdag-client.tar.gz" + ) diff --git a/app/templates/base.html b/app/templates/base.html index e6e32ae..94e3e58 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -8,6 +8,7 @@ Recipes Media Storage + Client {% endblock %} diff --git a/build-client.sh b/build-client.sh new file mode 100755 index 0000000..c9443b6 --- /dev/null +++ b/build-client.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Build the artdag-client tarball +# This script is run during deployment to create the downloadable client package + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +CLIENT_REPO="https://git.rose-ash.com/art-dag/client.git" +TEMP_DIR=$(mktemp -d) +OUTPUT_FILE="$SCRIPT_DIR/artdag-client.tar.gz" + +echo "Building artdag-client.tar.gz..." + +# Clone the client repo +git clone --depth 1 "$CLIENT_REPO" "$TEMP_DIR/artdag-client" 2>/dev/null || { + echo "Failed to clone client repo, trying alternative..." + # Try GitHub if internal git fails + git clone --depth 1 "https://github.com/gilesbradshaw/art-client.git" "$TEMP_DIR/artdag-client" 2>/dev/null || { + echo "Error: Could not clone client repository" + rm -rf "$TEMP_DIR" + exit 1 + } +} + +# Remove .git directory +rm -rf "$TEMP_DIR/artdag-client/.git" +rm -rf "$TEMP_DIR/artdag-client/__pycache__" + +# Create tarball +cd "$TEMP_DIR" +tar -czf "$OUTPUT_FILE" artdag-client + +# Cleanup +rm -rf "$TEMP_DIR" + +echo "Created: $OUTPUT_FILE" +ls -lh "$OUTPUT_FILE"