From 9988c097cf68979a92604e32629653af2dfb3796 Mon Sep 17 00:00:00 2001 From: ryzenpay Date: Sun, 7 Jun 2026 02:18:45 -0400 Subject: [PATCH 1/2] 80 lint error fixes, burger menu icon replace, completed card, divider between download & active, setup script fixes broken .env, git pipeline only runs on main --- .claude/settings.local.json | 4 +++- .github/workflows/docker-publish.yml | 3 ++- .github/workflows/helm-publish.yml | 1 + .github/workflows/pages.yml | 1 + docker-init.sh | 35 ++++++++++++++++++++++++++-- src/lib/components/ui/Sidebar.svelte | 7 +++--- src/routes/downloads/+page.svelte | 26 +++++++++++++++++++-- 7 files changed, 67 insertions(+), 10 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index a24a752..bbba024 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -4,7 +4,9 @@ "Bash(npx svelte-check *)", "Bash(npm install *)", "Bash(npx tsc *)", - "Bash(docker compose *)" + "Bash(docker compose *)", + "Bash(npx prisma *)", + "Bash(npm run *)" ] } } diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 3285ea7..69addb8 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -13,6 +13,7 @@ env: jobs: build: + if: github.repository == 'willuhmjs/wytui' runs-on: ${{ matrix.runner }} strategy: matrix: @@ -77,7 +78,7 @@ jobs: merge: runs-on: ubuntu-latest - if: github.event_name != 'pull_request' + if: github.repository == 'willuhmjs/wytui' && github.event_name != 'pull_request' needs: build permissions: contents: read diff --git a/.github/workflows/helm-publish.yml b/.github/workflows/helm-publish.yml index 0993a7b..d39b475 100644 --- a/.github/workflows/helm-publish.yml +++ b/.github/workflows/helm-publish.yml @@ -12,6 +12,7 @@ env: jobs: helm: + if: github.repository == 'willuhmjs/wytui' runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 9484829..6367829 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -17,6 +17,7 @@ concurrency: jobs: deploy: + if: github.repository == 'willuhmjs/wytui' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/docker-init.sh b/docker-init.sh index 30128b9..d5315b5 100755 --- a/docker-init.sh +++ b/docker-init.sh @@ -6,6 +6,29 @@ set -e ENV_FILE=".env" +# Ensure KEY exists with a non-empty value in $ENV_FILE. +# Appends the key if missing, fills it in if present but empty. +# $1 = key name, $2 = value to use when the key is missing/empty +ensure_var() { + local key="$1" + local value="$2" + + # Already set with a non-empty value -> leave it alone + if grep -qE "^${key}=.+" "$ENV_FILE" 2>/dev/null; then + return + fi + + if grep -qE "^${key}=" "$ENV_FILE" 2>/dev/null; then + # Present but empty -> fill in the value + sed -i.bak "s|^${key}=.*|${key}=${value}|" "$ENV_FILE" && rm -f "$ENV_FILE.bak" + echo " • Set empty ${key}" + else + # Missing entirely -> append it + printf '%s=%s\n' "$key" "$value" >> "$ENV_FILE" + echo " • Added missing ${key}" + fi +} + # Check if .env exists if [ ! -f "$ENV_FILE" ]; then echo "📝 No .env file found. Generating secure credentials..." @@ -38,10 +61,18 @@ EOF echo "" else echo "✅ Using existing $ENV_FILE" + + # An existing .env may predate Docker support (e.g. a dev file with only + # DATABASE_URL). Ensure the variables docker-compose.yml requires are present. + echo "🔧 Ensuring Docker Compose credentials are set..." + ensure_var POSTGRES_USER postgres + ensure_var POSTGRES_PASSWORD "$(openssl rand -hex 32)" + ensure_var POSTGRES_DB wytui + ensure_var AUTH_SECRET "$(openssl rand -hex 32)" fi -# Check if credentials are set -if grep -q "POSTGRES_PASSWORD=$" "$ENV_FILE" 2>/dev/null || grep -q "AUTH_SECRET=$" "$ENV_FILE" 2>/dev/null; then +# Final safety net: refuse to start with empty required credentials +if grep -qE "^POSTGRES_PASSWORD=$" "$ENV_FILE" 2>/dev/null || grep -qE "^AUTH_SECRET=$" "$ENV_FILE" 2>/dev/null; then echo "⚠️ WARNING: Empty credentials detected in $ENV_FILE" echo " Please set POSTGRES_PASSWORD and AUTH_SECRET" exit 1 diff --git a/src/lib/components/ui/Sidebar.svelte b/src/lib/components/ui/Sidebar.svelte index 90b9300..c079cc1 100644 --- a/src/lib/components/ui/Sidebar.svelte +++ b/src/lib/components/ui/Sidebar.svelte @@ -72,7 +72,7 @@