docs(api): update API documentation with new session listing endpoint

feat(session): add API endpoint to list active sessions
This commit is contained in:
2026-03-05 18:29:58 +08:00
parent e400cc1869
commit f07b89842a
2 changed files with 51 additions and 1 deletions
+50
View File
@@ -250,6 +250,55 @@ X-Timestamp: 1704067200000
---
## List Active Sessions
**Endpoint**: `/sessionMgr/list`
**Method**: GET
**Auth Required**: Yes (token)
**Permission Level**: Superuser, Admin
**Request Headers**:
```
X-Token: your_token
X-Timestamp: 1704067200000
```
| Header | Type | Required | Description |
|--------|------|----------|-------------|
| X-Token | string | Yes | Authentication token |
| X-Timestamp | int64 | Yes | Client timestamp in milliseconds |
**Response**:
```json
{
"success": true,
"message": "Active sessions listed",
"data": [
{
"ID": "session-5f4dcc3b5aa765d61d8327deb882cf99-1704067200000",
"userID": 1,
"username": "admin",
"expireAt": "2024-01-01T01:00:00Z"
},
{
"ID": "session-7c6a180b36896a0a8c010710c0780347-1704067210000",
"userID": 2,
"username": "new_user",
"expireAt": "2024-01-01T01:00:10Z"
}
]
}
```
| Field | Type | Description |
|-------|------|-------------|
| ID | string | Unique session ID |
| userID | int | User ID |
| username | string | Username |
| expireAt | string | Session expiration time (ISO 8601 format) |
---
## Create frpc Instance
**Endpoint:** `/frpcAct/instanceMgr/create`
@@ -541,6 +590,7 @@ X-Timestamp: 1704067200000
| Modify instance | ✓ | ✓ | ✗ |
| List instances | ✓ | ✓ | ✓ (limited) |
| Manage users | ✓ | ✗ | ✗ |
| List active sessions | ✓ | ✓ | ✗ |
## Timestamp Validation
+1 -1
View File
@@ -271,7 +271,7 @@ func JoinSession(userID int, userName string, token string) error {
}
sessionMap[sessionID] = session
postLog.Info(fmt.Sprintf("[JoinSession] User [%d]%s joined session %s with token %s", userID, userName, sessionID, token))
postLog.Debug(fmt.Sprintf("[JoinSession] User [%d]%s joined session %s with token %s", userID, userName, sessionID, token))
return nil
}