refactor: use managed official account avatars
CI / Typecheck, test & build (push) Successful in 56s
CI / Deploy to Cloudflare Workers (push) Successful in 1m1s

This commit is contained in:
2026-09-14 01:38:40 +08:00
parent 77c5535156
commit a2c1394946
3 changed files with 16 additions and 21 deletions
+16 -16
View File
@@ -50,7 +50,7 @@ export interface paths {
content: {
"application/json": {
/**
* @example all
* @example active
* @enum {string|null}
*/
state?: "active" | "archived" | "trashed" | "all" | null;
@@ -346,7 +346,7 @@ export interface paths {
content: {
"application/json": {
/**
* @example group_only
* @example public
* @enum {string|null}
*/
visibility?: "public" | "group_only" | null;
@@ -539,7 +539,7 @@ export interface paths {
*/
language_code?: string;
/**
* @example published
* @example awaiting_publish
* @enum {string}
*/
status?: "draft" | "awaiting_publish" | "published";
@@ -4357,7 +4357,7 @@ export interface paths {
/** @example architecto */
status?: string | null;
/**
* @example instant_accept
* @example scheduled_booking
* @enum {string|null}
*/
dispatch_mode?: "instant_accept" | "quote" | "scheduled_booking" | "manual_selection" | null;
@@ -4677,7 +4677,7 @@ export interface paths {
content: {
"application/json": {
/**
* @example sent
* @example expired
* @enum {string|null}
*/
status?: "sent" | "delivered" | "viewed" | "accepted" | "rejected" | "ignored" | "expired" | "taken_by_other" | null;
@@ -4876,7 +4876,7 @@ export interface paths {
*/
status?: "created" | "confirmed" | "started" | "consumed" | "paid" | "fulfilled" | "canceled" | null;
/**
* @example PAID
* @example UNPAID
* @enum {string|null}
*/
payment_status?: "UNPAID" | "PAID" | null;
@@ -5161,13 +5161,13 @@ export interface paths {
content: {
"application/json": {
/**
* @example inactive
* @example online
* @enum {string|null}
*/
status?: "offline" | "online" | "inactive" | "busy" | null;
/** @example true */
is_disabled?: boolean | null;
/** @example true */
/** @example false */
is_verified?: boolean | null;
/**
* @description Must be at least 1.
@@ -5452,12 +5452,12 @@ export interface paths {
content: {
"application/json": {
/**
* @example private
* @example public
* @enum {string|null}
*/
visibility?: "public" | "friends" | "private" | null;
/**
* @example blocked
* @example all
* @enum {string|null}
*/
status?: "blocked" | "visible" | "all" | null;
@@ -5786,7 +5786,7 @@ export interface paths {
content: {
"application/json": {
/**
* @example blocked
* @example pending
* @enum {string|null}
*/
status?: "pending" | "blocked" | "all" | null;
@@ -6381,7 +6381,7 @@ export interface paths {
q?: string | null;
/** @example null */
type?: string | null;
/** @example false */
/** @example true */
verified?: boolean | null;
/** @example false */
is_global?: boolean | null;
@@ -7880,9 +7880,9 @@ export interface paths {
* @example b
*/
q?: string | null;
/** @example true */
/** @example false */
status?: boolean | null;
/** @example true */
/** @example false */
is_robot?: boolean | null;
/**
* @description Must not be greater than 100 characters.
@@ -9960,7 +9960,7 @@ export interface paths {
content: {
"application/json": {
/**
* @example blocked
* @example all
* @enum {string|null}
*/
status?: "pending" | "blocked" | "all" | null;
@@ -10395,7 +10395,7 @@ export interface paths {
content: {
"application/json": {
/**
* @example web
* @example android
* @enum {string|null}
*/
platform?: "ios" | "android" | "web" | "desktop" | null;
-1
View File
@@ -469,7 +469,6 @@ export interface OfficialAccountPayload {
slug: string
name: string
description?: string | null
avatar_url?: string | null
owner_uid?: string | null
verified?: boolean
type: OfficialAccountType
@@ -22,7 +22,6 @@ const schema = z.object({
slug: z.string().trim().min(1, '请填写账号标识').max(100).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, '仅支持小写字母、数字和连字符'),
name: z.string().trim().min(1, '请填写显示名称').max(255),
description: z.string(),
avatar_url: z.union([z.literal(''), z.url('请输入有效的头像 URL')]),
owner_uid: z.union([z.literal(''), z.string().length(26, '用户 UID 必须为 26 个字符')]),
type: z.enum(['subscription', 'service', 'system']),
auto_reply_config: z.string().refine((value) => {
@@ -60,7 +59,6 @@ export function OfficialAccountEditSheet({ account, creating, onOpenChange, onSa
slug: values.slug.trim(),
name: values.name.trim(),
description: values.description.trim() || null,
avatar_url: values.avatar_url.trim() || null,
owner_uid: values.owner_uid.trim() || null,
type: values.type,
auto_reply_config: values.auto_reply_config.trim()
@@ -93,7 +91,6 @@ export function OfficialAccountEditSheet({ account, creating, onOpenChange, onSa
<Field label="账号类型"><Controller control={form.control} name="type" render={({ field }) => <Select value={field.value} onValueChange={field.onChange}><SelectTrigger><SelectValue /></SelectTrigger><SelectContent><SelectItem value="subscription"></SelectItem><SelectItem value="service"></SelectItem><SelectItem value="system"></SelectItem></SelectContent></Select>} /></Field>
<Field label="简介"><Textarea rows={3} {...form.register('description')} /></Field>
<Field label="所有者 UID" error={form.formState.errors.owner_uid?.message}><Input placeholder="留空表示平台所有" {...form.register('owner_uid')} /></Field>
<Field label="外部头像 URL" error={form.formState.errors.avatar_url?.message}><Input placeholder="可选;上传头像后将自动清除" {...form.register('avatar_url')} /></Field>
<Field label="上传头像" error={form.formState.errors.avatar?.message}><Input type="file" accept="image/png,image/jpeg,image/webp,image/gif,image/svg+xml" onChange={(event) => form.setValue('avatar', event.target.files?.[0], { shouldValidate: true })} /></Field>
<Field label="自动回复配置" error={form.formState.errors.auto_reply_config?.message}><Textarea className="font-mono text-xs" rows={7} placeholder='{"mode":"local","rules":[]}' {...form.register('auto_reply_config')} /></Field>
<Check control={form.control} name="verified" label="已认证" />
@@ -110,7 +107,6 @@ function defaults(account?: OfficialAccount | null): Values {
slug: account?.slug ?? '',
name: account?.name ?? '',
description: account?.description ?? '',
avatar_url: account?.avatar_path ? '' : account?.avatar_url ?? '',
owner_uid: account?.owner_uid ?? '',
type: account?.type ?? 'subscription',
auto_reply_config: account?.auto_reply_config ? JSON.stringify(account.auto_reply_config, null, 2) : '',