chore(project): update metadata

This commit is contained in:
MingxuanGame
2025-08-17 06:04:10 +00:00
parent 11b8f799a0
commit 8fec2e2fa5
5 changed files with 200 additions and 52 deletions

View File

@@ -1,42 +0,0 @@
# 数据库迁移指南
## 连接
使用默认的环境变量(`DATABASE_URL`)连接,如果不存在会从 `alembic.ini` 里读取 `sqlalchemy.url`
## 创建迁移
修改数据库模型定义后,使用以下命令创建新的迁移脚本:
```bash
alembic revision --autogenerate -m "描述你的迁移"
```
请注意,以下修改操作无法生成自动迁移,请手动修改生成的迁移文件
- 修改表名
- 修改列名
- 匿名命名的约束
## 升级/回滚迁移
要应用所有未应用的迁移脚本,请运行:
```bash
alembic upgrade head
```
要升级/回滚版本,可以使用以下命令:
```bash
# 回滚一个版本
alembic downgrade -1
# 升级两个版本
alembic upgrade +2
# 回滚到最初版本
alembic downgrade base
# 升级到特定版本
alembic upgrade <revision>
```
详情参考:[alembic 文档](https://alembic.sqlalchemy.org/en/latest/tutorial.html).

182
README.en.md Normal file
View File

@@ -0,0 +1,182 @@
# g0v0-server
[简体中文](./README.md) | English
This is an osu! API server implemented with FastAPI + MySQL + Redis, supporting most features of osu! API v1, v2, and osu!lazer.
## Features
- **OAuth 2.0 Authentication**: Supports password and refresh token flows.
- **User Data Management**: Complete user information, statistics, achievements, etc.
- **Multi-game Mode Support**: osu! (RX, AP), taiko (RX), catch (RX), mania.
- **Database Persistence**: MySQL for storing user data.
- **Cache Support**: Redis for caching tokens and session information.
- **Multiple Storage Backends**: Supports local storage, Cloudflare R2, and AWS S3.
- **Containerized Deployment**: Docker and Docker Compose support.
## Quick Start
### Using Docker Compose (Recommended)
1. Clone the project
```bash
git clone https://github.com/GooGuTeam/g0v0-server.git
cd g0v0-server
```
2. Create a `.env` file
Please see the server configuration below to modify the .env file.
```bash
cp .env.example .env
```
3. Start the service
```bash
# Standard server
docker-compose -f docker-compose.yml up -d
# Enable osu!RX and osu!AP statistics (ppy-sb pp algorithm)
docker-compose -f docker-compose-osurx.yml up -d
```
4. Connect to the server from the game
Use a [custom osu!lazer client](https://github.com/GooGuTeam/osu), or use [LazerAuthlibInjection](https://github.com/MingxuanGame/LazerAuthlibInjection), and change the server settings to the server's address.
## Configuration
### Database Settings
| Variable Name | Description | Default Value |
|---|---|---|
| `MYSQL_HOST` | MySQL host address | `localhost` |
| `MYSQL_PORT` | MySQL port | `3306` |
| `MYSQL_DATABASE` | MySQL database name | `osu_api` |
| `MYSQL_USER` | MySQL username | `osu_api` |
| `MYSQL_PASSWORD` | MySQL password | `password` |
| `MYSQL_ROOT_PASSWORD` | MySQL root password | `password` |
| `REDIS_URL` | Redis connection string | `redis://127.0.0.1:6379/0` |
### JWT Settings
| Variable Name | Description | Default Value |
|---|---|---|
| `JWT_SECRET_KEY` | JWT signing key | `your_jwt_secret_here` |
| `ALGORITHM` | JWT algorithm | `HS256` |
| `ACCESS_TOKEN_EXPIRE_MINUTES` | Access token expiration time (minutes) | `1440` |
### Server Settings
| Variable Name | Description | Default Value |
|---|---|---|
| `HOST` | Server listening address | `0.0.0.0` |
| `PORT` | Server listening port | `8000` |
| `DEBUG` | Debug mode | `false` |
| `SERVER_URL` | Server URL | `http://localhost:8000` |
| `CORS_URLS` | Additional CORS allowed domain list (JSON format) | `[]` |
| `FRONTEND_URL` | Frontend URL, redirects to this URL when accessing URLs opened from the game. Empty means no redirection. | `(null)` |
### OAuth Settings
| Variable Name | Description | Default Value |
|---|---|---|
| `OSU_CLIENT_ID` | OAuth client ID | `5` |
| `OSU_CLIENT_SECRET` | OAuth client secret | `FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk` |
| `OSU_WEB_CLIENT_ID` | Web OAuth client ID | `6` |
| `OSU_WEB_CLIENT_SECRET` | Web OAuth client secret | `your_osu_web_client_secret_here` |
### SignalR Server Settings
| Variable Name | Description | Default Value |
|---|---|---|
| `SIGNALR_NEGOTIATE_TIMEOUT` | SignalR negotiation timeout (seconds) | `30` |
| `SIGNALR_PING_INTERVAL` | SignalR ping interval (seconds) | `15` |
### Fetcher Settings
The Fetcher is used to get data from the official osu! API using OAuth 2.0 authentication.
| Variable Name | Description | Default Value |
|---|---|---|
| `FETCHER_CLIENT_ID` | Fetcher client ID | `""` |
| `FETCHER_CLIENT_SECRET` | Fetcher client secret | `""` |
| `FETCHER_SCOPES` | Fetcher scopes | `public` |
### Log Settings
| Variable Name | Description | Default Value |
|---|---|---|
| `LOG_LEVEL` | Log level | `INFO` |
### Sentry Settings
| Variable Name | Description | Default Value |
|---|---|---|
| `SENTRY_DSN` | Sentry DSN, empty to disable Sentry | `(null)` |
### Game Settings
| Variable Name | Description | Default Value |
|---|---|---|
| `ENABLE_RX` | Enable RX mod statistics | `false` |
| `ENABLE_AP` | Enable AP mod statistics | `false` |
| `ENABLE_ALL_MODS_PP` | Enable PP calculation for all mods | `false` |
| `ENABLE_SUPPORTER_FOR_ALL_USERS` | Enable supporter status for all new users | `false` |
| `ENABLE_ALL_BEATMAP_LEADERBOARD` | Enable leaderboards for all beatmaps | `false` |
| `ENABLE_ALL_BEATMAP_PP` | Allow any beatmap to grant PP | `false` |
| `SUSPICIOUS_SCORE_CHECK` | Enable suspicious score check (star>25 & acc<80 or pp>2300) | `true` |
| `SEASONAL_BACKGROUNDS` | List of seasonal background URLs | `[]` |
### Storage Service Settings
Used for storing replay files, avatars, and other static assets.
| Variable Name | Description | Default Value |
|---|---|---|
| `STORAGE_SERVICE` | Storage service type: `local`, `r2`, `s3` | `local` |
| `STORAGE_SETTINGS` | Storage service configuration (JSON format), see below for configuration | `{"local_storage_path": "./storage"}` |
## Storage Service Configuration
### Local Storage (Recommended for development)
Local storage saves files to the server's local filesystem, suitable for development and small-scale deployments.
```bash
STORAGE_SERVICE="local"
STORAGE_SETTINGS='{"local_storage_path": "./storage"}'
```
### Cloudflare R2 Storage (Recommended for production)
```bash
STORAGE_SERVICE="r2"
STORAGE_SETTINGS='{
"r2_account_id": "your_cloudflare_account_id",
"r2_access_key_id": "your_r2_access_key_id",
"r2_secret_access_key": "your_r2_secret_access_key",
"r2_bucket_name": "your_bucket_name",
"r2_public_url_base": "https://your-custom-domain.com"
}'
```
### AWS S3 Storage
```bash
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-domain.com"
}'
```
> **Note**: In a production environment, be sure to change the default keys and passwords!
### Updating the Database
Refer to the [Database Migration Guide](https://github.com/GooGuTeam/g0v0-server/wiki/Migrate-Database)
## License
MIT License
## Contributing
The project is currently in a state of rapid iteration. Issues and Pull Requests are welcome!
## Discussion
- Discord: https://discord.gg/AhzJXXWYfF
- QQ Group: `1059561526`

View File

@@ -1,6 +1,8 @@
# osu! API 模拟服务器
# g0v0-server
这是一个使用 FastAPI + MySQL + Redis 实现的 osu! API 模拟服务器,提供了完整的用户认证和数据管理功能。
[English](./README.en.md) | 简体中文
这是一个使用 FastAPI + MySQL + Redis 实现的 osu! API 模拟服务器,支持 osu! API v1, v2 和 osu!lazer 的绝大部分功能。
## 功能特性
@@ -18,8 +20,8 @@
1. 克隆项目
```bash
git clone https://github.com/GooGuTeam/osu_lazer_api.git
cd osu_lazer_api
git clone https://github.com/GooGuTeam/g0v0-server.git
cd g0v0-server
```
2. 创建 `.env` 文件
@@ -168,7 +170,7 @@ STORAGE_SETTINGS='{
### 更新数据库
参考[数据库迁移指南](./MIGRATE_GUIDE.md)
参考[数据库迁移指南](https://github.com/GooGuTeam/g0v0-server/wiki/Migrate-Database)
## 许可证
@@ -176,4 +178,9 @@ MIT License
## 贡献
欢迎提交 Issue 和 Pull Request
项目目前处于快速迭代状态,欢迎提交 Issue 和 Pull Request
## 参与讨论
- QQ 群:`1059561526`
- Discord: https://discord.gg/AhzJXXWYfF

View File

@@ -66,8 +66,8 @@ if settings.sentry_dsn is not None:
)
app = FastAPI(
title="osu! API 模拟服务器",
version="1.0.0",
title="g0v0-server",
version="0.1.0",
lifespan=lifespan,
description=desc,
)

View File

@@ -1,7 +1,7 @@
[project]
name = "osu-lazer-api"
name = "g0v0-server"
version = "0.1.0"
description = "Add your description here"
description = "3rd-party osu!lazer server which supports the latest osu!lazer."
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
@@ -30,6 +30,7 @@ dependencies = [
"sqlmodel>=0.0.24",
"uvicorn[standard]>=0.24.0",
]
authors = ["GooGuTeam"]
[tool.ruff]
line-length = 88