diff options
| author | Ahmed <git@gumx.cc> | 2026-06-18 00:10:20 +0300 |
|---|---|---|
| committer | Ahmed <git@gumx.cc> | 2026-06-18 00:10:20 +0300 |
| commit | d6c3e7e8989bf2eb8c6038cfa3fd5aeddf893ad7 (patch) | |
| tree | 2d0788107c2f9e81ebd1037fa484dd47fee2e2b3 /hooks/post-receive | |
| parent | 361cecee3636036625a26e29811a37ce5b808580 (diff) | |
fix: favicon and style, again
Diffstat (limited to 'hooks/post-receive')
| -rw-r--r-- | hooks/post-receive | 49 |
1 files changed, 26 insertions, 23 deletions
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 = ( - '<footer>\n<hr>\n' - '<a href="https://twt.gumx.cc">twt</a> /\n' - '<a href="https://git.gumx.cc">git</a> /\n' - '<a href="https://mail.gumx.cc">mail</a> /\n' - '<a href="https://irc.gumx.cc">irc</a> /\n' - '<a href="https://files.gumx.cc">files</a> /\n' - '<a href="https://vpn.gumx.cc">vpn</a> /\n' - '<a href="https://pgp.gumx.cc">pgp</a> /\n' - '<a href="https://demo.gumx.cc">demo</a> /\n' - '<a href="https://wk.fo">wk.fo</a>\n' - '</footer>' -) -open(p, 'w').write(html.replace('</body>', footer + '\n</body>')) +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 <footer>.*?</footer>', '', 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" |
