1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
#!/bin/sh
set -e
WEBROOT=/var/www/webring.gumx.cc
cd /home/git/build/webring
bash wr build
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]
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://list.gumx.cc">list</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'
'<br>\n'
'<a href="https://git.gumx.cc/webring">source</a> /\n'
'<a href="https://gumx.cc/license">license</a>\n'
'</footer>'
)
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:
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
cat > "$WEBROOT/404.html" <<'HTMLEOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>404 not found</title>
<style>
@font-face { font-family: "Kawkab Mono"; src: url(/fonts/KawkabMono-Regular.woff2); font-weight: normal; }
@font-face { font-family: "Kawkab Mono"; src: url(/fonts/KawkabMono-Bold.woff2); font-weight: bold; }
@font-face { font-family: "Kawkab Mono"; src: url(/fonts/KawkabMono-Light.woff2); font-weight: light; }
* { unicode-bidi: plaintext; }
html { color: black; background-color: white; }
body { font-family: "Kawkab Mono"; font-size: 16px; line-height: 1.4; margin: 0; padding: 4rem 0; min-height: 100%; overflow-wrap: break-word; }
h1, header, footer { text-align: center; }
nav { text-align: start; }
main { text-align: justify; }
main, header, footer { max-width: 800px; margin-inline: auto; padding: 0 2rem; }
p, h2, h3, h4 { margin: 1em 0 0 0; }
hr { border: none; border-top: thin solid; margin: 1.25rem 0; }
header { margin-bottom: 1em; }
footer { margin-top: 3em; }
@media (max-width: 600px) { body { font-size: 0.9em; } h1 { font-size: 1.8em; } }
@media (max-width: 400px) { body { font-size: 0.8em; } h1 { font-size: 1.6em; } }
@media (prefers-color-scheme: dark) { html { filter: invert(1); } img { filter: invert(1); } }
</style>
</head>
<body>
<header>
<nav><strong><a href="https://gumx.cc">gumx</a></strong></nav>
</header>
<main>
<h1>404</h1>
<p>not found.</p>
</main>
<footer>
<hr>
<a href="https://twt.gumx.cc">twt</a> /
<a href="https://git.gumx.cc">git</a> /
<a href="https://mail.gumx.cc">mail</a> /
<a href="https://list.gumx.cc">list</a> /
<a href="https://irc.gumx.cc">irc</a> /
<a href="https://files.gumx.cc">files</a> /
<a href="https://vpn.gumx.cc">vpn</a> /
<a href="https://pgp.gumx.cc">pgp</a> /
<a href="https://demo.gumx.cc">demo</a> /
<a href="https://wk.fo">wk.fo</a>
<br>
<a href="https://git.gumx.cc/webring">source</a> /
<a href="https://gumx.cc/license">license</a>
</footer>
</body>
</html>
HTMLEOF
echo "webring deployed"
|