Add database backup/restore feature with admin UI

- Backup service using VACUUM INTO for WAL-safe atomic snapshots
- Server-side storage in DATA_DIR/backups with download/upload API routes
- Restore with integrity validation and automatic pre-restore safety backup
- Scheduled daily backups via cron with configurable retention
- Admin-only settings UI consolidated under single Server section
- Clean up account section sign-out button, fix switch sub-pixel rendering

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 20:01:10 -05:00
co-authored by Claude Opus 4.6
parent 724893196e
commit e59364e126
13 changed files with 826 additions and 50 deletions
@@ -1,14 +1,9 @@
"use client";
import { IconServerCog, IconUserPlus } from "@tabler/icons-react";
import { IconUserPlus } from "@tabler/icons-react";
import { useState } from "react";
import { toast } from "sonner";
import {
Card,
CardContent,
CardDescription,
CardTitle,
} from "@/components/ui/card";
import { CardContent, CardDescription, CardTitle } from "@/components/ui/card";
import { Switch } from "@/components/ui/switch";
import { toggleRegistration } from "./actions";
@@ -38,39 +33,25 @@ export function ServerSection({
}
return (
<div>
<div className="mb-3 flex items-center gap-2">
<IconServerCog size={16} className="text-muted-foreground" />
<h2 className="text-xs font-medium uppercase tracking-wider text-muted-foreground">
Server
</h2>
<span className="rounded-md bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary">
Admin only
</span>
</div>
<Card className="border-l-2 border-l-primary/30">
<CardContent>
<div className="flex items-center justify-between gap-4">
<div className="flex items-start gap-3">
<div className="mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10">
<IconUserPlus size={16} className="text-primary" />
</div>
<div>
<CardTitle>Open registration</CardTitle>
<CardDescription>
Allow new users to create accounts. Useful for adding
household members.
</CardDescription>
</div>
</div>
<Switch
checked={registrationOpen}
onCheckedChange={handleToggle}
disabled={toggling}
/>
<CardContent>
<div className="flex items-center justify-between gap-4">
<div className="flex items-start gap-3">
<div className="mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10">
<IconUserPlus size={16} className="text-primary" />
</div>
</CardContent>
</Card>
</div>
<div>
<CardTitle>Open registration</CardTitle>
<CardDescription>
Allow new users to create accounts
</CardDescription>
</div>
</div>
<Switch
checked={registrationOpen}
onCheckedChange={handleToggle}
disabled={toggling}
/>
</div>
</CardContent>
);
}