feat(detector): 支持自定义黑名单

This commit is contained in:
chenjintang-shrimp
2025-08-15 13:20:19 +00:00
parent aed32824e8
commit 8204634a4e

View File

@@ -5,7 +5,6 @@ import math
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from app.config import settings from app.config import settings
from app.database.beatmap import BannedBeatmaps
from app.log import logger from app.log import logger
from app.models.beatmap import BeatmapAttributes from app.models.beatmap import BeatmapAttributes
from app.models.mods import APIMod from app.models.mods import APIMod
@@ -328,6 +327,8 @@ def slider_is_sus(hit_objects: list[HitObject]) -> bool:
def is_suspicious_beatmap(content: str) -> bool: def is_suspicious_beatmap(content: str) -> bool:
osufile = OsuFile(content=content.encode("utf-8-sig")).parse_file() osufile = OsuFile(content=content.encode("utf-8-sig")).parse_file()
engine = create_engine(settings.database_url) engine = create_engine(settings.database_url)
from app.database.beatmap import BannedBeatmaps
with Session(engine) as session: with Session(engine) as session:
banned_beatmap = session.exec( banned_beatmap = session.exec(
select(BannedBeatmaps).where( select(BannedBeatmaps).where(