ops 订阅开通改为 Next.js 直连 Supabase,免去 VPS 鉴权链路

This commit is contained in:
2569718930@qq.com
2026-05-20 22:23:28 +08:00
parent cb625a2b0e
commit 2f0b496066
2 changed files with 171 additions and 10 deletions
@@ -25,6 +25,18 @@ export function runTests() {
path.join(projectRoot, "app", "api", "analytics", "events", "route.ts"),
"utf8",
);
const grantRouteSource = fs.readFileSync(
path.join(
projectRoot,
"app",
"api",
"ops",
"subscriptions",
"grant",
"route.ts",
),
"utf8",
);
const subscriptionsPageSource = fs.readFileSync(
path.join(
projectRoot,
@@ -84,4 +96,10 @@ export function runTests() {
subscriptionsPageSource.includes("/api/ops/subscriptions/extend"),
"ops manual subscription grant/extend must send the Supabase bearer token to avoid 401 when route cookies are stale",
);
assert(
grantRouteSource.includes("grantSubscriptionDirectly") &&
grantRouteSource.includes("res.status === 404") &&
grantRouteSource.includes('"status": "active"'),
"ops subscription grant route must fall back to direct Supabase grant when the VPS backend route is missing",
);
}