added:增加Linux-server
This commit is contained in:
1 parent
712116d21d
commit
bd96aadb2f
90 files changed
+16784
-1
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { deployQueue } from "@/lib/git";
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
const body = await request.json();
|
||||
const { title } = body;
|
||||
|
||||
if (!title) {
|
||||
return NextResponse.json({ error: "Title is required" }, { status: 400 });
|
||||
}
|
||||
|
||||
const result = await deployQueue.enqueue(`发布: ${title}`);
|
||||
|
||||
if (result.success) {
|
||||
return NextResponse.json({ success: true, output: result.output });
|
||||
}
|
||||
|
||||
if (result.conflict) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
error: result.error,
|
||||
detail: result.output,
|
||||
},
|
||||
{ status: 409 }
|
||||
);
|
||||
}
|
||||
|
||||
return NextResponse.json({ error: result.error }, { status: 500 });
|
||||
} catch (error: unknown) {
|
||||
return NextResponse.json(
|
||||
{ error: error instanceof Error ? error.message : "Deploy failed" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user