Commit Graph

728 Commits

Author SHA1 Message Date
MingxuanGame
2519301690 chore(custom-ruleset): Update custom ruleset definitions (#63) 2025-10-26 21:22:17 +08:00
MingxuanGame
f6e2e8ed44 deploy(docker): update spectator image to support custom rulesets 2025-10-26 13:14:53 +00:00
MingxuanGame
33f321952d feat(custom-rulesets): support custom rulesets (#23)
* feat(custom_ruleset): add custom rulesets support

* feat(custom-ruleset): add version check

* feat(custom-ruleset): add LegacyIO API to get ruleset hashes

* feat(pp): add check for rulesets whose pp cannot be calculated

* docs(readme): update README to include support for custom rulesets

* fix(custom-ruleset): make `rulesets` empty instead of throw a error when version check is disabled

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore(custom-ruleset): apply the latest changes of generator

c891bcd159

and

e25041ad3b

* feat(calculator): add fallback performance calculation for unsupported modes

* fix(calculator): remove debug print

* fix: resolve reviews

* feat(calculator): add difficulty calculation checks

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-26 21:10:36 +08:00
MingxuanGame
8f4a9d5fed feat(fetcher): use client_credentials grant type to avoid missing refresh token (#62)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-25 20:01:50 +08:00
MingxuanGame
2c81e22749 feat(calculator): support generate PerformanceAttributes & DifficultyAttributes from JSON Schema (#59)
Prepare for custom rulesets.

Schema Genetator: https://github.com/GooGuTeam/custom-rulesets/tree/main/CustomRulesetMetadataGenerator

```bash
dotnet -- schemas path/to/rulesets -o schema.json
```

```bash
python scripts/generate_ruleset_attributes.py schema.json 
```
2025-10-25 19:10:53 +08:00
allcontributors[bot]
f792d146b5 docs(contributors): add 4aya as a contributor for ideas (#61)
Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: MingxuanGame <MingxuanGame@outlook.com>
2025-10-25 18:57:08 +08:00
MingxuanGame
07bf9864d2 docs(all-contributors): add initial contributors list 2025-10-19 18:29:11 +08:00
MingxuanGame
965c96d0b2 feat(config): add docs for matchmaking 2025-10-18 16:08:00 +00:00
咕谷酱
a4dbb9a167 feat(matchmaking): support matchmaking (#48) 2025-10-19 00:05:06 +08:00
MingxuanGame
b180d3f39d fix(config): add missing code-block end 2025-10-18 11:12:53 +00:00
MingxuanGame
8790ccad64 feat(pp-calculator): support other pp calculators (#57)
New configurations:

- CALCULATOR="rosu": specific pp calculator
- CALCULATOR_CONFIG='{}': argument passed through into calculator
2025-10-18 19:10:53 +08:00
MingxuanGame
563a30d28f chore(model): remove empty SignalR files 2025-10-12 17:09:35 +08:00
MingxuanGame
2b78920fed fix(recalculate-job): rename job id for recalculate_failed_beatmap 2025-10-12 16:16:50 +08:00
咕谷酱
de917b7456 Delete osu-web-master directory 2025-10-12 03:36:38 +08:00
咕谷酱
a10c07dc57 Align session verification logic with osu-web
Updated session verification method selection to match osu-web's State.php:36 logic, using SUPPORT_TOTP_VERIFICATION_VER for version checks and prioritizing TOTP when available. Added example environment files for osu-web-master to support local, dusk, and testing setups.
2025-10-12 03:34:38 +08:00
咕谷酱
0e2df8dfef Fix trusted_device flag inversion in session creation
Corrects the logic for the trusted_device parameter when creating login sessions by inverting its value. This ensures that the session accurately reflects whether the device is trusted or not.
2025-10-12 03:17:56 +08:00
咕谷酱
a8af03a464 Update .env.example 2025-10-12 02:52:22 +08:00
咕谷酱
73d25c7604 Add Cloudflare Turnstile verification to auth flows
Introduces Cloudflare Turnstile verification for registration, OAuth password grant, and password reset endpoints (excluding osu! client). Adds related configuration options and a new service for token validation. Also refactors password change logic to support TOTP or password-based verification, improving security for users with TOTP enabled.
2025-10-12 02:39:46 +08:00
咕谷酱
301130df02 Refactor SMTP config usage in EmailQueue
Move SMTP configuration retrieval from class initialization to method scope in send_email_by_smtp. This improves encapsulation and ensures the latest settings are used when sending emails.
2025-10-12 00:47:18 +08:00
咕谷酱
6731373ded Add MailerSend and template-based email verification
Introduced support for MailerSend as an email provider alongside SMTP, with configuration options in settings. Added Jinja2-based multi-language email templates for verification emails, and refactored the email sending logic to use these templates and support language selection based on user country code. Updated related services and API endpoints to pass country code and handle new response formats. Added dependencies for Jinja2 and MailerSend.
2025-10-12 00:36:47 +08:00
MingxuanGame
a32976857f feat(score): invalidate cache when pin/unpin/reorder scores 2025-10-08 06:12:12 +00:00
MingxuanGame
6af0f814aa fix(user): restricted users cannot see their recent activities and kudosu 2025-10-08 06:08:10 +00:00
MingxuanGame
45ed9e51a9 feat(team): add playmode, description, website and statistics 2025-10-08 05:46:17 +00:00
MingxuanGame
e2f3c5099f fix(sessions): cannot find current session 2025-10-08 05:24:52 +00:00
MingxuanGame
3dd74fc703 fix(password): fix transaction has begun 2025-10-08 05:20:05 +00:00
MingxuanGame
85ac57a584 fix(password): missing import 2025-10-08 05:11:38 +00:00
MingxuanGame
1d1221a740 fix(beatmapset): invalidate beatmapset and beatmap lookup caches after updates 2025-10-07 18:09:09 +00:00
MingxuanGame
b4e164faad fix(beatmapset): load beatmapset from database 2025-10-07 17:55:35 +00:00
MingxuanGame
c0575f3274 fix(beatmapset): handle 404 errors and fix qualified sync from add_missing_beatmapsets 2025-10-07 17:40:50 +00:00
MingxuanGame
c76d6163ac fix(sync): cannot qualified beatmapset 2025-10-07 17:05:33 +00:00
MingxuanGame
fa81f837a0 fix(score): don't unpin score 2025-10-07 15:53:04 +00:00
MingxuanGame
64e221c641 perf(beatmapset): optimize beatmap fetching 2025-10-07 15:27:06 +00:00
MingxuanGame
60049a777f feat(auth): support change password 2025-10-07 13:07:14 +00:00
MingxuanGame
95f7c010af fix(trusted-device): no location in response 2025-10-07 12:18:56 +00:00
MingxuanGame
10caa82320 feat(user-preference): add user preference support (#55)
APIs:

- GET `/api/private/user/preferences`: Get current user's preferences.
- PATCH `/api/private/user/preferences`: Modify current user's preferences. (body: Preferences)
- PUT `/api/private/user/preferences`: Overwrite current user's preferences. (body: Preferences)
- DELETE `/api/private/user/preferences`: Reset current user's preferences. (body: list[str])
  - body specifies the content to be reset. If body is empty, reset all preferences.

User:

- `User.g0v0_playmode`: show the special ruleset like `OSURX`, and custom rulesets in the future.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-06 20:57:17 +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
1db34bf5c5 feat(sync): add configuration to control syncing & support sync immediately by API 2025-10-05 03:44:46 +00:00
MingxuanGame
8884f8993c fix(beatmap): refresh current_user in batch_get_beatmaps response 2025-10-04 17:28:42 +00:00
MingxuanGame
bb4d454093 feat(recalculate): add CLI arguments for user and mode filtering in performance recalculation 2025-10-04 12:18:18 +00:00
MingxuanGame
6f522847ec fix(playcount): show the sum of all users' playcount in BeatmapResp/BeatmapsetResp 2025-10-04 10:50:33 +00:00
MingxuanGame
38671cd471 feat(user): implement /users/{user_id}/beatmaps-passed
close #9
2025-10-04 09:52:15 +00:00
MingxuanGame
6f48dd4575 fix(sync): handle 404 errors for missing beatmaps and beatmapsets 2025-10-04 08:58:05 +00:00
MingxuanGame
3f702dc5ec fix(auth): add API version check in login 2025-10-04 08:51:38 +00:00
MingxuanGame
6c23694061 fix(beatmap): refresh current user data in lookup_beatmap function 2025-10-04 08:43:48 +00:00
MingxuanGame
806dd819fb fix(ci): remove copy packages directory 2025-10-04 08:38:52 +00:00
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