Commit Graph

715 Commits

Author SHA1 Message Date
MingxuanGame
dfd656f2fb style(project): remove from __future__ import annotations 2025-10-03 17:15:41 +00:00
MingxuanGame
046f894407 refactor(assets_proxy): use decorators to simplify code 2025-10-03 17:12:28 +00:00
MingxuanGame
d490239f46 chore(linter): update ruff rules 2025-10-03 15:46:53 +00:00
MingxuanGame
b10425ad91 refactor(service): remove unused services 2025-10-03 13:40:18 +00:00
MingxuanGame
1e775c9a36 fix(log): don't show traceback in log 2025-10-03 13:25:31 +00:00
MingxuanGame
0d9019c6cc refactor(signalr): remove SignalR server & msgpack_lazer_api
Maybe we can make `msgpack_lazer_api` independent?
2025-10-03 13:20:12 +00:00
MingxuanGame
d23f32f08d refactor(log): refactor the whole project
format: {time:YYYY-MM-DD HH:mm:ss} [{level}] | {name} | {message}
{name} is:
- Uvicorn: log from uvicorn server (#228B22)
- Service: log from class of `app.service` (blue)
- Fetcher: log from fetchers (magenta)
- Task: log from `app.tasks` (#FFD700)
- System: log from `system_logger` (red)
- Normal: log from `log(name)` (#FFC1C1)
- Default: the module name of caller

if you are writing services or tasks, you can just call `logger.`, we will pack it with name `Service` or `Task`
if you want to print fetcher logs, system-related logs, or normal logs, use `logger = (fetcher_logger / system_logger / log)(name)`
2025-10-03 11:53:05 +00:00
MingxuanGame
fce88272b5 refactor(task): move schedulers and startup/shutdown task into tasks directory 2025-10-03 10:15:22 +00:00
MingxuanGame
56fcc84196 fix(beatmapset): don't store genre and language into database 2025-10-03 16:57:56 +08:00
MingxuanGame
afd5018bcd refactor(log): add prefix for fetcher and services 2025-10-03 08:22:41 +00:00
MingxuanGame
346c2557cf refactor(api): use Annotated-style dependency injection 2025-10-03 05:41:31 +00:00
MingxuanGame
e6b60c54bd fix(migrations): add default for refresh_token_expires_at to avoid tokens are cleaned 2025-10-03 12:16:12 +08:00
MingxuanGame
37b4eadf79 refactor(database): rename filename to find the models by table name easily 2025-10-03 03:33:47 +00:00
MingxuanGame
40670c094b feat(auth): support trusted device (#52)
New API to maintain sessions and devices:

- GET /api/private/admin/sessions
- DELETE /api/private/admin/sessions/{session_id}
- GET /api/private/admin/trusted-devices
- DELETE /api/private/admin/trusted-devices/{device_id}

Auth:

web clients request `/oauth/token` and `/api/v2/session/verify` with `X-UUID` header to save the client as trusted device.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-03 11:26:43 +08:00
MingxuanGame
f34ed53a55 fix(beatmap): fix beatmap.beatmapset is None when it from from_resp 2025-10-02 16:41:40 +00:00
MingxuanGame
2e1d922f59 fix(session): fix wrong usages of with_db 2025-10-02 15:26:54 +00:00
MingxuanGame
9a77c8d246 feat(beatmapset): use https://catboy.best as global downloading service 2025-10-02 14:50:36 +00:00
MingxuanGame
e57702073f fix(sync): some logs have no color 2025-10-02 14:38:26 +00:00
MingxuanGame
f31056ced3 perf(score): divide score processing into small parts and make them run in background
resolve #47
2025-10-02 14:30:57 +00:00
MingxuanGame
bb1c09f4fd feat(beatmapset): sort based on time 2025-10-02 09:28:04 +00:00
MingxuanGame
7deb328b09 feat(beatmapset): enhance jitter calculation for too-long next sync time 2025-10-02 09:26:28 +00:00
MingxuanGame
5ff6708781 feat(beatmapset): add error handling for missing beatmapset additions 2025-10-02 08:07:05 +00:00
MingxuanGame
6252e04253 feat(beatmapset): add mechanism to prevent duplicate missing beatmapset additions 2025-10-02 07:37:33 +00:00
MingxuanGame
3f6776847e feat(beatmap,score): update beatmaps from Bancho & deleting scores (#50)
New API:

- DELETE /api/private/score/{score_id}: delete a score
- POST /api/private/beatmapsets/{beatmapset_id}/sync: request for syncing a beatmapset

New configuration:

- OLD_SCORE_PROCESSING_MODE
2025-10-02 13:36:09 +08:00
MingxuanGame
860ebe9fa9 feat(mods): configure ranked mods by file (#49) 2025-09-30 20:47:04 +08:00
MingxuanGame
017b058e63 chore(linter): make linter happy 2025-09-30 07:57:08 +00:00
咕谷酱
0f637446df Update audio_proxy.py 2025-09-29 21:33:29 +08:00
咕谷酱
4017f2af73 fix:修复音频代理缓存报错 2025-09-29 21:22:06 +08:00
咕谷酱
bc6553f143 Merge pull request #46 from GooGuTeam/totp-fix
Totp fix
2025-09-24 03:19:23 +08:00
咕谷酱
3a434ee02c 修复部分报错 2025-09-24 03:04:09 +08:00
咕谷酱
86c7bbb74e 优化验证 2025-09-24 02:08:13 +08:00
咕谷酱
8054281b15 添加防止重放攻击 2025-09-24 00:35:57 +08:00
咕谷酱
953f33be4f fix ranking total 0 2025-09-24 00:29:32 +08:00
咕谷酱
99d6af1c1f 修复邮件验证部分问题 2025-09-23 22:13:15 +08:00
咕谷酱
7d6eeae073 添加音频代理 2025-09-23 03:32:30 +08:00
咕谷酱
884a4cad2c 添加音频代理 2025-09-23 03:28:13 +08:00
咕谷酱
79805c2858 Update ranking.py 2025-09-23 02:37:04 +08:00
咕谷酱
0cd10bc543 修复排行榜返回用户数量问题 2025-09-23 02:36:20 +08:00
咕谷酱
bb06643de8 fix error 2025-09-23 01:56:50 +08:00
咕谷酱
f8e5fdc08e 添加排行榜/战队 total字段 2025-09-23 01:54:00 +08:00
咕谷酱
edbf01daa1 添加谱面查询缓存 2025-09-23 01:34:43 +08:00
MingxuanGame
1527e23b43 feat(session-verify): 添加 TOTP 支持 (#34)
* chore(deps): add pyotp

* feat(auth): implement TOTP verification

feat(auth): implement TOTP verification and email verification services

- Added TOTP keys management with a new database model `TotpKeys`.
- Introduced `EmailVerification` and `LoginSession` models for email verification.
- Created `verification_service` to handle email verification logic and TOTP processes.
- Updated user response models to include session verification methods.
- Implemented routes for TOTP creation, verification, and fallback to email verification.
- Enhanced login session management to support new location checks and verification methods.
- Added migration script to create `totp_keys` table in the database.

* feat(config): update config example

* docs(totp): complete creating TOTP flow

* refactor(totp): resolve review

* feat(api): forbid unverified request

* fix(totp): trace session by token id to avoid other sessions are forbidden

* chore(linter): make pyright happy

* fix(totp): only mark sessions with a specified token id
2025-09-21 19:50:11 +08:00
MingxuanGame
7b4ff1224d style(genereator): fix alias style 2025-09-21 11:25:06 +00:00
MingxuanGame
ccab7bc584 ci(genereator): fix ci 2025-09-21 11:21:20 +00:00
MingxuanGame
509f759b1a feat(config): add docs & auto-generated document 2025-09-21 11:17:46 +00:00
MingxuanGame
bef303cc93 fix(ranking): missing arguments when calling get_country_ranking 2025-09-21 05:28:28 +00:00
MingxuanGame
19c7303b83 docs(readme): update badge links in README 2025-09-21 05:24:45 +00:00
MingxuanGame
ca9a2abc6f fix(ranking): remove redirect to make client to access
Client will not attach `Authorization` to the redirected request
2025-09-21 05:23:06 +00:00
MingxuanGame
9e7409c9f7 deploy(docker): mapping newrelic.ini to container 2025-09-20 10:47:21 +00:00
MingxuanGame
ad78663ba0 chore(linter): make ruff happy 2025-09-20 10:41:15 +00:00