feat: add configurable payments and Gitea staging delivery
Staging Backend Quality Gate (push the reviewed main SHA to staging to auto-deploy) / validate (push) Failing after 5m10s
Staging Backend Quality Gate (push the reviewed main SHA to staging to auto-deploy) / publish-and-deploy (push) Has been skipped

Add database-backed administrators, configurable Alipay packages, idempotent payment settlement and platform reporting. Standardize Gitea workflows on the xiaoxin runner so reviewed staging commits are tested, packaged, and deployed by immutable image digest.
This commit is contained in:
linmeng
2026-07-27 20:19:05 +08:00
parent 9dc115509e
commit 1b8d6fcce6
37 changed files with 1257 additions and 28 deletions
+2 -7
View File
@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
import { z } from "zod";
import {
createAdminSupabaseClient,
isAdminEmail,
isAdminUser,
} from "@/lib/supabase/admin";
import {
generateRedeemCode,
@@ -11,7 +11,6 @@ import {
} from "@/lib/supabase/codes";
import {
isSupabaseConfigurationError,
SupabaseConfigurationError,
} from "@/lib/supabase/config";
import { createServerSupabaseClient } from "@/lib/supabase/server";
@@ -25,14 +24,10 @@ const createCodesSchema = z.object({
});
async function requireAdmin() {
if (!process.env.ADMIN_EMAILS?.trim()) {
throw new SupabaseConfigurationError(["ADMIN_EMAILS"]);
}
const supabase = await createServerSupabaseClient();
const { data: { user }, error } = await supabase.auth.getUser();
if (error || !user) return { response: NextResponse.json({ error: "请先登录" }, { status: 401 }) };
if (!isAdminEmail(user.email)) {
if (!(await isAdminUser(user))) {
return { response: NextResponse.json({ error: "无管理员权限" }, { status: 403 }) };
}
return { user };