Commit Graph

32 Commits

Author SHA1 Message Date
MingxuanGame
dfd656f2fb style(project): remove from __future__ import annotations 2025-10-03 17:15:41 +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
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
017b058e63 chore(linter): make linter happy 2025-09-30 07:57:08 +00:00
咕谷酱
86c7bbb74e 优化验证 2025-09-24 02:08:13 +08:00
咕谷酱
8054281b15 添加防止重放攻击 2025-09-24 00:35:57 +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
86c6c291e4 chore(dev): update dev environment 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
咕谷酱
616656638d Improve JWT claims and chat channel reliability
Adds standard JWT claims (audience and issuer) to access tokens and updates config for these fields. Refactors multiplayer room chat channel logic to ensure reliable user join/leave with retry mechanisms, improves error handling and cleanup, and ensures host is correctly added as a participant. Updates Docker entrypoint for better compatibility and connection handling, modifies Docker Compose and Nginx config for improved deployment and proxy header forwarding.
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
MingxuanGame
65bd7ca7d0 fix(auth): add random string to avoid same token 2025-08-19 13:43:54 +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
MingxuanGame
3409e9dc79 feat(user): support disallowed name 2025-08-17 06:14:45 +00:00
MingxuanGame
6e71141146 feat(developer): support custom OAuth 2.0 client 2025-08-11 12:33:31 +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
1be3388524 feat(log): add logger 2025-07-28 10:38:40 +00:00
MingxuanGame
f347b680b2 refactor(database): use asyncio 2025-07-25 20:43:50 +08:00
MingxuanGame
376d98ad5a feat(beatmap,beatmapset): get beatmap & beatmapset information by id 2025-07-25 17:01:01 +08:00
MingxuanGame
43404a7d51 Merge branch 'main' of https://github.com/GooGuTeam/osu_lazer_api 2025-07-24 20:50:00 +08:00
MingxuanGame
c43ca883a5 refactor(database): migrate to sqlmodel 2025-07-24 20:49:07 +08:00
jimmy-sketch
19ac477a8c fix: 修复访问授权问题 2025-07-24 13:41:01 +08:00
jimmy-sketch
6647e5cd04 fix: 将 app/ 下的所有代码中与sql相关的所有隐式类型转换替换为显式类型转换 2025-07-24 12:30:24 +08:00
MingxuanGame
7b5a50493a use uv & make lint happy 2025-07-23 18:03:30 +08:00
咕谷酱
c0246440f3 上传源码 2025-07-19 12:08:10 +08:00