v4.1 - Admin/onboarding

This commit is contained in:
2026-05-18 22:25:43 +12:00
parent 6ff970015f
commit 541ae2eeec
79 changed files with 11544 additions and 1007 deletions
+12
View File
@@ -12,6 +12,7 @@ NGINX_COMPOSE_FILE=""
NGINX_PROJECT_NAME=""
MAINTENANCE_HOST_DIR=""
MAINTENANCE_FLAG_PATH=""
SEED_ADMIN_DATA=0
usage() {
cat <<'EOF'
@@ -84,6 +85,10 @@ while [[ $# -gt 0 ]]; do
usage
exit 0
;;
--seed-admin-data)
SEED_ADMIN_DATA=1
shift 1
;;
*)
fail "Unknown argument: $1"
;;
@@ -349,6 +354,13 @@ if (( nginx_args_present )); then
MAINTENANCE_ACTIVE=1
fi
if [[ "$SEED_ADMIN_DATA" -eq 1 ]]; then
echo "[deploy-remote] Admin data seed requested: mail-api will overwrite admin_kv from JSON on next boot"
export ADMIN_DATA_SEED_FROM_JSON="force"
else
export ADMIN_DATA_SEED_FROM_JSON="auto"
fi
if [[ -n "$SERVICE_NAME" ]]; then
echo "[deploy-remote] Stopping only the Goodwalk service: $SERVICE_NAME"
"${COMPOSE_CMD[@]}" -p "$PROJECT_NAME" -f "$COMPOSE_FILE" stop "$SERVICE_NAME" || true
+6
View File
@@ -4,6 +4,7 @@ import { join, extname, basename } from 'node:path';
const MAX_WIDTH = 1600;
const MIN_BYTES_TO_OPTIMISE = 250 * 1024;
const OPTIMISE_WEBP = process.env.OPTIMISE_WEBP === '1';
const dirs = ['src/lib/images', 'static/images'];
@@ -31,6 +32,7 @@ async function optimiseFile(file) {
} else if (ext === '.jpg' || ext === '.jpeg') {
buf = await pipeline.jpeg({ quality: 82, mozjpeg: true }).toBuffer();
} else if (ext === '.webp') {
if (!OPTIMISE_WEBP) return { file, original: (await stat(file)).size, optimised: (await stat(file)).size, skipped: true };
buf = await pipeline.webp({ quality: 80, effort: 6 }).toBuffer();
} else {
return null;
@@ -54,6 +56,10 @@ for (const dir of dirs) {
const file = join(dir, name);
const s = await stat(file);
if (s.size < MIN_BYTES_TO_OPTIMISE) continue;
if (/\.webp$/i.test(name) && !OPTIMISE_WEBP) {
console.log(`${basename(file).padEnd(58)} ${(s.size / 1024).toFixed(0).padStart(5)}KB (skipped: existing WebP)`);
continue;
}
try {
const res = await optimiseFile(file);
if (!res) continue;