Commit Graph

632 Commits

Author SHA1 Message Date
MingxuanGame
96d96ddcd3 chore(merge): merge #53
## Removed

- SignalR server
- `msgpack_lazer_api`
- Unused services

## Changed

- Move once tasks and scheduled tasks into `app.tasks`
- Improve Logs
  - Yellow: Tasks
  - Blue: Services
  - Magenta: Fetcher
  - Dark green: Uvicorn
  - Red: System
  - `#FFC1C1`: Normal
- Redis: use multiple logical databases
  - db0: general cache (`redis_client`)
  - db1: message cache (`redis_message_client`)
  - db2: binary storage (`redis_binary_client`)
  - db3: rate limiting (`redis_rate_limit_client`)
- API: move user page API (`/api/v2/users/{user_id}/page`, `/api/v2/me/validate-bbcode`) into private APIs (`/api/private/user/page`, `/api/private/user/validate-bbcode`)
- Remove `from __future__ import annotations` to avoid `ForwardRef` problems
- Assets Proxy: use decorators to simplify code
- Ruff: add rules
- API Router: use Annotated-style dependency injections.
- Database: rename filenames to easily find the model

## Documents

- CONTRIBUTING.md
- AGENTS.md
- copilot-instructions.md
2025-10-04 16:37:40 +08:00
MingxuanGame
d1d2bd55a0 fix(security): raise RuntimeError for unset jwt_secret_key to enhance server safety 2025-10-04 08:04:23 +00:00
MingxuanGame
1163a93053 refactor(scores): rename models of score to match with filename 2025-10-04 08:01:38 +00:00
MingxuanGame
80ba65c746 docs(dev): add guides for authorization 2025-10-04 07:49:35 +00:00
MingxuanGame
9fe493a12e refactor(cache): remove unused cache management and monitoring endpoints 2025-10-04 07:35:58 +00:00
MingxuanGame
470e8b3c06 fix(beatmapset): update cursor type of SearchBeatmapsetsResp to support string values 2025-10-04 07:35:35 +00:00
MingxuanGame
00f53f0dc0 feat(beatmap): add asset_proxy_response decorator to beatmap lookup endpoints 2025-10-04 07:32:35 +00:00
MingxuanGame
238cb96c12 refactor(settings): remove unused user_cache_concurrent_limit field 2025-10-04 06:58:51 +00:00
MingxuanGame
ca7c74f709 refactor(project): remove useless getattr 2025-10-04 06:43:55 +00:00
MingxuanGame
c6058eb0d8 docs(dev): update contribution guide & agent instructions 2025-10-04 06:10:40 +00:00
MingxuanGame
216d3ab3bf feat(redis): refactor Redis configuration to use multiple logical databases
- Updated default REDIS_URL to remove explicit /0 suffix
- Added dedicated Redis clients:
  - db0: general cache (redis_client)
  - db1: message cache (redis_message_client)
  - db2: binary storage (redis_binary_client)
  - db3: rate limiting (redis_rate_limit_client)
- Updated configuration, Docker files, and main startup lifecycle accordingly
- Replaced `get_redis()` usage in notification server with `redis_message_client`
2025-10-04 05:39:59 +00:00
MingxuanGame
c2bfafc67a refactor(message): replace synchronous Redis client with asynchronous client 2025-10-04 05:26:37 +00:00
MingxuanGame
21da83e4eb refactor(middleware): remove unused setup method 2025-10-04 05:09:31 +00:00
MingxuanGame
238520c577 chore(linter): make ruff happy 2025-10-04 05:01:05 +00:00
MingxuanGame
382c1721df chore(merge): merge branch 'main' into refactor/restruct-project 2025-10-04 04:58:22 +00:00
MingxuanGame
7c18fc5fb6 refactor(userpage): move APIs into g0v0 private API 2025-10-04 04:57:24 +00:00
MingxuanGame
2bfde24b84 fix(log): fix typing & exception logs 2025-10-03 17:27:47 +00:00
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