aboutsummaryrefslogtreecommitdiffstats
path: root/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'hooks')
-rw-r--r--hooks/post-receive26
1 files changed, 26 insertions, 0 deletions
diff --git a/hooks/post-receive b/hooks/post-receive
index 64026a7..38e3061 100644
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -3,4 +3,30 @@ set -e
cd /home/git/build/webring
bash wr build
rsync -rlptD --delete public/ /var/www/webring.gumx.cc/
+python3 - /var/www/webring.gumx.cc <<'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'
+ '<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>'
+)
+favicon_tag = f'<link rel="icon" type="image/svg+xml" href="{favicon}">'
+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:
+ html = html.replace('</head>', favicon_tag + '\n</head>', 1)
+ if '</body>' in html and 'twt.gumx.cc' not in html:
+ html = html.replace('</body>', footer + '\n</body>', 1)
+ open(path, 'w').write(html)
+EOF
echo "webring deployed"