aboutsummaryrefslogtreecommitdiffstats
path: root/hooks/post-receive
diff options
context:
space:
mode:
Diffstat (limited to 'hooks/post-receive')
-rw-r--r--hooks/post-receive19
1 files changed, 15 insertions, 4 deletions
diff --git a/hooks/post-receive b/hooks/post-receive
index 38e3061..722a0ec 100644
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -1,12 +1,23 @@
#!/bin/sh
set -e
+WEBROOT=/var/www/webring.gumx.cc
cd /home/git/build/webring
bash wr build
-rsync -rlptD --delete public/ /var/www/webring.gumx.cc/
-python3 - /var/www/webring.gumx.cc <<'EOF'
+rsync -rlptD --delete public/ "$WEBROOT/"
+
+# Deploy fonts (webring HTML references /fonts/KawkabMono-*.woff2 via @font-face)
+mkdir -p "$WEBROOT/fonts"
+rsync -rlptD /var/www/coffee.gumx.cc/fonts/ "$WEBROOT/fonts/"
+
+# Deploy favicon as file
+cat > "$WEBROOT/favicon.svg" <<'SVGEOF'
+<svg xmlns="http://www.w3.org/2000/svg" width="140" height="140" stroke="#000"><path stroke-width="122" stroke-dasharray="2,38" d="m9,70h122M70,9v122"/><path stroke-width="33" stroke-linecap="round" d="m70,30h0m40,40h0m-80,40v0m40,0h0m40,0h0"/></svg>
+SVGEOF
+
+# Inject favicon link and network footer into all deployed HTML pages
+python3 - "$WEBROOT" <<'EOF'
import sys, os, glob
webroot = sys.argv[1]
-favicon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNDAiIGhlaWdodD0iMTQwIiBzdHJva2U9IiMwMDAiPjxwYXRoIHN0cm9rZS13aWR0aD0iMTIyIiBzdHJva2UtZGFzaGFycmF5PSIyLDM4IiBkPSJtOSw3MGgxMjJNNzAsOXYxMjIiLz48cGF0aCBzdHJva2Utd2lkdGg9IjMzIiBzdHJva2UtbGluZWNhcD0icm91bmQiIGQ9Im03MCwzMGgwbTQwLDQwaDBtLTgwLDQwdjBtNDAsMGgwbTQwLDBoMCIvPjwvc3ZnPg=='
footer = (
'<footer>\n<hr>\n'
'<a href="https://twt.gumx.cc">twt</a> /\n'
@@ -20,7 +31,7 @@ footer = (
'<a href="https://wk.fo">wk.fo</a>\n'
'</footer>'
)
-favicon_tag = f'<link rel="icon" type="image/svg+xml" href="{favicon}">'
+favicon_tag = '<link rel="icon" type="image/svg+xml" href="/favicon.svg">'
for path in glob.glob(os.path.join(webroot, '**', '*.html'), recursive=True):
html = open(path).read()
if '</head>' in html and favicon_tag not in html: