Files
g0v0-server/.env.example
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

146 lines
3.8 KiB
Plaintext

# see https://github.com/GooGuTeam/g0v0-server/wiki/Configuration
# Database Settings
MYSQL_HOST="localhost"
MYSQL_PORT=3306
MYSQL_DATABASE="osu_api"
MYSQL_USER="osu_api"
MYSQL_PASSWORD="password"
MYSQL_ROOT_PASSWORD="password"
REDIS_URL="redis://127.0.0.1:6379"
# JWT Settings
# Use `openssl rand -hex 32` to generate a secure key
JWT_SECRET_KEY="your_jwt_secret_here"
ALGORITHM="HS256"
ACCESS_TOKEN_EXPIRE_MINUTES=1440
# OAuth Settings
OSU_CLIENT_ID=5
OSU_CLIENT_SECRET="FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk"
OSU_WEB_CLIENT_ID=6
# Use `openssl rand -hex 40` to generate a secure key
OSU_WEB_CLIENT_SECRET="your_osu_web_client_secret_here"
# Server Settings
HOST="0.0.0.0"
PORT=8000
DEBUG=false
CORS_URLS='[]'
SERVER_URL="http://localhost:8000"
FRONTEND_URL=
ENABLE_RATE_LIMIT=true
# Fetcher Settings
FETCHER_CLIENT_ID=""
FETCHER_CLIENT_SECRET=""
FETCHER_SCOPES="public"
# Logging Settings
LOG_LEVEL="INFO"
# Verification Settings
ENABLE_TOTP_VERIFICATION=true
TOTP_ISSUER="osu! server"
TOTP_SERVICE_NAME="g0v0! Lazer Server"
ENABLE_EMAIL_VERIFICATION=false
ENABLE_SESSION_VERIFICATION=false
ENABLE_MULTI_DEVICE_LOGIN=true
MAX_TOKENS_PER_CLIENT=10
DEVICE_TRUST_DURATION_DAYS=30
SMTP_SERVER="localhost"
SMTP_PORT=587
SMTP_USERNAME=""
SMTP_PASSWORD=""
FROM_EMAIL="noreply@example.com"
FROM_NAME="osu! server"
# Sentry Configuration
SENTRY_DSN=
# New Relic Configuration
NEW_RELIC_ENVIRONMENT=
# GeoIP Configuration
MAXMIND_LICENSE_KEY=""
GEOIP_DEST_DIR="./geoip"
GEOIP_UPDATE_DAY=1
GEOIP_UPDATE_HOUR=2
# Game Settings
ENABLE_RX=false
ENABLE_AP=false
ENABLE_SUPPORTER_FOR_ALL_USERS=false
ENABLE_ALL_BEATMAP_LEADERBOARD=false
ENABLE_ALL_BEATMAP_PP=false
SEASONAL_BACKGROUNDS='[]'
BEATMAP_TAG_TOP_COUNT=2
OLD_SCORE_PROCESSING_MODE=normal
# Beatmap Cache Settings
ENABLE_BEATMAP_PRELOAD=true
BEATMAP_CACHE_EXPIRE_HOURS=24
BEATMAPSET_CACHE_EXPIRE_SECONDS=3600
# Ranking Cache Settings
ENABLE_RANKING_CACHE=true
RANKING_CACHE_EXPIRE_MINUTES=10
RANKING_CACHE_REFRESH_INTERVAL_MINUTES=10
RANKING_CACHE_MAX_PAGES=20
RANKING_CACHE_TOP_COUNTRIES=20
# User Cache Settings
ENABLE_USER_CACHE_PRELOAD=true
USER_CACHE_EXPIRE_SECONDS=300
USER_SCORES_CACHE_EXPIRE_SECONDS=60
USER_BEATMAPSETS_CACHE_EXPIRE_SECONDS=600
USER_CACHE_MAX_PRELOAD_USERS=200
USER_CACHE_CONCURRENT_LIMIT=10
# Anti-cheat Settings
SUSPICIOUS_SCORE_CHECK=true
BANNED_NAME='["mrekk", "vaxei", "btmc", "cookiezi", "peppy", "saragi", "chocomint"]'
ALLOW_DELETE_SCORES=false
# Beatmap Syncing Settings
# POST `/api/private/beatmapsets/{beatmapset_id}/sync?immediate=true` to sync a beatmapset immediately
ENABLE_AUTO_BEATMAP_SYNC=false
BEATMAP_SYNC_INTERVAL_MINUTES=60
# Storage Settings
# Supported storage services: local, r2, s3
STORAGE_SERVICE="local"
# Local Storage Settings (when STORAGE_SERVICE=local)
# STORAGE_SETTINGS='{"local_storage_path": "./storage"}'
# Cloudflare R2 Storage Settings (when STORAGE_SERVICE=r2)
# STORAGE_SETTINGS='{
# "r2_account_id": "your_cloudflare_r2_account_id",
# "r2_access_key_id": "your_r2_access_key_id",
# "r2_secret_access_key": "your_r2_secret_access_key",
# "r2_bucket_name": "your_r2_bucket_name",
# "r2_public_url_base": "https://your-custom-domain.com"
# }'
# AWS S3 Storage Settings (when STORAGE_SERVICE=s3)
# STORAGE_SETTINGS='{
# "s3_access_key_id": "your_aws_access_key_id",
# "s3_secret_access_key": "your_aws_secret_access_key",
# "s3_bucket_name": "your_s3_bucket_name",
# "s3_region_name": "us-east-1",
# "s3_public_url_base": "https://your-custom
# Asset Proxy
ENABLE_ASSET_PROXY=true
CUSTOM_ASSET_DOMAIN=g0v0.top
ASSET_PROXY_PREFIX=assets-ppy
AVATAR_PROXY_PREFIX=a-ppy
BEATMAP_PROXY_PREFIX=b-ppy
# Spectator Server
# Other configurations see https://github.com/GooGuTeam/osu-server-spectator
SAVE_REPLAYS=0
REDIS_HOST=localhost
SHARED_INTEROP_DOMAIN=http://localhost:8000
SERVER_PORT=80