mirror of
https://github.com/jie65535/gc-opencommand-plugin.git
synced 2025-06-02 17:49:12 +08:00
Update README.md
This commit is contained in:
parent
d291d2a8d8
commit
95f688e970
61
README.md
61
README.md
@ -2,23 +2,29 @@
|
|||||||
|
|
||||||
一个为第三方客户端开放GC命令执行接口的插件
|
一个为第三方客户端开放GC命令执行接口的插件
|
||||||
|
|
||||||
# 服务端安装
|
## 服务端安装
|
||||||
1. 在 [Release](https://github.com/jie65535/gc-opencommand-plugin/releases) 下载 `jar`
|
1. 在 [Release](https://github.com/jie65535/gc-opencommand-plugin/releases) 下载 `jar`
|
||||||
2. 放入 `plugins` 文件夹即可
|
2. 放入 `plugins` 文件夹即可
|
||||||
|
|
||||||
# 构建说明
|
## 控制台连接
|
||||||
|
1. 首次启动时,会在 `plugins` 目录下生成一个 `opencommand-plugin` 目录,打开并编辑 `config.json`
|
||||||
|
2. 设置 `consoleToken` 的值为你的连接秘钥,建议使用至少32字符的长随机字符串。
|
||||||
|
3. 重新启动服务端即可生效配置
|
||||||
|
4. 在客户端中选择控制台身份,并填写你的 `consoleToken` 即可以控制台身份运行指令
|
||||||
|
|
||||||
|
## 构建说明
|
||||||
1. 克隆仓库
|
1. 克隆仓库
|
||||||
2. 在目录下新建 `lib` 目录
|
2. 在目录下新建 `lib` 目录
|
||||||
3. 将 `grasscutter-1.1.x-dev.jar` 放入 `lib` 目录
|
3. 将 `grasscutter-1.1.x-dev.jar` 放入 `lib` 目录
|
||||||
4. `gradle build`
|
4. `gradle build`
|
||||||
|
|
||||||
# 玩家使用流程
|
## 玩家使用流程
|
||||||
1. 在客户端中填写服务地址,确认是否支持
|
1. 在客户端中填写服务地址,确认是否支持
|
||||||
2. 填写UID,发送验证码
|
2. 填写UID,发送验证码
|
||||||
3. 将游戏内收到的**4位整数验证码**填入客户端校验
|
3. 将游戏内收到的**4位整数验证码**填入客户端校验
|
||||||
4. 享受便利!
|
4. 享受便利!
|
||||||
|
|
||||||
# 客户端请求流程
|
## 客户端请求流程
|
||||||
1. `ping` 确认是否支持 `opencommand` 插件
|
1. `ping` 确认是否支持 `opencommand` 插件
|
||||||
2. `sendCode` 向指定玩家发送验证码(1分钟内不允许重发),保存返回的 `token`
|
2. `sendCode` 向指定玩家发送验证码(1分钟内不允许重发),保存返回的 `token`
|
||||||
3. 使用 `token` 和**4位整数验证码**发送 `verify` 校验
|
3. 使用 `token` 和**4位整数验证码**发送 `verify` 校验
|
||||||
@ -26,13 +32,28 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# API `/opencommand/api`
|
## `config.json`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
// 控制台连接令牌
|
||||||
|
"consoleToken": "",
|
||||||
|
// 验证码过期时间(秒)
|
||||||
|
"codeExpirationTime_S": 60,
|
||||||
|
// 临时令牌过期时间(秒)
|
||||||
|
"tempTokenExpirationTime_S": 300,
|
||||||
|
// 授权令牌最后使用过期时间(小时)
|
||||||
|
"tokenLastUseExpirationTime_H": 48
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## API `/opencommand/api`
|
||||||
示例
|
示例
|
||||||
```
|
```
|
||||||
https://127.0.0.1/opencommand/api
|
https://127.0.0.1/opencommand/api
|
||||||
```
|
```
|
||||||
|
|
||||||
# Request 请求
|
### Request 请求
|
||||||
```java
|
```java
|
||||||
public final class JsonRequest {
|
public final class JsonRequest {
|
||||||
public String token = "";
|
public String token = "";
|
||||||
@ -41,7 +62,7 @@ public final class JsonRequest {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
# Response 响应
|
### Response 响应
|
||||||
```java
|
```java
|
||||||
public final class JsonResponse {
|
public final class JsonResponse {
|
||||||
public int retcode = 200;
|
public int retcode = 200;
|
||||||
@ -50,27 +71,27 @@ public final class JsonResponse {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
# Actions 动作
|
### Actions 动作
|
||||||
## `ping`
|
#### `ping`
|
||||||
data = null
|
data = null
|
||||||
|
|
||||||
## `sendCode`
|
#### `sendCode`
|
||||||
### Request
|
##### Request
|
||||||
data = uid (int)
|
data = uid (int)
|
||||||
### Response
|
##### Response
|
||||||
data = token (string)
|
data = token (string)
|
||||||
|
|
||||||
## `verify` 要求 `token`
|
#### `verify` 要求 `token`
|
||||||
### Request
|
##### Request
|
||||||
data = code (int)
|
data = code (int)
|
||||||
### Response
|
##### Response
|
||||||
#### Success:
|
###### Success:
|
||||||
code = 200
|
code = 200
|
||||||
#### Verification failed:
|
###### Verification failed:
|
||||||
code = 400
|
code = 400
|
||||||
|
|
||||||
## `command` 要求 `token`
|
#### `command` 要求 `token`
|
||||||
### Request
|
##### Request
|
||||||
data = command (string)
|
data = command (string)
|
||||||
### Response
|
##### Response
|
||||||
data = message (string)
|
data = message (string)
|
||||||
|
Loading…
Reference in New Issue
Block a user