0.2.1 onlyoffice修复

This commit is contained in:
liaibo
2026-01-17 10:12:53 +08:00
parent 94957dc361
commit 19907bccdc
102 changed files with 7188 additions and 186 deletions
@@ -1,5 +1,9 @@
import { NextResponse } from "next/server";
import { createSupabaseRouteClient } from "@/lib/supabase/server";
import { isConvexEnabled } from "@/lib/convex/enabled";
import { HttpError, requireAuthContext } from "@/lib/auth/authContext";
import { api } from "@/lib/convex/api";
import { getConvexHttpClient } from "@/lib/convex/server";
export const dynamic = "force-dynamic";
@@ -25,6 +29,32 @@ function makeExpiredDeletedAt(): string {
}
export async function POST(request: Request) {
if (isConvexEnabled()) {
let auth;
try {
auth = requireAuthContext();
} catch (err) {
if (err instanceof HttpError) {
return NextResponse.json({ error: "未登录" }, { status: err.status });
}
return NextResponse.json({ error: "未登录" }, { status: 401 });
}
const { workspaceId }: EmptyTrashPayload = await request.json().catch(() => ({}));
if (!workspaceId) {
return NextResponse.json({ error: "缺少 workspaceId" }, { status: 400 });
}
const client = getConvexHttpClient();
const res = await client.mutation(api.mediaAssets.emptyTrashByWorkspace, {
userId: auth.userId,
workspaceId,
expiredDeletedAt: makeExpiredDeletedAt(),
});
return NextResponse.json({ success: true, ...(res as any) });
}
const supabase = await createSupabaseRouteClient();
const {
data: { session },
@@ -85,4 +115,3 @@ export async function POST(request: Request) {
return NextResponse.json({ success: true, updated: assetIds.length });
}