feat(设置): 能查出并删掉没人用的图片,编辑器里删掉的图和换下来的头像都算
Deploy / deploy (push) Canceled after 0s

编辑器里删图、学生换头像都只改库不删文件,盘上越积越多。设置页加「没人用的图片」,
点「查一下」才扫(要扫整个库,不在进页面时跑),按编辑器插图 / 头像分两组,
缩略图可点开,单张删或整组删(先确认)。

判定宁可多留:扫库里每张表的每个文本列,文件名在哪儿出现过都算在用(老域名、
markdown 写法都认,不分大小写);只看 png/jpg/gif/bmp,目录里的 mp4 不碰;
一天内传的不算(可能还在编辑器里没保存);库里一张图都没提到时什么也不列(多半连错了库);
删之前重新扫一遍。服务器和机房图片目录各一份,要各清各的。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-20 20:50:02 +08:00
1 parent 4000b3a9f0
commit e3c0507d41
5 files changed
+274 -1

No files matched your search

+11
View File
@@ -361,6 +361,16 @@ export const orphanTestCaseSchema = z.object({
createTime: z.number(),
})
/** 上传目录里、库里哪儿都没提到的图片:编辑器插的图(upload)和换下来的头像(avatar) */
export const orphanImageSchema = z.object({
folder: z.enum(["upload", "avatar"]),
name: z.string(),
url: z.string(),
/** 字节 */
size: z.number(),
createTime: z.number(),
})
/**
* 后台的用户排名列表。行的形状与 oj 侧榜单相同,但**没有 100 名的上限**:
* 这里不是榜单,是老师按班级前缀翻全班学生的管理视图,要能一直翻到底。
@@ -1130,6 +1140,7 @@ export type JudgeServer = z.infer<typeof judgeServerSchema>
export type DashboardInfo = z.infer<typeof dashboardInfoSchema>
export type JudgeServerList = z.infer<typeof judgeServerListSchema>
export type OrphanTestCase = z.infer<typeof orphanTestCaseSchema>
export type OrphanImage = z.infer<typeof orphanImageSchema>
export type AdminUserRank = z.infer<typeof adminUserRankSchema>
export type AdminAiReportListItem = z.infer<typeof adminAiReportListItemSchema>