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
@@ -3,6 +3,9 @@ import { createSupabaseRouteClient } from "@/lib/supabase/server";
import { promises as fs } from "fs";
import path from "path";
import { getDocumentsBaseDir, getLegacyMindmapsBaseDir } from "@/lib/server/local-paths";
import { isConvexEnabled } from "@/lib/convex/enabled";
import { getAuthedConvexClient } from "@/lib/convex/route";
import { api } from "@/lib/convex/api";
const defaultMindmapData = {
data: { text: "中心主题" },
@@ -40,6 +43,18 @@ export async function GET(
{ params }: { params: Promise<{ docId: string }> },
) {
const { docId: id } = await params;
if (isConvexEnabled()) {
const { auth, client } = getAuthedConvexClient();
const mindmapId = `legacy-${id}`;
const res = await client.query(api.mindmaps.get, {
userId: auth.userId,
docId: id,
mindmapId,
});
return NextResponse.json({ data: res?.data ?? defaultMindmapData, source: "convex" });
}
const supabase = await createSupabaseRouteClient();
const {
data: { session },
@@ -89,6 +104,20 @@ export async function POST(
{ params }: { params: Promise<{ docId: string }> },
) {
const { docId: id } = await params;
if (isConvexEnabled()) {
const { auth, client } = getAuthedConvexClient();
const mindmapId = `legacy-${id}`;
const { data } = await request.json();
const result = await client.mutation(api.mindmaps.put, {
userId: auth.userId,
docId: id,
mindmapId,
data: data ?? defaultMindmapData,
});
return NextResponse.json({ ok: true, ...(result ?? {}) });
}
const supabase = await createSupabaseRouteClient();
const {
data: { session },
@@ -130,6 +159,18 @@ export async function DELETE(
{ params }: { params: Promise<{ docId: string }> },
) {
const { docId: id } = await params;
if (isConvexEnabled()) {
const { auth, client } = getAuthedConvexClient();
const mindmapId = `legacy-${id}`;
const result = await client.mutation(api.mindmaps.softDelete, {
userId: auth.userId,
docId: id,
mindmapId,
});
return NextResponse.json({ ok: true, ...(result ?? {}) });
}
const supabase = await createSupabaseRouteClient();
const {
data: { session },