refactor(api): simplify instance listing response and add running status

Remove sensitive information from instance listing response for all users and add isRunning field
Fix backend to prevent starting already running frpc instances
This commit is contained in:
2026-03-25 21:50:52 +08:00
parent 92a0e24db7
commit 25f88249c2
3 changed files with 11 additions and 62 deletions
+4 -35
View File
@@ -1138,7 +1138,7 @@ X-Timestamp: 1704067200000
| X-Token | string | Yes | Authentication token |
| X-Timestamp | int64 | Yes | Client timestamp in milliseconds |
**Response (admin/superuser):**
**Response:**
```json
{
"success": true,
@@ -1147,33 +1147,9 @@ X-Timestamp: 1704067200000
{
"instanceID": 1,
"name": "my_frpc",
"serverAddr": "127.0.0.1",
"serverPort": "7000",
"auth.method": "token",
"bootAtStart": true,
"runUser": "root",
"configPath": "./configs/superfrpc_user_my_frpc.toml",
"createdAt": "2024-01-01T00:00:00Z",
"createdBy": "admin"
}
]
}
```
**Response (visitor):**
```json
{
"success": true,
"message": "instances retrieved successfully",
"data": [
{
"instanceID": 1,
"name": "my_frpc",
"bootAtStart": true,
"runUser": "root",
"configPath": "./configs/superfrpc_user_my_frpc.toml",
"createdAt": "2024-01-01T00:00:00Z",
"createdBy": "admin"
"createdBy": "admin",
"isRunning": true
}
]
}
@@ -1183,16 +1159,9 @@ X-Timestamp: 1704067200000
|-------|------|-------------|
| instanceID | int | Instance ID |
| name | string | Instance name |
| serverAddr | string | frps server address (admin/superuser only) |
| serverPort | string | frps server port (admin/superuser only) |
| auth.method | string | Authentication method (admin/superuser only) |
| bootAtStart | bool | Auto-start on system boot |
| runUser | string | User to run the frpc instance as |
| configPath | string | Path to the configuration file |
| createdAt | string | Instance creation time (ISO 8601 format) |
| createdBy | string | Username of the user who created this instance |
> Note: Visitor users do not see sensitive information (serverAddr, serverPort, auth.method).
| isRunning | bool | Instance running status: true (running) or false (stopped) |
---