feat(client-verification): add client verification (#104)

New configurations:

- `CHECK_CLIENT_VERSION` enables the check (default=True)
- `CLIENT_VERSION_URLS` contains a chain of valid client hashes. [osu!](https://osu.ppy.sh/home/download) and [osu! GU](https://github.com/GooGuTeam/osu/releases) are valid by default. View [g0v0-client-versions](https://github.com/GooGuTeam/g0v0-client-versions) to learn how to support your own client.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
MingxuanGame
2026-01-11 16:30:25 +08:00
committed by GitHub
parent e5802aefbb
commit 8923d714a7
8 changed files with 252 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ from app.router.redirect import redirect_router
from app.router.v1 import api_v1_public_router
from app.service.beatmap_download_service import download_service
from app.service.beatmapset_update_service import init_beatmapset_update_service
from app.service.client_verification_service import init_client_verification_service
from app.service.email_queue import start_email_processor, stop_email_processor
from app.service.redis_message_system import redis_message_system
from app.service.subscribers.user_cache import user_online_subscriber
@@ -68,6 +69,9 @@ async def lifespan(app: FastAPI): # noqa: ARG001
load_achievements()
await init_calculator()
if settings.check_client_version:
await init_client_verification_service()
# init rate limiter
await FastAPILimiter.init(redis_rate_limit_client)