feat: add remote channels and richer notes

This commit is contained in:
lofyer
2026-08-09 15:48:52 +08:00
parent 417a9fccb6
commit 6c891f3522
69 changed files with 13012 additions and 499 deletions
+49
View File
@@ -0,0 +1,49 @@
import { z } from 'zod'
export const weixinBindingStatusSchema = z.enum([
'stopped',
'starting',
'pending',
'scanned',
'verification_required',
'connected',
'expired',
'failed'
])
export type WeixinBindingStatus = z.infer<
typeof weixinBindingStatusSchema
>
export const weixinBindingSnapshotSchema = z
.object({
status: weixinBindingStatusSchema,
qrPayload: z.string().min(1).max(4_096).optional(),
qrExpiresAt: z.string().datetime({ offset: true }).optional(),
accountDisplay: z.string().trim().min(1).max(64).optional(),
detail: z.string().trim().min(1).max(512).optional()
})
.strict()
export type WeixinBindingSnapshot = z.infer<
typeof weixinBindingSnapshotSchema
>
export const weixinVerificationInputSchema = z
.object({
code: z
.string()
.trim()
.min(1)
.max(32)
.regex(/^[0-9]+$/u, '')
})
.strict()
export type WeixinVerificationInput = z.infer<
typeof weixinVerificationInputSchema
>
export function weixinAccountDisplay(value: string): string | undefined {
const normalized = value.trim()
return normalized
? `微信用户 ****${normalized.slice(-4)}`
: undefined
}