add stable media support and sync skillhub UI

This commit is contained in:
wtgoku
2026-04-08 23:17:42 +08:00
parent ff4f370763
commit 4b20dc5e37
32 changed files with 6269 additions and 393 deletions
+43
View File
@@ -0,0 +1,43 @@
import { NextResponse } from "next/server";
import { cookies } from "next/headers";
import {
SESSION_COOKIE_NAME,
popiartFetchEnvelope,
} from "@/lib/popiart-api";
export async function POST() {
const cookieStore = await cookies();
const token = cookieStore.get(SESSION_COOKIE_NAME)?.value;
try {
if (token) {
await popiartFetchEnvelope<{ logged_out: boolean }>("/auth/logout", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
},
});
}
} catch {
// Clear the local session even if the upstream logout call fails.
}
const response = NextResponse.json({
ok: true,
data: {
logged_out: true,
},
});
response.cookies.set({
name: SESSION_COOKIE_NAME,
value: "",
httpOnly: true,
sameSite: "lax",
secure: process.env.NODE_ENV === "production",
path: "/",
maxAge: 0,
});
return response;
}