docs: new root as prior history lost (orphan + GC); ~215 commits not recoverable

This commit is contained in:
Hernâni Marques 2026-07-13 10:12:00 +02:00
commit 96961f23f5
268 changed files with 24161 additions and 0 deletions

View file

@ -0,0 +1,74 @@
#!/bin/bash
# Write privacy policy files (txt/md/html) into a TERMS/PRIVACY dir.
# Used by exchange + merchant installers. Style matches dual-currency terms.
#
# Usage (sourced or): install_privacy_docs DIR ETAG TITLE BADGE
# Environment: BODY_MD, BODY_TXT, BODY_HTML_MAIN (inner body HTML after h1)
set -euo pipefail
install_privacy_docs() {
local dir="$1" etag="$2" title="$3" badge="$4"
local lang="${5:-en}"
local out="$dir/$lang"
mkdir -p "$out"
printf '%s\n' "${BODY_TXT:?}" >"$out/${etag}.txt"
printf '%s\n' "${BODY_MD:?}" >"$out/${etag}.md"
cat >"$out/${etag}.html" <<HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>${title}</title>
<style>
:root { color-scheme: dark light; }
body {
font-family: system-ui, -apple-system, sans-serif;
max-width: 42rem; margin: 2rem auto; padding: 0 1.1rem 3rem;
line-height: 1.5; color: #e8e6e3; background: #1a1520;
}
h1 { font-size: 1.35rem; font-weight: 800; margin: 0 0 1rem; color: #f5f0ea; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; color: #e8c878; }
h3 { font-size: 0.95rem; margin: 1rem 0 0.4rem; color: #c4b5fd; }
p, li, td, th { font-size: 0.95rem; }
ul, ol { padding-left: 1.2rem; }
code, a { color: #5eead4; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.badge {
display: inline-block; font-size: 0.72rem; font-weight: 700;
letter-spacing: 0.06em; text-transform: uppercase;
color: #c4b5fd; border: 1px solid rgba(196,181,253,0.35);
border-radius: 999px; padding: 0.2rem 0.65rem; margin-bottom: 0.85rem;
}
.note {
border-radius: 12px; padding: 0.75rem 0.9rem; margin: 0.85rem 0 1rem;
border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.25);
font-size: 0.9rem; color: #c8c4bf;
}
table {
width: 100%; border-collapse: collapse; margin: 0.6rem 0 1rem;
font-size: 0.88rem;
}
th, td {
border: 1px solid rgba(255,255,255,0.12); padding: 0.45rem 0.55rem;
text-align: left; vertical-align: top;
}
th { background: rgba(0,0,0,0.35); color: #e8c878; font-weight: 700; }
.muted { color: #a39e98; font-size: 0.88rem; }
footer { margin-top: 2rem; font-size: 0.85rem; color: #a39e98; }
</style>
</head>
<body>
<div class="badge">${badge}</div>
<h1>${title}</h1>
${BODY_HTML_MAIN}
<footer class="muted">Version ${etag} · Swiss FADP (revDSG) · hacktivism.ch</footer>
</body>
</html>
HTML
chmod -R a+rX "$dir"
echo "privacy docs: $out/${etag}.{txt,md,html}"
}

View file

@ -0,0 +1,130 @@
#!/bin/bash
# Memory snapshot for landing-stats (source after json_str is defined).
# Sets MEM_JSON (fields to embed inside performance.memory).
# IMPORTANT: no pipelines around the /proc loop (bash subshell loses counters).
mem_fmt_bytes() {
awk -v b="${1:-0}" 'BEGIN{
b = b + 0
if (b < 1024) printf "%d B", b
else if (b < 1048576) printf "%.1f KiB", b / 1024
else if (b < 1073741824) printf "%.1f MiB", b / 1048576
else printf "%.2f GiB", b / 1073741824
}'
}
mem_snapshot_json() {
local rss_kb rss_b pid comm cmd short
local sum_b=0 cgroup_b="" limit_b=""
local postgres_b=0 taler_b=0 nginx_b=0 java_b=0 redis_b=0 other_b=0
local n_pg=0 n_taler=0 n_nginx=0 n_java=0 n_redis=0 n_other=0
local allf topf top_json top_n=0 lim_json cg_json hum cjs sjs hjs
if [ -r /sys/fs/cgroup/memory.current ]; then
cgroup_b=$(tr -d ' \n' </sys/fs/cgroup/memory.current 2>/dev/null || true)
if [ -r /sys/fs/cgroup/memory.max ]; then
limit_b=$(tr -d ' \n' </sys/fs/cgroup/memory.max 2>/dev/null || true)
[ "$limit_b" = "max" ] && limit_b=""
fi
elif [ -r /sys/fs/cgroup/memory/memory.usage_in_bytes ]; then
cgroup_b=$(tr -d ' \n' </sys/fs/cgroup/memory/memory.usage_in_bytes 2>/dev/null || true)
fi
allf=$(mktemp)
topf=$(mktemp)
for st in /proc/[0-9]*/status; do
[ -f "$st" ] || continue
pid=${st#/proc/}
pid=${pid%/status}
rss_kb=$(awk '/^VmRSS:/{print $2; exit}' "$st" 2>/dev/null || true)
[[ "$rss_kb" =~ ^[0-9]+$ ]] || continue
rss_b=$((rss_kb * 1024))
sum_b=$((sum_b + rss_b))
comm=$(awk '/^Name:/{print $2; exit}' "$st" 2>/dev/null || echo "?")
cmd=""
if [ -r "/proc/$pid/cmdline" ]; then
cmd=$(tr '\0' ' ' <"/proc/$pid/cmdline" 2>/dev/null | sed 's/[[:space:]]*$//')
fi
[ -n "$cmd" ] || cmd=$comm
short=$(printf '%s' "$cmd" | cut -c1-100)
case "$comm $cmd" in
*postgres*|*postmaster*)
postgres_b=$((postgres_b + rss_b)); n_pg=$((n_pg + 1)) ;;
*taler-exchange*|*taler-merchant*|*taler-auditor*|*taler-helper*|*taler_*)
taler_b=$((taler_b + rss_b)); n_taler=$((n_taler + 1)) ;;
*nginx*)
nginx_b=$((nginx_b + rss_b)); n_nginx=$((n_nginx + 1)) ;;
*java*|*libeufin*|*MainKt*)
java_b=$((java_b + rss_b)); n_java=$((n_java + 1)) ;;
*redis-server*|*redis*)
redis_b=$((redis_b + rss_b)); n_redis=$((n_redis + 1)) ;;
*)
other_b=$((other_b + rss_b)); n_other=$((n_other + 1)) ;;
esac
printf '%s\t%s\t%s\n' "$rss_b" "$comm" "$short" >>"$allf"
done
sort -t$'\t' -nr -k1,1 "$allf" 2>/dev/null | head -10 >"$topf"
rm -f "$allf"
local total_b=$sum_b
if [[ "$cgroup_b" =~ ^[0-9]+$ ]] && [ "$cgroup_b" -gt 0 ]; then
total_b=$cgroup_b
fi
top_json="["
top_n=0
while IFS=$'\t' read -r rss_b comm short; do
[ -z "${rss_b:-}" ] && continue
[ "$top_n" -gt 0 ] && top_json="${top_json},"
top_n=$((top_n + 1))
hum=$(mem_fmt_bytes "$rss_b")
cjs=$(json_str "$comm")
sjs=$(json_str "$short")
hjs=$(json_str "$hum")
top_json="${top_json}
{\"rss_bytes\": ${rss_b}, \"rss_human\": ${hjs}, \"comm\": ${cjs}, \"cmd\": ${sjs}}"
done <"$topf"
top_json="${top_json}
]"
rm -f "$topf"
lim_json="null"
if [[ "$limit_b" =~ ^[0-9]+$ ]] && [ "$limit_b" -gt 0 ]; then
lim_json=$limit_b
fi
cg_json="null"
if [[ "$cgroup_b" =~ ^[0-9]+$ ]]; then
cg_json=$cgroup_b
fi
MEM_JSON="
\"container_rss_bytes\": ${total_b},
\"container_rss_human\": $(json_str "$(mem_fmt_bytes "$total_b")"),
\"proc_sum_rss_bytes\": ${sum_b},
\"proc_sum_rss_human\": $(json_str "$(mem_fmt_bytes "$sum_b")"),
\"cgroup_bytes\": ${cg_json},
\"cgroup_limit_bytes\": ${lim_json},
\"postgres_rss_bytes\": ${postgres_b},
\"postgres_rss_human\": $(json_str "$(mem_fmt_bytes "$postgres_b")"),
\"postgres_n\": ${n_pg},
\"taler_rss_bytes\": ${taler_b},
\"taler_rss_human\": $(json_str "$(mem_fmt_bytes "$taler_b")"),
\"taler_n\": ${n_taler},
\"nginx_rss_bytes\": ${nginx_b},
\"nginx_rss_human\": $(json_str "$(mem_fmt_bytes "$nginx_b")"),
\"nginx_n\": ${n_nginx},
\"java_rss_bytes\": ${java_b},
\"java_rss_human\": $(json_str "$(mem_fmt_bytes "$java_b")"),
\"java_n\": ${n_java},
\"redis_rss_bytes\": ${redis_b},
\"redis_rss_human\": $(json_str "$(mem_fmt_bytes "$redis_b")"),
\"redis_n\": ${n_redis},
\"other_rss_bytes\": ${other_b},
\"other_rss_human\": $(json_str "$(mem_fmt_bytes "$other_b")"),
\"other_n\": ${n_other},
\"top\": ${top_json}
"
}

