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>
This commit is contained in:
MingxuanGame
2025-10-26 21:10:36 +08:00
committed by GitHub
parent 8f4a9d5fed
commit 33f321952d
24 changed files with 3134 additions and 74 deletions

View File

@@ -18,6 +18,7 @@ from app.dependencies.scheduler import start_scheduler, stop_scheduler
from app.log import system_logger
from app.middleware.verify_session import VerifySessionMiddleware
from app.models.mods import init_mods, init_ranked_mods
from app.models.score import init_ruleset_version_hash
from app.router import (
api_v1_router,
api_v2_router,
@@ -37,6 +38,7 @@ from app.service.redis_message_system import redis_message_system
from app.tasks import (
calculate_user_rank,
create_banchobot,
create_custom_ruleset_statistics,
create_rx_statistics,
daily_challenge_job,
init_geoip,
@@ -61,8 +63,9 @@ async def lifespan(app: FastAPI): # noqa: ARG001
# init mods, achievements and performance calculator
init_mods()
init_ranked_mods()
init_ruleset_version_hash()
load_achievements()
init_calculator()
await init_calculator()
# init rate limiter
await FastAPILimiter.init(redis_rate_limit_client)
@@ -74,6 +77,7 @@ async def lifespan(app: FastAPI): # noqa: ARG001
# init game server
await create_rx_statistics()
await create_custom_ruleset_statistics()
await calculate_user_rank(True)
await daily_challenge_job()
await process_daily_challenge_top()