Skip to content

Commit

Permalink
docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
YanxinTang committed Dec 2, 2020
1 parent a0af30f commit f13701c
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 6 deletions.
84 changes: 82 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,43 @@ You can make customization by editing `config.json`
- default: `"warning"`
- values: `"panic"`, `"fatal"`, `"error"`, `"warning"`, `"info"`, `"debug"`, `"trace"`

- `authkey`
- type: `string`
- default: `''`

- `tempDir`
- type: `string`
- default: `./temp`

- `reserveHistory`
- type: `Boolean`
- default: `false`

- `notify`
- type: `object`
- children:
- `copy`
- type: `Bollean`
- default: `false`
- `paste`
- type: `Boolean`
- default: `false`

## API

The default http server will listen `8086` port and you can't chanage that since hardcoded.

### Common headers

#### Required

- `X-API-Version`: indicates version of api

#### Optional

- `X-Client-Name`: indicates name of device
- `X-Auth`: hashed authkey. Value from `md5(config.authkey + timestamp/30)`

### 1. Get windows clipboard

> Request
Expand All @@ -65,15 +98,62 @@ The default http server will listen `8086` port and you can't chanage that since

> Reponse
- Body: `<clipboard text>`
- Body: `json`

```json
// 200 ok

{
"type": "text",
"data": "clipboard text on the server"
}

{
"type": "file",
"data": [
{
"name": "filename",
"content": "base64 string of file bytes"
}
...
]
}

```

### 2. Set windows clipboard

> Request
- URL: `/`
- Method: `POST`
- Body: `text you want to set`
- Headers:
- `X-Content-Type`: indicates type of request body content
- `required`
- values: `text`, `file`, `media`

- Body: `json`

For text:

```json
{
"data": "text you want to set"
}
```

For file:

```json
{
"data": [
{
"name": "filename",
"base64": "base64 string of file bytes"
}
]
}
```

> Reponse
Expand Down
86 changes: 82 additions & 4 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,41 @@ clipboard-online 是一款可以帮你在 💻Windows 和 📱iOS 之间分享
- 默认: `"warning"`
- 可选: `"panic"`, `"fatal"`, `"error"`, `"warning"`, `"info"`, `"debug"`, `"trace"`

- `authkey`
- type: `string`
- default: `''`

- `tempDir`
- type: `string`
- default: `./temp`

- `reserveHistory`
- type: `Boolean`
- default: `false`

- `notify`
- type: `object`
- children:
- `copy`
- type: `Bollean`
- default: `false`
- `paste`
- type: `Boolean`
- default: `false`

## API

### 公共 headers

#### 必选

- `X-API-Version`: indicates version of api

#### 可选

- `X-Client-Name`: indicates name of device
- `X-Auth`: hashed authkey. Value from `md5(config.authkey + timestamp/30)`

### 1. 获取 Windows 剪切板

> Request
Expand All @@ -63,16 +96,61 @@ clipboard-online 是一款可以帮你在 💻Windows 和 📱iOS 之间分享

> Reponse
- Body: `<clipboard text>`
- Body: `json`

```json
// 200 ok

{
"type": "text",
"data": "clipboard text on the server"
}

{
"type": "file",
"data": [
{
"name": "filename",
"content": "base64 string of file bytes"
}
...
]
}

```

### 2. 设置 Windows 剪切板

> Request
- URL: `/`
- Method: `POST`
- Body: `text you want to set`

> Reponse
- Headers:
- `X-Content-Type`: indicates type of request body content
- `required`
- values: `text`, `file`, `media`

- Body: `json`

For text:

```json
{
"data": "text you want to set"
}
```

For file:

```json
{
"data": [
{
"name": "filename",
"base64": "base64 string of file bytes"
}
]
}
```

响应的 body 为空。如果剪切板设置成功,状态码将返回 `200`

0 comments on commit f13701c

Please sign in to comment.