mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-01 22:46:38 +08:00
[优化] POW 系统接口方案
This commit is contained in:
@@ -33,6 +33,10 @@ sidebar: false
|
||||
- 新增 Uptime Kuma 监控同步集成指南(`uptime-kuma.md`),说明同步参数与专属标签隔离机制
|
||||
- 完善 WAF IP 组订阅模式使用指南(`waf-usage.md`),补充 JSON 路径提取映射规则与同步参数说明
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复由于前端验证码组件未携带 `scope` 导致的登录验证码校验失败或过期的问题;通过引入路径参数化路由 `/api/cap/:scope/...` 支持在不同流程中隔离与核销特定 scope 的人机验证难题
|
||||
|
||||
### 变更
|
||||
|
||||
- 重构 `install-agent.sh` 安装脚本与 `uninstall-agent.sh` 卸载脚本以兼容交互式导引、非交互式命令行参数及 Docker 部署/卸载参数(`--docker`/`--method docker`)
|
||||
|
||||
@@ -11,7 +11,10 @@ import (
|
||||
|
||||
// GetCapChallenge generates a new CAPTCHA challenge
|
||||
func GetCapChallenge(c *gin.Context) {
|
||||
scope := c.Query("scope")
|
||||
scope := c.Param("scope")
|
||||
if scope == "" {
|
||||
scope = c.Query("scope")
|
||||
}
|
||||
resp, err := service.CapManager.Generate(scope)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
@@ -25,7 +28,10 @@ func GetCapChallenge(c *gin.Context) {
|
||||
|
||||
// RedeemCapChallenge validates CAPTCHA solutions and yields a one-time redeem token
|
||||
func RedeemCapChallenge(c *gin.Context) {
|
||||
scope := c.Query("scope")
|
||||
scope := c.Param("scope")
|
||||
if scope == "" {
|
||||
scope = c.Query("scope")
|
||||
}
|
||||
|
||||
var req cap.RedeemRequest
|
||||
if !bind.JSON(c, &req) {
|
||||
|
||||
@@ -33,8 +33,8 @@ func SetApiRouter(router *gin.Engine) {
|
||||
|
||||
capRoute := apiRouter.Group("/cap")
|
||||
{
|
||||
capRoute.POST("/challenge", middleware.CriticalRateLimit(), controller.GetCapChallenge)
|
||||
capRoute.POST("/redeem", middleware.CriticalRateLimit(), controller.RedeemCapChallenge)
|
||||
capRoute.POST("/:scope/challenge", middleware.CriticalRateLimit(), controller.GetCapChallenge)
|
||||
capRoute.POST("/:scope/redeem", middleware.CriticalRateLimit(), controller.RedeemCapChallenge)
|
||||
}
|
||||
|
||||
userRoute := apiRouter.Group("/user")
|
||||
|
||||
@@ -160,7 +160,7 @@ export function LoginForm() {
|
||||
<div className="flex justify-center py-2">
|
||||
<cap-widget
|
||||
ref={capWidgetRef}
|
||||
data-cap-api-endpoint="/api/cap/"
|
||||
data-cap-api-endpoint="/api/cap/login/"
|
||||
onsolve={(e: CustomEvent<{ token: string }>) => {
|
||||
setCapToken(e.detail.token);
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user