From d6c3e7e8989bf2eb8c6038cfa3fd5aeddf893ad7 Mon Sep 17 00:00:00 2001 From: Ahmed Date: Thu, 18 Jun 2026 00:10:20 +0300 Subject: fix: favicon and style, again --- hooks/post-receive | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) (limited to 'hooks/post-receive') diff --git a/hooks/post-receive b/hooks/post-receive index 1240593..d492010 100644 --- a/hooks/post-receive +++ b/hooks/post-receive @@ -1,27 +1,30 @@ #!/bin/sh set -e WORK=/home/git/build/ccc -WEBROOT=/var/www/coffee.gumx.cc -mkdir -p "$WEBROOT/fonts" -cp "$WORK/ccc.html" "$WEBROOT/index.html" -rsync -rlptD "$WORK/fonts/" "$WEBROOT/fonts/" 2>/dev/null || true -python3 - "$WEBROOT/index.html" <<'EOF' -import sys -p = sys.argv[1] -html = open(p).read() -footer = ( - '' -) -open(p, 'w').write(html.replace('', footer + '\n')) +COFFEE=/var/www/coffee.gumx.cc +DEMO=/var/www/demo.gumx.cc + +# ── coffee.gumx.cc (personal log: DATA_URL=data.json, with footer) ────────── +mkdir -p "$COFFEE/styles" "$COFFEE/fonts" +cp "$WORK/ccc.html" "$COFFEE/index.html" +cp "$WORK/favicon.svg" "$COFFEE/favicon.svg" +cp "$WORK/styles/main.css" "$COFFEE/styles/main.css" +cp "$WORK/styles/ccc.css" "$COFFEE/styles/ccc.css" +rsync -rlptD "$WORK/fonts/" "$COFFEE/fonts/" 2>/dev/null || true + +# ── demo.gumx.cc/ccc (public demo: local mode, no footer) ─────────────────── +mkdir -p "$DEMO/ccc" "$DEMO/styles" "$DEMO/fonts" +python3 - "$WORK/ccc.html" "$DEMO/ccc/index.html" <<'EOF' +import sys, re +src, dst = sys.argv[1], sys.argv[2] +html = open(src).read() +html = html.replace('DATA_URL: "data.json"', 'DATA_URL: ""') +html = re.sub(r'\n ', '', html, flags=re.DOTALL) +open(dst, 'w').write(html) EOF -echo "ccc deployed to coffee.gumx.cc" +cp "$WORK/favicon.svg" "$DEMO/favicon.svg" +cp "$WORK/styles/main.css" "$DEMO/styles/main.css" +cp "$WORK/styles/ccc.css" "$DEMO/styles/ccc.css" +rsync -rlptD "$WORK/fonts/" "$DEMO/fonts/" 2>/dev/null || true + +echo "ccc deployed to coffee.gumx.cc and demo.gumx.cc/ccc" -- cgit v1.2.3