eed0e630e6
chore: 删掉 17 个确认无人调用的端点(净 -472 行)
...
阶段 0 盘点时判为 CUT 的 17 条,当时只在代码里标了 DEPRECATED(2026-05-26),
没删。这次删掉:15 个视图类整体移除,2 条只删 URL。
## 为什么有两条只能删 URL
ProblemSetProblemAPI 和 ProblemSetProgressAPI **各有一条在用的路径**:
ProblemSetProblemAPI /problemset/<id>/problems 在用
/problemset/<id>/problems/<pid> 废弃
ProblemSetProgressAPI /problemset/progress 在用
/problemset/<id>/progress 废弃
删类会直接搞挂"看题单题目"和"加入题单"。清单里记的是**路径**不是视图类,
这个区别不看一眼就动手会出事。
## 核实过程
不敢只信清单 —— 今天已经因为"读过文档还是漏了盲点"栽过一次(前端 /api2 前缀
漏改 5 处)。所以:
1. 用 ast(不是正则)建「视图类 → 它的所有 URL」映射,判定哪些类的全部 URL
都废弃。正则版把 B 组算成 0 个,而我明知至少有 2 个 —— 那种"看起来干净"的
结果最危险。
2. DEPRECATED 检测最初往前多看一行,把上一条的行内注释算到了下一条头上,
于是 /hitokoto、/profile、/reset_password 被误判成废弃。这三个明显在用,
才发现范围错了。
3. 按端点字符串精确搜整个 ojnext(覆盖 http.get、原生 fetch、独立 axios、
模板插值),16/16 确认无调用。**并且用 5 个明确在用的端点反测了检测器本身** ——
未经验证的检测器报"全部无调用"是没有意义的。
## 验证
起本地 Django + PostgreSQL 实跑 33 条断言,全过:
- 保留的端点还能用(13 条,含那两个"类保留"的路径,加入题单确认真的成功)
- 删掉的端点确实 404(17 条)
- reverse() 也解析不到了(3 条)
`ruff check .` 全绿(顺手清掉 44 个因此变成未使用的 import)。
## 一个差点造成的意外
脚本无条件重写所有 urls.py,把 class_pk/ 和 message/ 下三个 **CRLF** 文件
静默转成了 LF —— 内容没变但整文件显示为改动。已原样恢复,最终 diff 是
纯删除,零意外改动。
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com >
2026-08-08 06:59:00 -06:00
fda7515263
refactor: 移除注册验证码,删掉 pillow
...
验证码只剩注册一处调用方,一并去掉。
- UserRegisterAPI 的校验、UserRegisterSerializer 的 captcha 字段、
发图的 captcha 路由
- utils/captcha/ 整个包删除,含 Menlo.ttc 和 timesbi.ttf 两个字体
- utils/shortcuts.py 的 img2base64(),唯一调用方是验证码视图
- 依赖删除 pillow(本地实测 PIL/ 5.9M + pillow.libs/ 14M)
注意:注册接口现在只有 SysOptions.allow_register 一个开关,没有限流,
throttling 目前只用在 SubmissionAPI 上。内网自用可以接受,站点若暴露到
公网需要补 IP 维度限流。
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com >
2026-08-05 23:48:00 -06:00
927f235537
refactor: 移除邮件功能
...
发信能力整体下线,唯一的调用方(忘记密码)前端也从来没接过。
- utils/shortcuts.py 删 send_email,连带四个 django.core.mail 相关 import
- account/tasks.py 整个删除,里面只有 send_email_async 一个 actor
- 删 ApplyResetPasswordAPI / ResetPasswordAPI 及其路由、serializer,
User.reset_password_token 和 reset_password_token_expire_time 两个
字段(account/0010)
- 删 SMTPAPI / SMTPTestAPI 及其路由、三个 SMTP serializer、
SysOptions.smtp_config
- account/templates/reset_password_email.html
options/0003 数据迁移删掉库里的 smtp_config 行:_init_option 会为每个
OptionKey 建行,key 从代码里去掉后它会变成孤儿,而且配过 SMTP 的话
value 里存着明文密码。
保留 ResetUserPasswordAPI(管理端直接重置密码,不发信,前端在用)和
User.email(注册要填)。
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com >
2026-08-05 23:17:48 -06:00
989b33d827
refactor: 移除 2FA 功能与三个冗余依赖
...
2FA 早已是死代码:TOTP 相关端点标注为前端未调用,前端唯一的
two_factor_auth 是硬编码 false,没有任何入口能打开它。
- 删除 TwoFactorAuthAPI、CheckTFARequiredAPI、_totp* 辅助函数、
TwoFactorAuthCodeSerializer 及各 serializer 的 tfa_code 字段
- 删除管理端写 two_factor_auth/tfa_token 的分支。登录已不再校验
TOTP,若保留写入路径,置 True 会变成静默的安全降级
- 删除 User.two_factor_auth / tfa_token 字段(迁移 0009)
- 移除 django-dbconn-retry:仅挂在 INSTALLED_APPS,代码零引用。
DATABASES 未配置 CONN_MAX_AGE(默认 0),本就没有持久连接需要
重连修复。要开持久连接用 Django 自带的 CONN_HEALTH_CHECKS
- requests 换成 httpx(openai 已经引入):删除废弃的
ReleaseNotesAPI,judge dispatcher 显式传 timeout=None 以保持
requests 原本的无超时行为,判题请求是同步等结果的
依赖净减 5 个:otpauth、qrcode、requests、charset-normalizer、
django-dbconn-retry
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com >
2026-08-05 23:00:45 -06:00
3a9ab83ba5
style: ruff format 全仓库
...
行宽 180 下把历史遗留的折行表达式合并,无语义改动。
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com >
2026-08-05 04:45:26 -06:00
10af0256b8
移除 OI 残留:UserProfile 的 oi_problems_status / total_score / add_score
...
判题不再写入 OI 相关状态后,UserProfile 上的 OI 字段永远为空/为 0:
- 删除 oi_problems_status、total_score 两列及 add_score() 方法
- ProfileProblemDisplayIDRefreshAPI 去掉 oi_problems 合并分支
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-07-04 11:40:45 -06:00
b28301bbb1
fix
2026-06-04 05:31:23 -06:00
f94d29cf93
feat: add Teacher Admin role to four-tier permission system
...
Introduces a four-tier role system: Regular User → Student Admin →
Teacher Admin → Super Admin. Teacher Admin can manage own contests,
problemsets, and view classroom data. Student Admin (renamed from Admin)
retains problem management only.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-06-02 18:13:33 -06:00
6ab2886f77
remove contest type
2026-05-26 23:10:27 -06:00
57c0572fd9
async
2026-05-26 21:25:26 -06:00
980b803517
feat: update all query filters to treat AST_CHECK_FAILED as accepted
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-05-25 20:45:15 -06:00
65c48437a9
fix
2026-05-24 20:44:02 -06:00
c466dfd3c6
change enum
2026-05-09 02:30:47 -06:00
0fd7dedea6
update deps
2026-05-05 07:23:59 -06:00
028ea6e5f9
fmt
2026-04-23 13:57:56 -06:00
c31145f76e
fix cache
2026-03-30 09:39:35 -06:00
94be33c7a2
add login summary
2026-01-18 20:10:46 +08:00
a6d76a64c4
重构用户权限
2025-09-25 18:41:23 +08:00
6e1e3ef0c6
新增AI分析
2025-09-24 01:02:29 +08:00
24f1a0372e
提交题目完成的排名
2025-09-21 19:11:18 +08:00
cec1eee4c6
fix
2025-05-15 21:07:38 +08:00
8f08e1a2aa
fix
2025-04-13 22:20:27 +08:00
84d253f5fc
fix
2025-04-13 22:04:35 +08:00
4fafdd278e
用户调查
2025-04-13 19:09:01 +08:00
47cf28eb67
添加最近提交
2025-04-13 16:48:40 +08:00
d7a0effaaa
活跃度使用题目解决数
2024-10-30 17:31:49 +08:00
yuetsh
1179428e20
去掉超管
2024-08-14 16:03:32 +08:00
yuetsh
749612002a
新增活跃度排名
2024-08-14 00:24:46 +08:00
yuetsh
4a69c3b8f5
use user limit instead of accpeted_number
2024-06-12 15:36:17 +08:00
yuetsh
81f128ba35
set minimal count of accepted_number for user rank
2024-06-12 15:08:30 +08:00
7a152d65a3
get what i want
2024-05-07 20:25:59 +08:00
Beichi-CHs
d4b3a42f94
fix flake8 standard problems
2021-11-18 12:56:16 +08:00
virusdefender
a5f0c8eb31
remove celery and use dramatiq
2019-03-11 17:59:24 +08:00
virusdefender
6b7654a0c3
update to django 2.0
2019-03-11 11:25:10 +08:00
virusdefender
29f75a011b
add export contest rank to csv
2018-05-06 04:25:53 +08:00
virusdefender
e843404c5f
sso api
2018-05-06 01:06:49 +08:00
virusdefender
5cb907fa94
strip space in qrcode
2018-04-25 21:26:32 +08:00
virusdefender
0a8cd6b541
fix typo
2017-12-26 21:22:04 +08:00
virusdefender
47da932a2b
new email template
2017-12-24 11:01:33 +08:00
zema1
417337c4d2
修复几处visible未过滤的问题
2017-12-15 20:54:30 +08:00
zema1
10ecb79152
fix admin update user real_name problem
2017-12-10 10:05:12 +08:00
zema1
fc35e5ed79
filter admin users in all rankings
2017-12-06 15:54:08 +08:00
zema1
cc857e65d9
add migrate script
2017-12-04 15:29:55 +08:00
virusdefender
00eb3b1967
add api to reset openapi appkey and related middleware
2017-11-25 22:31:04 +08:00
zema1
a87d73393d
补全account测试
2017-11-23 21:12:37 +08:00
zema1
ba9b609fe4
去掉更新displayID时的userid验证
2017-11-18 20:49:00 +08:00
zema1
727fbf48d8
添加contest ip限制api;
...
OI problem的AC,total count也算入profile了
2017-11-10 20:00:00 +08:00
zema1
48f65d1a14
fix error in refresh displayID
2017-11-09 11:21:41 +08:00
zema1
343eff1c51
admin修改username后update submissions;
...
problem id refresh api
2017-11-08 21:56:39 +08:00
zema1
70f52b6f27
用户名不区分大小写;
...
修复更新problem时的一些问题
2017-11-02 15:29:08 +08:00