fix: 恢复本地 Convex Auth 链路
- 修复 desktop 脚本在 Linux 下优先使用后端虚拟环境可执行文件 - 移除 Convex Auth 的本地密钥兜底,回到真实 deployment env - 首页未登录时先跳转 /auth,避免根路由直接触发 workspace 初始化失败
This commit is contained in:
@@ -2,6 +2,7 @@ import { redirect } from "next/navigation";
|
||||
import { isConvexEnabled } from "@/lib/convex/enabled";
|
||||
import { getAuthedConvexClient } from "@/lib/convex/route";
|
||||
import { api } from "@/lib/convex/api";
|
||||
import { convexAuthNextjsToken } from "@convex-dev/auth/nextjs/server";
|
||||
|
||||
function makeId(): string {
|
||||
return typeof crypto.randomUUID === "function"
|
||||
@@ -14,6 +15,11 @@ export default async function Home() {
|
||||
redirect("/auth");
|
||||
}
|
||||
|
||||
const token = await convexAuthNextjsToken();
|
||||
if (!token) {
|
||||
redirect("/auth");
|
||||
}
|
||||
|
||||
const { auth, client } = await getAuthedConvexClient();
|
||||
|
||||
const { activeWorkspaceId } = await client.mutation(api.workspaces.ensureDefaultWorkspace, {
|
||||
|
||||
Reference in New Issue
Block a user