修复检测
This commit is contained in:
+1
-61
@@ -59,67 +59,7 @@ func normalizeBearerToken(s string) string {
|
||||
}
|
||||
|
||||
func probeCursor(token string) Result {
|
||||
url := "https://api2.cursor.sh/auth/full_stripe_profile"
|
||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
return Result{OK: false, Detail: "构造请求失败: " + err.Error()}
|
||||
}
|
||||
|
||||
req.Header.Set("Authorization", "Bearer "+strings.TrimSpace(token))
|
||||
req.Header.Set("X-Cursor-Client-Version", "3.0.16")
|
||||
req.Header.Set("X-New-Onboarding-Completed", "false")
|
||||
req.Header.Set("X-Ghost-Mode", "true")
|
||||
req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Cursor/3.0.16 Chrome/142.0.7444.265 Electron/39.8.1 Safari/537.36")
|
||||
req.Header.Set("Accept", "*/*")
|
||||
req.Header.Set("Origin", "vscode-file://vscode-app")
|
||||
req.Header.Set("Accept-Encoding", "gzip, deflate, br, zstd")
|
||||
req.Header.Set("Accept-Language", "zh-CN")
|
||||
req.Header.Set("Priority", "u=1, i")
|
||||
|
||||
resp, err := httpClient.Do(req)
|
||||
if err != nil {
|
||||
return Result{OK: false, Detail: "请求官方账单接口超时/网络失败: " + err.Error(), HTTPStatus: 500}
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, _ := io.ReadAll(io.LimitReader(resp.Body, 16384))
|
||||
jsonStr := string(body)
|
||||
|
||||
res := Result{
|
||||
HTTPStatus: resp.StatusCode,
|
||||
Endpoint: url,
|
||||
BytesRead: len(body),
|
||||
RawPreview: jsonStr,
|
||||
StreamProtocol: "HTTP/2 JSON REST",
|
||||
StreamNote: "2026型画像探测",
|
||||
ProbeMessage: "GET full_stripe_profile",
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
res.OK = false
|
||||
res.Detail = fmt.Sprintf("Token已失效或被官方拉黑(HTTP %d)", resp.StatusCode)
|
||||
return res
|
||||
}
|
||||
|
||||
if strings.Contains(jsonStr, `"noModelsRemaining":true`) ||
|
||||
strings.Contains(jsonStr, `"is_usage_limited":true`) ||
|
||||
strings.Contains(jsonStr, `"hard_limit_reached"`) ||
|
||||
strings.Contains(jsonStr, `"blocked"`) ||
|
||||
(strings.Contains(jsonStr, `"membershipType":"free"`) && strings.Contains(jsonStr, `"trialEligible":false`)) {
|
||||
res.OK = false
|
||||
res.Detail = "Token存活,但属于无额度Free空壳号(上号必弹付费墙)"
|
||||
return res
|
||||
}
|
||||
|
||||
if len(jsonStr) < 10 {
|
||||
res.OK = false
|
||||
res.Detail = "官方接口返回异常空数据"
|
||||
return res
|
||||
}
|
||||
|
||||
res.OK = true
|
||||
res.Detail = "检测成功,高速算力/Agent额度健康"
|
||||
return res
|
||||
return probeCursorHiAgent(token)
|
||||
}
|
||||
|
||||
func probeWindsurf(apiKey string) Result {
|
||||
|
||||
Reference in New Issue
Block a user