mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-30 14:26:36 +08:00
test(cmd): require v1 cap and /api/healthz only
Update route assertions and regenerate swagger so the process no longer documents /api/cap or /api/health.
This commit is contained in:
+11
-2
@@ -51,13 +51,22 @@ func TestNewOpenFlareAppRegistersServerAndWaveletUser(t *testing.T) {
|
||||
got[rd.Method+" "+rd.Path] = true
|
||||
}
|
||||
for _, want := range []string{
|
||||
"GET /api/health",
|
||||
"GET /api/healthz",
|
||||
"GET /api/v1/user/self",
|
||||
"GET /api/v1/d/nodes",
|
||||
"POST /api/cap/challenge",
|
||||
"POST /api/v1/cap/challenge",
|
||||
} {
|
||||
if !got[want] {
|
||||
t.Errorf("missing route %s", want)
|
||||
}
|
||||
}
|
||||
for _, drop := range []string{
|
||||
"GET /api/health",
|
||||
"GET /healthz",
|
||||
"POST /api/cap/challenge",
|
||||
} {
|
||||
if got[drop] {
|
||||
t.Errorf("removed route still registered: %s", drop)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,11 +27,38 @@ func TestPluginRoutesContainGoldenBaseline(t *testing.T) {
|
||||
|
||||
got := routeSet(app.Context())
|
||||
want := loadBaseline(t)
|
||||
for _, drop := range []string{
|
||||
"GET /api/health",
|
||||
"GET /healthz",
|
||||
"POST /api/cap/challenge",
|
||||
"POST /api/cap/redeem",
|
||||
} {
|
||||
delete(want, drop)
|
||||
}
|
||||
for k := range want {
|
||||
if !got[k] {
|
||||
t.Errorf("missing golden route %s", k)
|
||||
}
|
||||
}
|
||||
for _, must := range []string{
|
||||
"GET /api/healthz",
|
||||
"POST /api/v1/cap/challenge",
|
||||
"POST /api/v1/cap/redeem",
|
||||
} {
|
||||
if !got[must] {
|
||||
t.Errorf("missing required route %s", must)
|
||||
}
|
||||
}
|
||||
for _, drop := range []string{
|
||||
"GET /api/health",
|
||||
"GET /healthz",
|
||||
"POST /api/cap/challenge",
|
||||
"POST /api/cap/redeem",
|
||||
} {
|
||||
if got[drop] {
|
||||
t.Errorf("removed route still registered: %s", drop)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func routeSet(ctx *core.Context) map[string]bool {
|
||||
|
||||
+158
-141
@@ -22,147 +22,6 @@ const docTemplate = `{
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/api/cap/challenge": {
|
||||
"post": {
|
||||
"description": "客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "生成人机验证难题",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "可选范围限制参数",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.challengeRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功返回 PoW 难题",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.ChallengeResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/cap/redeem": {
|
||||
"post": {
|
||||
"description": "提交 PoW 解答进行核销,成功后返回一次性 X-Cap-Token 凭证",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "校验人机验证解答",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "难题 Token 与解答 solutions 数组",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.redeemRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "核销成功,返回 X-Cap-Token",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.RedeemResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误或核销失败",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/health": {
|
||||
"get": {
|
||||
"description": "检查服务是否正常运行,可用于负载均衡存活探测",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"summary": "健康检查",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "服务正常",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/admin/auth-sources": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -5050,6 +4909,164 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/cap/challenge": {
|
||||
"get": {
|
||||
"description": "客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "生成人机验证难题",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "可选范围限制参数",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.challengeRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功返回 PoW 难题",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.ChallengeResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "生成人机验证难题",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "可选范围限制参数",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.challengeRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功返回 PoW 难题",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.ChallengeResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/cap/redeem": {
|
||||
"post": {
|
||||
"description": "提交 PoW 解答进行核销,成功后返回一次性 X-Cap-Token 凭证",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "校验人机验证解答",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "难题 Token 与解答 solutions 数组",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.redeemRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "核销成功,返回 X-Cap-Token",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.RedeemResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误或核销失败",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/config/public": {
|
||||
"get": {
|
||||
"description": "返回系统配置表中 visibility 为 1 的配置键值集合",
|
||||
|
||||
+158
-141
@@ -15,147 +15,6 @@
|
||||
},
|
||||
"basePath": "/",
|
||||
"paths": {
|
||||
"/api/cap/challenge": {
|
||||
"post": {
|
||||
"description": "客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "生成人机验证难题",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "可选范围限制参数",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.challengeRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功返回 PoW 难题",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.ChallengeResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/cap/redeem": {
|
||||
"post": {
|
||||
"description": "提交 PoW 解答进行核销,成功后返回一次性 X-Cap-Token 凭证",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "校验人机验证解答",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "难题 Token 与解答 solutions 数组",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.redeemRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "核销成功,返回 X-Cap-Token",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.RedeemResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误或核销失败",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/health": {
|
||||
"get": {
|
||||
"description": "检查服务是否正常运行,可用于负载均衡存活探测",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"summary": "健康检查",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "服务正常",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/admin/auth-sources": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -5043,6 +4902,164 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/cap/challenge": {
|
||||
"get": {
|
||||
"description": "客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "生成人机验证难题",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "可选范围限制参数",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.challengeRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功返回 PoW 难题",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.ChallengeResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "生成人机验证难题",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "可选范围限制参数",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.challengeRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功返回 PoW 难题",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.ChallengeResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/cap/redeem": {
|
||||
"post": {
|
||||
"description": "提交 PoW 解答进行核销,成功后返回一次性 X-Cap-Token 凭证",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "校验人机验证解答",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "难题 Token 与解答 solutions 数组",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.redeemRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "核销成功,返回 X-Cap-Token",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.RedeemResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误或核销失败",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/config/public": {
|
||||
"get": {
|
||||
"description": "返回系统配置表中 visibility 为 1 的配置键值集合",
|
||||
|
||||
+94
-83
@@ -4277,89 +4277,6 @@ info:
|
||||
title: OpenFlare API
|
||||
version: 1.0.0
|
||||
paths:
|
||||
/api/cap/challenge:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。
|
||||
parameters:
|
||||
- description: 可选范围限制参数
|
||||
in: body
|
||||
name: request
|
||||
schema:
|
||||
$ref: '#/definitions/cap.challengeRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 成功返回 PoW 难题
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Any'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/cap.ChallengeResponse'
|
||||
type: object
|
||||
"500":
|
||||
description: 内部服务错误
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
summary: 生成人机验证难题
|
||||
tags:
|
||||
- cap
|
||||
/api/cap/redeem:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 提交 PoW 解答进行核销,成功后返回一次性 X-Cap-Token 凭证
|
||||
parameters:
|
||||
- description: 难题 Token 与解答 solutions 数组
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/cap.redeemRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 核销成功,返回 X-Cap-Token
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Any'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/cap.RedeemResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: 参数错误或核销失败
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
"500":
|
||||
description: 内部服务错误
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
summary: 校验人机验证解答
|
||||
tags:
|
||||
- cap
|
||||
/api/health:
|
||||
get:
|
||||
description: 检查服务是否正常运行,可用于负载均衡存活探测
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 服务正常
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Any'
|
||||
- properties:
|
||||
data:
|
||||
type: string
|
||||
type: object
|
||||
summary: 健康检查
|
||||
tags:
|
||||
- health
|
||||
/api/v1/admin/auth-sources:
|
||||
get:
|
||||
description: 返回所有已配置的 OAuth/OIDC 认证源列表,包括已启用和未启用的,需要管理员权限
|
||||
@@ -7294,6 +7211,100 @@ paths:
|
||||
summary: Agent WebSocket 连接
|
||||
tags:
|
||||
- openflare-agent
|
||||
/api/v1/cap/challenge:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。
|
||||
parameters:
|
||||
- description: 可选范围限制参数
|
||||
in: body
|
||||
name: request
|
||||
schema:
|
||||
$ref: '#/definitions/cap.challengeRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 成功返回 PoW 难题
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Any'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/cap.ChallengeResponse'
|
||||
type: object
|
||||
"500":
|
||||
description: 内部服务错误
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
summary: 生成人机验证难题
|
||||
tags:
|
||||
- cap
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。
|
||||
parameters:
|
||||
- description: 可选范围限制参数
|
||||
in: body
|
||||
name: request
|
||||
schema:
|
||||
$ref: '#/definitions/cap.challengeRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 成功返回 PoW 难题
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Any'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/cap.ChallengeResponse'
|
||||
type: object
|
||||
"500":
|
||||
description: 内部服务错误
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
summary: 生成人机验证难题
|
||||
tags:
|
||||
- cap
|
||||
/api/v1/cap/redeem:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 提交 PoW 解答进行核销,成功后返回一次性 X-Cap-Token 凭证
|
||||
parameters:
|
||||
- description: 难题 Token 与解答 solutions 数组
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/cap.redeemRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 核销成功,返回 X-Cap-Token
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Any'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/cap.RedeemResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: 参数错误或核销失败
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
"500":
|
||||
description: 内部服务错误
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
summary: 校验人机验证解答
|
||||
tags:
|
||||
- cap
|
||||
/api/v1/config/public:
|
||||
get:
|
||||
consumes:
|
||||
|
||||
+158
-141
@@ -15,147 +15,6 @@
|
||||
},
|
||||
"basePath": "/",
|
||||
"paths": {
|
||||
"/api/cap/challenge": {
|
||||
"post": {
|
||||
"description": "客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "生成人机验证难题",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "可选范围限制参数",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.challengeRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功返回 PoW 难题",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.ChallengeResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/cap/redeem": {
|
||||
"post": {
|
||||
"description": "提交 PoW 解答进行核销,成功后返回一次性 X-Cap-Token 凭证",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "校验人机验证解答",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "难题 Token 与解答 solutions 数组",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.redeemRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "核销成功,返回 X-Cap-Token",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.RedeemResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误或核销失败",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/health": {
|
||||
"get": {
|
||||
"description": "检查服务是否正常运行,可用于负载均衡存活探测",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"summary": "健康检查",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "服务正常",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/admin/auth-sources": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -5043,6 +4902,164 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/cap/challenge": {
|
||||
"get": {
|
||||
"description": "客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "生成人机验证难题",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "可选范围限制参数",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.challengeRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功返回 PoW 难题",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.ChallengeResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "生成人机验证难题",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "可选范围限制参数",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.challengeRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功返回 PoW 难题",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.ChallengeResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/cap/redeem": {
|
||||
"post": {
|
||||
"description": "提交 PoW 解答进行核销,成功后返回一次性 X-Cap-Token 凭证",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"cap"
|
||||
],
|
||||
"summary": "校验人机验证解答",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "难题 Token 与解答 solutions 数组",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cap.redeemRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "核销成功,返回 X-Cap-Token",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Any"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/cap.RedeemResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误或核销失败",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "内部服务错误",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/config/public": {
|
||||
"get": {
|
||||
"description": "返回系统配置表中 visibility 为 1 的配置键值集合",
|
||||
|
||||
+94
-83
@@ -4277,89 +4277,6 @@ info:
|
||||
title: OpenFlare API
|
||||
version: 1.0.0
|
||||
paths:
|
||||
/api/cap/challenge:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。
|
||||
parameters:
|
||||
- description: 可选范围限制参数
|
||||
in: body
|
||||
name: request
|
||||
schema:
|
||||
$ref: '#/definitions/cap.challengeRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 成功返回 PoW 难题
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Any'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/cap.ChallengeResponse'
|
||||
type: object
|
||||
"500":
|
||||
description: 内部服务错误
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
summary: 生成人机验证难题
|
||||
tags:
|
||||
- cap
|
||||
/api/cap/redeem:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 提交 PoW 解答进行核销,成功后返回一次性 X-Cap-Token 凭证
|
||||
parameters:
|
||||
- description: 难题 Token 与解答 solutions 数组
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/cap.redeemRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 核销成功,返回 X-Cap-Token
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Any'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/cap.RedeemResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: 参数错误或核销失败
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
"500":
|
||||
description: 内部服务错误
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
summary: 校验人机验证解答
|
||||
tags:
|
||||
- cap
|
||||
/api/health:
|
||||
get:
|
||||
description: 检查服务是否正常运行,可用于负载均衡存活探测
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 服务正常
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Any'
|
||||
- properties:
|
||||
data:
|
||||
type: string
|
||||
type: object
|
||||
summary: 健康检查
|
||||
tags:
|
||||
- health
|
||||
/api/v1/admin/auth-sources:
|
||||
get:
|
||||
description: 返回所有已配置的 OAuth/OIDC 认证源列表,包括已启用和未启用的,需要管理员权限
|
||||
@@ -7294,6 +7211,100 @@ paths:
|
||||
summary: Agent WebSocket 连接
|
||||
tags:
|
||||
- openflare-agent
|
||||
/api/v1/cap/challenge:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。
|
||||
parameters:
|
||||
- description: 可选范围限制参数
|
||||
in: body
|
||||
name: request
|
||||
schema:
|
||||
$ref: '#/definitions/cap.challengeRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 成功返回 PoW 难题
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Any'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/cap.ChallengeResponse'
|
||||
type: object
|
||||
"500":
|
||||
description: 内部服务错误
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
summary: 生成人机验证难题
|
||||
tags:
|
||||
- cap
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 客户端获取 PoW 难题和签名的 JWT Token,并在后台计算。
|
||||
parameters:
|
||||
- description: 可选范围限制参数
|
||||
in: body
|
||||
name: request
|
||||
schema:
|
||||
$ref: '#/definitions/cap.challengeRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 成功返回 PoW 难题
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Any'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/cap.ChallengeResponse'
|
||||
type: object
|
||||
"500":
|
||||
description: 内部服务错误
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
summary: 生成人机验证难题
|
||||
tags:
|
||||
- cap
|
||||
/api/v1/cap/redeem:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 提交 PoW 解答进行核销,成功后返回一次性 X-Cap-Token 凭证
|
||||
parameters:
|
||||
- description: 难题 Token 与解答 solutions 数组
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/cap.redeemRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 核销成功,返回 X-Cap-Token
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Any'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/cap.RedeemResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: 参数错误或核销失败
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
"500":
|
||||
description: 内部服务错误
|
||||
schema:
|
||||
$ref: '#/definitions/response.Any'
|
||||
summary: 校验人机验证解答
|
||||
tags:
|
||||
- cap
|
||||
/api/v1/config/public:
|
||||
get:
|
||||
consumes:
|
||||
|
||||
Reference in New Issue
Block a user