Add authenticated login and SSO protection
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { jsonError, jsonOk } from "@/lib/server/api";
|
||||
import { requireAppUser } from "@/lib/server/auth/current-user";
|
||||
import { requestOrigin } from "@/lib/server/runtime";
|
||||
import { retryImageJob } from "@/lib/server/generation-service";
|
||||
|
||||
@@ -6,8 +7,9 @@ export const runtime = "nodejs";
|
||||
|
||||
export async function POST(request: Request, context: { params: Promise<{ id: string }> }) {
|
||||
try {
|
||||
const user = await requireAppUser();
|
||||
const { id } = await context.params;
|
||||
const job = await retryImageJob(id, requestOrigin(request));
|
||||
const job = await retryImageJob(id, requestOrigin(request), user.id);
|
||||
return jsonOk({ job }, { status: 202 });
|
||||
} catch (error) {
|
||||
return jsonError(error);
|
||||
|
||||
Reference in New Issue
Block a user