feat: Add a new cleaner page for managing and automatically cleaning error S2A accounts, supported by new backend services for logging, authentication, and client operations.
This commit is contained in:
@@ -10,11 +10,15 @@ import (
|
||||
|
||||
"github.com/chromedp/cdproto/fetch"
|
||||
"github.com/chromedp/cdproto/network"
|
||||
"github.com/chromedp/cdproto/page"
|
||||
"github.com/chromedp/chromedp"
|
||||
)
|
||||
|
||||
// CompleteWithChromedp 使用 chromedp 完成 S2A OAuth 授权
|
||||
func CompleteWithChromedp(authURL, email, password, teamID string, headless bool, proxy string) (string, error) {
|
||||
// 获取随机浏览器配置
|
||||
profile := GetRandomBrowserProfile()
|
||||
|
||||
var proxyServer string
|
||||
var proxyUser string
|
||||
var proxyPass string
|
||||
@@ -36,7 +40,16 @@ func CompleteWithChromedp(authURL, email, password, teamID string, headless bool
|
||||
chromedp.Flag("no-sandbox", true),
|
||||
chromedp.Flag("disable-dev-shm-usage", true),
|
||||
chromedp.Flag("disable-blink-features", "AutomationControlled"),
|
||||
chromedp.UserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"),
|
||||
chromedp.Flag("disable-automation", true),
|
||||
chromedp.Flag("disable-extensions", true),
|
||||
chromedp.Flag("disable-infobars", true),
|
||||
chromedp.Flag("enable-features", "NetworkService,NetworkServiceInProcess"),
|
||||
// 使用随机 User-Agent
|
||||
chromedp.UserAgent(profile.UserAgent),
|
||||
// 使用随机窗口大小
|
||||
chromedp.WindowSize(profile.Width, profile.Height),
|
||||
// 随机语言
|
||||
chromedp.Flag("accept-lang", profile.AcceptLang),
|
||||
)
|
||||
|
||||
if proxyServer != "" {
|
||||
@@ -99,9 +112,17 @@ func CompleteWithChromedp(authURL, email, password, teamID string, headless bool
|
||||
}
|
||||
})
|
||||
|
||||
// 获取反检测脚本
|
||||
antiDetectionJS := GetAntiDetectionJS(profile)
|
||||
|
||||
// 构建运行任务
|
||||
tasks := []chromedp.Action{
|
||||
network.Enable(),
|
||||
// 在每个新文档加载时注入反检测脚本
|
||||
chromedp.ActionFunc(func(ctx context.Context) error {
|
||||
_, err := page.AddScriptToEvaluateOnNewDocument(antiDetectionJS).Do(ctx)
|
||||
return err
|
||||
}),
|
||||
chromedp.Navigate(authURL),
|
||||
chromedp.WaitReady("body"),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user