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.
This commit is contained in:
咕谷酱
2025-08-22 22:03:51 +08:00
parent 1f40c6f70d
commit 6bcd8c1a21
11 changed files with 241 additions and 10 deletions

View File

@@ -89,7 +89,7 @@ class UserBase(UTCBaseModel, SQLModel):
is_restricted: bool = False
# blocks
cover: UserProfileCover = Field(
default=UserProfileCover(url="https://assets.ppy.sh/user-profile-covers/default.jpeg"),
default=UserProfileCover(url=""),
sa_column=Column(JSON),
)
beatmap_playcounts_count: int = 0
@@ -292,9 +292,9 @@ class UserResp(UserBase):
redis = get_redis()
u.is_online = await redis.exists(f"metadata:online:{obj.id}")
u.cover_url = (
obj.cover.get("url", "https://assets.ppy.sh/user-profile-covers/default.jpeg")
obj.cover.get("url", "")
if obj.cover
else "https://assets.ppy.sh/user-profile-covers/default.jpeg"
else ""
)
if "friends" in include: