returns.sendErrorAndEnd(c,formatCloudflareChallengeMessage(fmt.Sprintf("Sora request blocked by Cloudflare challenge (HTTP %d). Please switch to a clean proxy/network and retry.",resp.StatusCode),resp.Header,body))
newJSONResponseWithHeader(http.StatusForbidden,`<!DOCTYPE html><html><head><title>Just a moment...</title></head><body><script>window._cf_chl_opt={};</script><noscript>Enable JavaScript and cookies to continue</noscript></body></html>`,"cf-ray","9cff2d62d83bb98d"),
newJSONResponseWithHeader(http.StatusTooManyRequests,`<!DOCTYPE html><html><head><title>Just a moment...</title></head><body></body></html>`,"cf-mitigated","challenge"),
newJSONResponse(http.StatusForbidden,`<!DOCTYPE html><html><head><title>Just a moment...</title></head><body><script>window._cf_chl_opt={cRay: '9cff2d62d83bb98d'};</script><noscript>Enable JavaScript and cookies to continue</noscript></body></html>`),
newJSONResponse(http.StatusForbidden,`<!DOCTYPE html><html><head><title>Just a moment...</title></head><body><script>window._cf_chl_opt={cRay: '9cff2d62d83bb98d'};</script><noscript>Enable JavaScript and cookies to continue</noscript></body></html>`),
},
}
svc:=&AccountTestService{httpUpstream:upstream}
account:=&Account{
ID:1,
Platform:PlatformSora,
Type:AccountTypeOAuth,
Concurrency:1,
Credentials:map[string]any{
"access_token":"test_token",
},
}
c,rec:=newSoraTestContext()
err:=svc.testSoraAccountConnection(c,account)
require.NoError(t,err)
body:=rec.Body.String()
require.Contains(t,body,"Subscription check blocked by Cloudflare challenge (HTTP 403)")
require.Contains(t,body,"Sora2 invite check blocked by Cloudflare challenge (HTTP 403)")