diff --git a/doc/api/README.md b/doc/api/README.md index 9986c9e..3e9a939 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -1,2 +1,3 @@ [中文(简体)](README.zh_CN.md) * [Server Version](version.md) +* [Server Authentication](auth.md) diff --git a/doc/api/auth.md b/doc/api/auth.md new file mode 100644 index 0000000..26b5512 --- /dev/null +++ b/doc/api/auth.md @@ -0,0 +1,9 @@ +[中文简体](auth.zh_CN.md) +# Authentication related APIs +## Get server authentication status +* route: `/auth/status` or `/api/auth/status` +* method: `GET` or `POST` +* auth: Not needed +* parameters: None +* [Example](auth/status.example.json) of the response +* [JSON schema](auth/status.json) of the response diff --git a/doc/api/auth.zh_CN.md b/doc/api/auth.zh_CN.md index a3e62d4..4588292 100644 --- a/doc/api/auth.zh_CN.md +++ b/doc/api/auth.zh_CN.md @@ -1,8 +1,12 @@ +[English](auth.md) # 验证相关API ## 获取服务器验证状态 * 路径: `/api/auth/status`、 `/auth/status`、 `/api/auth` 或 `/auth` * 方法: `GET` 或 `POST` * 鉴权: 无需 +* 参数:无 +* 返回结构[示例](auth/status.example.json) +* 返回结果的[JSON Schema](auth/status.zh_CN.json) ## 获取服务器公钥 * 路径: `/api/auth/pubkey`、 `/auth/pubkey` * 方法: `GET` 或 `POST` diff --git a/doc/api/auth/pubkey.example.json b/doc/api/auth/pubkey.example.json index 8e48364..d5c98c2 100644 --- a/doc/api/auth/pubkey.example.json +++ b/doc/api/auth/pubkey.example.json @@ -1,5 +1,5 @@ { - "$schema": "pubkey.zh_CN.json", + "$schema": "pubkey.json", "ok": true, "code": 0, "result": { diff --git a/doc/api/auth/pubkey.json b/doc/api/auth/pubkey.json new file mode 100644 index 0000000..da3f428 --- /dev/null +++ b/doc/api/auth/pubkey.json @@ -0,0 +1,39 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://github.com/lifegpc/pixiv_downloader/raw/master/doc/api/auth/pubkey.json", + "title": "Result object", + "type": "object", + "properties": { + "ok": { + "description": "Whether the request was successful", + "type": "boolean" + }, + "code": { + "description": "Error code, 0 if it was successful", + "type": "integer" + }, + "msg": { + "description": "Error message", + "type": "string" + }, + "debug_msg": { + "description": "Error message contains debug information" + }, + "result": { + "description": "Result", + "type": "object", + "properties": { + "key": { + "description": "RSA public key", + "type": "string" + }, + "generated_time": { + "description": "The generated time of the key", + "type": "integer" + } + }, + "required": ["key", "generated_time"] + } + }, + "required": ["ok", "code"] +} diff --git a/doc/api/auth/status.example.json b/doc/api/auth/status.example.json new file mode 100644 index 0000000..7ed76e7 --- /dev/null +++ b/doc/api/auth/status.example.json @@ -0,0 +1,4 @@ +{ + "$schema": "status.json", + "has_root_user": false +} diff --git a/doc/api/auth/status.json b/doc/api/auth/status.json new file mode 100644 index 0000000..85e23ae --- /dev/null +++ b/doc/api/auth/status.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://github.com/lifegpc/pixiv_downloader/raw/master/doc/api/auth/status.json", + "title": "服务器验证状态", + "type": "object", + "properties": { + "has_root_user": { + "type": "boolean", + "description": "Whether to have the root user, if not, the authentication is not needed when adding new user." + } + }, + "required": ["has_root_user"] +} diff --git a/doc/api/result.json b/doc/api/result.json new file mode 100644 index 0000000..60aaad4 --- /dev/null +++ b/doc/api/result.json @@ -0,0 +1,27 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://github.com/lifegpc/pixiv_downloader/raw/master/doc/api/result.json", + "title": "Result object", + "type": "object", + "properties": { + "ok": { + "description": "Whether the request was successful", + "type": "boolean" + }, + "code": { + "description": "Error code, 0 if it was successful", + "type": "integer" + }, + "msg": { + "description": "Error message", + "type": "string" + }, + "debug_msg": { + "description": "Error message contains debug information" + }, + "result": { + "description": "Result" + } + }, + "required": ["ok", "code"] +}