mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-07 02:06:38 +08:00
fix(backend): improve captcha validation and forward service sync
- Add cloudflare site/secret key validation for captcha enabled check - Fix forward create to use UpdateService with tolerateExists for idempotent sync - Introduce isAlreadyExistsMessage helper excluding address-in-use errors - Add contract tests for forward toggle, address-in-use rollback, captcha compatibility
This commit is contained in:
@@ -53,3 +53,15 @@ func TestShouldTryLegacySingleService(t *testing.T) {
|
||||
t.Fatalf("DeleteService should not require legacy fallback")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsAlreadyExistsMessage(t *testing.T) {
|
||||
if !isAlreadyExistsMessage("service demo already exists") {
|
||||
t.Fatalf("expected already exists message to be tolerated")
|
||||
}
|
||||
if !isAlreadyExistsMessage("服务已存在") {
|
||||
t.Fatalf("expected Chinese already exists message to be tolerated")
|
||||
}
|
||||
if isAlreadyExistsMessage("listen tcp [::]:10001: bind: address already in use") {
|
||||
t.Fatalf("address already in use must not be treated as already exists")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user