31 Commits

Author SHA1 Message Date
咕谷酱
a8af03a464 Update .env.example 2025-10-12 02:52:22 +08:00
MingxuanGame
febc1d761f feat(user): implement user restrictions
## APIs Restricted for Restricted Users

A restricted user is blocked from performing the following actions, and will typically receive a `403 Forbidden` error:

*   **Chat & Notifications:**
    *   Sending any chat messages (public or private).
    *   Joining or leaving chat channels.
    *   Creating new PM channels.
*   **User Profile & Content:**
    *   Uploading a new avatar.
    *   Uploading a new profile cover image.
    *   Changing their username.
    *   Updating their userpage content.
*   **Scores & Gameplay:**
    *   Submitting scores in multiplayer rooms.
    *   Deleting their own scores (to prevent hiding evidence of cheating).
*   **Beatmaps:**
    *   Rating beatmaps.
    *   Taging beatmaps.
*   **Relationship:**
    *   Adding friends or blocking users.
    *   Removing friends or unblocking users.
*   **Teams:**
    *   Creating, updating, or deleting a team.
    *   Requesting to join a team.
    *   Handling join requests for a team they manage.
    *   Kicking a member from a team they manage.
*   **Multiplayer:**
    *   Creating or deleting multiplayer rooms.
    *   Joining or leaving multiplayer rooms.

## What is Invisible to Normal Users

*   **Leaderboards:**
    *   Beatmap leaderboards.
    *   Multiplayer (playlist) room leaderboards.
*   **User Search/Lists:**
    *   Restricted users will not appear in the results of the `/api/v2/users` endpoint.
    *   They will not appear in the list of a team's members.
*   **Relationship:**
    *   They will not appear in a user's friend list (`/friends`).
*   **Profile & History:**
    *   Attempting to view a restricted user's profile, events, kudosu history, or score history will result in a `404 Not Found` error, effectively making their profile invisible (unless the user viewing the profile is the restricted user themselves).
*   **Chat:**
    *   Normal users cannot start a new PM with a restricted user (they will get a `404 Not Found` error).
*   **Ranking:**
    *   Restricted users are excluded from any rankings.

### How to Restrict a User

Insert into `user_account_history` with `type=restriction`.

```sql
-- length is in seconds
INSERT INTO user_account_history (`description`, `length`, `permanent`, `timestamp`, `type`, `user_id`) VALUE ('some description', 86400, 0, '2025-10-05 01:00:00', 'RESTRICTION', 1);
```

---

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-06 11:10:25 +08:00
MingxuanGame
d19f82df80 chore(config): update example 2025-10-05 03:49:05 +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
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
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
4ayo
dbbabc8a15 Fixed .env.example file 2025-09-17 19:38:11 +02:00
MingxuanGame
f4e6c3a58f feat(tags): add minimum vote count for top tags & provide official tags
Add configuration: `BEATMAP_TAG_TOP_COUNT` to control the minimun vote count

Tips: this is 10 in osu-web, but private server doesn't have enough player so we use 2 as default value

Official tags see: https://osu.ppy.sh/wiki/Beatmap/Beatmap_tags
2025-09-14 05:21:48 +00:00
MingxuanGame
aa239a81fa feat(api): add rate limiting for API requests 2025-08-28 13:51:44 +00:00
MingxuanGame
8810eabfd3 deploy(docker): fix spectator server connot connect to database 2025-08-26 13:18:11 +08:00
MingxuanGame
debb4cb110 deploy(docker): update configuration 2025-08-26 13:18:11 +08:00
咕谷酱
6bcd8c1a21 Add asset proxy feature for resource URLs
Introduces asset proxy configuration and services to enable replacement of osu! resource URLs with custom domains. Updates API endpoints and caching services to process and rewrite resource URLs when asset proxy is enabled. Adds documentation and environment variables for asset proxy setup.
2025-08-22 22:03:51 +08:00
MingxuanGame
a0b76bbde3 docs(readme): update readme 2025-08-22 10:06:26 +00:00
咕谷酱
3bee2421fa 添加邮件验证 2025-08-22 08:19:12 +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
1251ba31a2 feat(score): support rx for taiko & catch 2025-08-15 05:59:21 +00:00
MingxuanGame
2c7c761a44 feat(score): add simple suspicious score check
TODO: use another lib to check the beatmap is whether suspicious or not
2025-08-14 07:44:13 +00:00
MingxuanGame
48b075d99d feat(config): add ENABLE_ALL_BEATMAP_PP 2025-08-14 07:01:41 +00:00
MingxuanGame
e7d5bcaf4b feat(server): add sentry to track error 2025-08-12 17:00:01 +00:00
MingxuanGame
b5afbed36c refactor(private-api): use OAuth to authorize 2025-08-12 16:04:19 +00:00
MingxuanGame
e70c197d65 feat(app): add frontend url configuration 2025-08-12 09:01:10 +00:00
MingxuanGame
6474a3d11e feat(server): add extra CORS origins url configuration 2025-08-12 05:33:24 +00:00
MingxuanGame
a488257acd feat(storage): expose a path to access local storage 2025-08-12 05:23:16 +00:00
MingxuanGame
cf3a6bbd21 feat(storage): support cloud storage 2025-08-12 03:58:06 +00:00
MingxuanGame
8acd4578e2 feat(private): initialize private API 2025-08-11 14:41:07 +00:00
MingxuanGame
6e71141146 feat(developer): support custom OAuth 2.0 client 2025-08-11 12:33:31 +00:00
MingxuanGame
2f54ac262c feat(misc): support seasonal backgrounds 2025-08-11 09:13:42 +00:00
MingxuanGame
314fbf827b deploy(docker): support deploy with docker 2025-08-10 08:28:01 +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