Update README_en-US.md

This commit is contained in:
2022-05-23 20:03:33 +08:00
parent f719ba97ad
commit d5c29b61ff

View File

@ -4,24 +4,30 @@
A plugin that opens the GC command execution interface for third-party clients A plugin that opens the GC command execution interface for third-party clients
# Server installation ## Server installation
1. Download the `jar` in [Release](https://github.com/jie65535/gc-opencommand-plugin/releases) 1. Download the `jar` in [Release](https://github.com/jie65535/gc-opencommand-plugin/releases)
2. Put it in the `plugins` folder 2. Put it in the `plugins` folder
# Build ## Console connection
1. When starting for the first time, a `opencommand-plugin` directory will be generated under the `plugins` directory, open and edit `config.json`
2. Set the value of `consoleToken` to your connection key. It is recommended to use a long random string of at least 32 characters.
3. Restart the server to take effect
4. Select the console identity in the client, and fill in your `consoleToken` to run the command as the console identity
## Build
1. `git clone https://github.com/jie65535/gc-opencommand-plugin` 1. `git clone https://github.com/jie65535/gc-opencommand-plugin`
2. `cd gc-opencommand-plugin` 2. `cd gc-opencommand-plugin`
3. `mkdir lib` 3. `mkdir lib`
4. `mv path/to/grasscutter-1.x.x-dev.jar ./lib` 4. `mv path/to/grasscutter-1.x.x-dev.jar ./lib`
5. `gradle build` 5. `gradle build`
# Player ## Player
1. Fill in the service address in the client to confirm whether it supports 1. Fill in the service address in the client to confirm whether it supports
2. Fill in the UID and send the verification code 2. Fill in the UID and send the verification code
3. Fill in the **4-digit integer verification code** received in the game into the client verification 3. Fill in the **4-digit integer verification code** received in the game into the client verification
4. Enjoy the convenience! 4. Enjoy the convenience!
# Client request ## Client request
1. `ping` to confirm whether the `opencommand` plugin is supported 1. `ping` to confirm whether the `opencommand` plugin is supported
2. `sendCode` sends a verification code to the specified player (re-send is not allowed within 1 minute), and save the returned `token` 2. `sendCode` sends a verification code to the specified player (re-send is not allowed within 1 minute), and save the returned `token`
3. Send `verify` check using `token` and **4-digit integer verification code** 3. Send `verify` check using `token` and **4-digit integer verification code**
@ -29,13 +35,24 @@ A plugin that opens the GC command execution interface for third-party clients
--- ---
# API `/opencommand/api` ## `config.json`
```json
{
"consoleToken": "",
"codeExpirationTime_S": 60,
"tempTokenExpirationTime_S": 300,
"tokenLastUseExpirationTime_H": 48
}
```
## API `/opencommand/api`
Example Example
``` ```
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 = "";
@ -44,7 +61,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;
@ -53,27 +70,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`: Requires `token` ### `verify`: Requires `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`: Requires `token` ### `command`: Requires `token`
### Request #### Request
data = command (string) data = command (string)
### Response #### Response
data = message (string) data = message (string)