Add Migadu domain admin with shared lists, compaction, and safer apply.

Build the Go API and React UI for managing domain denylist/allowlist/recipient
deny and spam settings, plus shared lists that import/apply across domains with
wildcard compaction, entry verification, and Migadu-friendly list encoding
(including per-domain recipient filtering and rejection bisect on apply).
This commit is contained in:
2026-07-26 21:50:26 +02:00
parent 930f1f7b69
commit a79cb61104
55 changed files with 7600 additions and 1 deletions
+71
View File
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
# Bootstrap a local development .env and dependencies.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
EXAMPLE=".env.example"
ENV_FILE=".env"
if [[ ! -f "$EXAMPLE" ]]; then
echo "error: missing $EXAMPLE" >&2
exit 1
fi
created_env=0
if [[ ! -f "$ENV_FILE" ]]; then
cp "$EXAMPLE" "$ENV_FILE"
created_env=1
if command -v openssl >/dev/null 2>&1; then
secret="$(openssl rand -base64 48 | tr -d '\n')"
elif command -v python3 >/dev/null 2>&1; then
secret="$(python3 -c 'import secrets; print(secrets.token_urlsafe(48))')"
else
secret="dev-$(date +%s)-please-change-this-secret-value-now"
fi
# Portable in-place replace for SESSION_SECRET
tmp="$(mktemp)"
awk -v secret="$secret" '
BEGIN { replaced = 0 }
/^SESSION_SECRET=/ {
print "SESSION_SECRET=" secret
replaced = 1
next
}
{ print }
END {
if (!replaced) {
print "SESSION_SECRET=" secret
}
}
' "$ENV_FILE" > "$tmp"
mv "$tmp" "$ENV_FILE"
echo "Created $ENV_FILE with a generated SESSION_SECRET."
echo "Edit MIGADU_USER and MIGADU_API_KEY before calling Migadu."
else
echo "Using existing $ENV_FILE."
fi
mkdir -p data
# Ensure node deps for Vite
if [[ -d web ]]; then
(cd web && npm install --silent)
fi
# Friendly reminder when placeholders remain
if grep -Eq '^MIGADU_USER=(you@example\.com)?[[:space:]]*$' "$ENV_FILE" \
|| grep -Eq '^MIGADU_API_KEY=(your-migadu-api-key)?[[:space:]]*$' "$ENV_FILE"; then
echo
echo "Note: set real MIGADU_USER / MIGADU_API_KEY in .env to load domains."
echo "Auth/UI still work locally without them until you open Domains."
fi
if [[ "$created_env" -eq 1 ]]; then
echo
echo "Dev defaults ready. Next: make dev"
fi