View file

@ -0,0 +1,37 @@
/* Shared dark palette for hacktivism.ch Taler terms & privacy pages */
:root { color-scheme: dark light; }
body {
font-family: system-ui, -apple-system, sans-serif;
max-width: 42rem; margin: 2rem auto; padding: 0 1.1rem 3rem;
line-height: 1.5; color: #e8e6e3; background: #1a1520;
}
h1 { font-size: 1.35rem; font-weight: 800; margin: 0 0 1rem; color: #f5f0ea; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; color: #e8c878; }
h3 { font-size: 0.95rem; margin: 1rem 0 0.4rem; color: #c4b5fd; }
p, li, td, th { font-size: 0.95rem; }
ul, ol { padding-left: 1.2rem; }
code, a { color: #5eead4; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.badge {
display: inline-block; font-size: 0.72rem; font-weight: 700;
letter-spacing: 0.06em; text-transform: uppercase;
color: #c4b5fd; border: 1px solid rgba(196,181,253,0.35);
border-radius: 999px; padding: 0.2rem 0.65rem; margin-bottom: 0.85rem;
}
.note {
border-radius: 12px; padding: 0.75rem 0.9rem; margin: 0.85rem 0 1rem;
border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.25);
font-size: 0.9rem; color: #c8c4bf;
}
table {
width: 100%; border-collapse: collapse; margin: 0.6rem 0 1rem;
font-size: 0.88rem;
}
th, td {
border: 1px solid rgba(255,255,255,0.12); padding: 0.45rem 0.55rem;
text-align: left; vertical-align: top;
}
th { background: rgba(0,0,0,0.35); color: #e8c878; font-weight: 700; }
.muted { color: #a39e98; font-size: 0.88rem; }
footer { margin-top: 2rem; font-size: 0.85rem; color: #a39e98; }