Commit Graph

38 Commits

Author SHA1 Message Date
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
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
346c2557cf refactor(api): use Annotated-style dependency injection 2025-10-03 05:41:31 +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
咕谷酱
99d6af1c1f 修复邮件验证部分问题 2025-09-23 22:13:15 +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
f8535fdce4 feat(user): support login with any case of username & email 2025-08-26 11:39:55 +00:00
MingxuanGame
292e6b0eba chore(linter): make lint happy 2025-08-26 13:18:11 +08:00
pre-commit-ci[bot]
7625cd99f5 chore(deps): auto fix by pre-commit hooks 2025-08-26 13:18:11 +08:00
咕谷酱
8e6b462645 Refactor multiplayer room endpoints and add logging
Refactored the multiplayer room creation and user management endpoints in lio.py for improved modularity and validation. Added helper functions for user, room, and playlist validation, and enhanced error handling. In auth.py, added logging to output generated JWT tokens for better traceability.
2025-08-26 13:18:11 +08:00
MingxuanGame
9b00dbda28 refactor(project): use unified utcnow 2025-08-22 11:27:45 +00:00
MingxuanGame
598fcc8b38 refactor(project): make pyright & ruff happy 2025-08-22 08:21:52 +00:00
咕谷酱
0f9238c501 添加密码重置 2025-08-22 08:56:40 +08:00
咕谷酱
3bee2421fa 添加邮件验证 2025-08-22 08:19:12 +08:00
MingxuanGame
1c65b21bb9 refactor(app): update database code 2025-08-18 16:37:30 +00:00
MingxuanGame
86bea5d4b5 chore(lint): make ruff happy 2025-08-17 16:59:05 +00:00
咕谷酱
6e496a1123 add ip log 2025-08-18 00:23:57 +08:00
咕谷酱
de0c86f4a2 add geoip 2025-08-17 23:56:46 +08:00
MingxuanGame
3409e9dc79 feat(user): support disallowed name 2025-08-17 06:14:45 +00:00
MingxuanGame
24bfda4e0c fix(chat): resolve copilot's review 2025-08-16 15:49:22 +00:00
MingxuanGame
e1d42743d3 feat(chat): support BanchoBot 2025-08-16 10:31:46 +00:00
MingxuanGame
1251ba31a2 feat(score): support rx for taiko & catch 2025-08-15 05:59:21 +00:00
MingxuanGame
7817b7c59a feat(oauth): support client credentials grant 2025-08-13 14:12:29 +00:00
MingxuanGame
2fa6d6dd7e docs(api): add api docs 2025-08-12 08:40:27 +00:00
MingxuanGame
6e71141146 feat(developer): support custom OAuth 2.0 client 2025-08-11 12:33:31 +00:00
MingxuanGame
efc784d903 feat(score): support osu-rx & osu-ap & all beatmap leaderboard like osu.ppy.sb 2025-08-10 07:03:49 +00:00
MingxuanGame
f165ae5dc3 refactor(config): use pydantic-settings 2025-08-10 05:38:28 +00:00
MingxuanGame
9ce99398ab refactor(user): refactor user database
**Breaking Change**

用户表变为 lazer_users

建议删除与用户关联的表进行迁移
2025-07-30 16:17:09 +00:00
MingxuanGame
e1ce364ac9 feat(user): support search user 2025-07-28 14:18:43 +00:00
咕谷酱
80310d450b add Registration Interface 2025-07-28 19:41:57 +08:00
咕谷酱
130bcdcdc1 Add OAuth error return interface format 2025-07-26 23:48:48 +08:00
MingxuanGame
46c19dddc1 chore(pre-commit): add pre-commit 2025-07-25 20:46:52 +08:00
MingxuanGame
f347b680b2 refactor(database): use asyncio 2025-07-25 20:43:50 +08:00
MingxuanGame
c43ca883a5 refactor(database): migrate to sqlmodel 2025-07-24 20:49:07 +08:00
MingxuanGame
1655bb9f53 feat: 基础 SignalR 服务器支持 2025-07-24 18:45:08 +08:00
jimmy-sketch
6647e5cd04 fix: 将 app/ 下的所有代码中与sql相关的所有隐式类型转换替换为显式类型转换 2025-07-24 12:30:24 +08:00
MingxuanGame
52a8bd2c76 re-structure code 2025-07-23 18:25:04 +08:00