mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 02:45:39 -04:00
Add version update check feature for admin users
Checks current version against latest GitHub release every 6 hours via cron job, caches result in appSettings, and surfaces updates through a toast notification (once per browser session) and an animated badge in the settings footer. Includes an admin toggle to enable/disable checks (enabled by default). Also renames ServerSection to RegistrationSection now that update checks are in their own card. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { headers } from "next/headers";
|
||||
import { NextResponse } from "next/server";
|
||||
import { auth } from "@/lib/auth/server";
|
||||
import { getCachedUpdateCheck } from "@/lib/services/update-check";
|
||||
|
||||
export async function GET() {
|
||||
const session = await auth.api.getSession({ headers: await headers() });
|
||||
if (!session)
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
if (session.user.role !== "admin")
|
||||
return NextResponse.json({ error: "Forbidden" }, { status: 403 });
|
||||
|
||||
const result = getCachedUpdateCheck();
|
||||
return NextResponse.json(result);
|
||||
}
|
||||
Reference in New Issue
Block a user