新增修改注册流程
This commit is contained in:
@@ -3,6 +3,7 @@ package libs
|
||||
import (
|
||||
browserfingerprint "go-account-register/libs/browser-fingerprint"
|
||||
paramsTypes "go-account-register/types"
|
||||
"go-account-register/utils"
|
||||
"go-account-register/utils/external"
|
||||
"log"
|
||||
"os"
|
||||
@@ -10,7 +11,9 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/corpix/uarand"
|
||||
"github.com/go-rod/rod"
|
||||
"github.com/go-rod/rod/lib/devices"
|
||||
"github.com/go-rod/rod/lib/launcher"
|
||||
"github.com/go-rod/rod/lib/proto"
|
||||
"github.com/go-rod/stealth"
|
||||
@@ -139,6 +142,8 @@ func (c *Chrome) Create(accountId int, params *Fingerprint) (*rod.Browser, strin
|
||||
}
|
||||
|
||||
func (c *Chrome) TemporaryCreate(params *Fingerprint) (*rod.Browser, string, *rod.Page) {
|
||||
userDataDir := "user-data/" + utils.RandString(5)
|
||||
absPath, _ := filepath.Abs(userDataDir)
|
||||
path, _ := launcher.LookPath() // 获取当前系统的浏览器目录
|
||||
// 判断是否传递代理
|
||||
// var proxyHandle utils.ProxyHandle
|
||||
@@ -152,6 +157,7 @@ func (c *Chrome) TemporaryCreate(params *Fingerprint) (*rod.Browser, string, *ro
|
||||
Delete("use-mock-keychain"). // delete flag "--use-mock-keychain"
|
||||
Set("disable-blink-features", "AutomationControlled"). // 绕过自动化检测
|
||||
// Set("incognito"). // 无痕模式
|
||||
Set("user-data-dir", absPath). // 数据持久化目录
|
||||
Set("window-size", "1920,1480"). // 窗口尺寸
|
||||
Set("disable-infobars", "true"). // 隐藏自动化提示栏
|
||||
Set("no-sandbox", "true").
|
||||
@@ -186,6 +192,20 @@ func (c *Chrome) TemporaryCreate(params *Fingerprint) (*rod.Browser, string, *ro
|
||||
Set("timezone", ipInfo.Timezone).
|
||||
Set("geolocation", ipInfo.Lat+","+ipInfo.Lon)
|
||||
|
||||
ua := uarand.GetRandom()
|
||||
screen := devices.Device{
|
||||
Title: "Laptop with MDPI screen",
|
||||
Capabilities: []string{"touch", "mobile"},
|
||||
UserAgent: ua,
|
||||
AcceptLanguage: "en-US,en;q=0.9",
|
||||
Screen: devices.Screen{
|
||||
DevicePixelRatio: 1,
|
||||
Horizontal: devices.ScreenSize{
|
||||
Width: 1920,
|
||||
Height: 1480,
|
||||
},
|
||||
},
|
||||
}
|
||||
// if errProxy == nil {
|
||||
// if strings.Contains(protocol, "http") {
|
||||
// log.Println(protocol + "://" + ip + ":" + port)
|
||||
@@ -197,8 +217,9 @@ func (c *Chrome) TemporaryCreate(params *Fingerprint) (*rod.Browser, string, *ro
|
||||
|
||||
browser := rod.New().
|
||||
ControlURL(uri).
|
||||
MustConnect().NoDefaultDevice()
|
||||
MustConnect().DefaultDevice(screen)
|
||||
browser.MustIgnoreCertErrors(true)
|
||||
|
||||
// if errProxy == nil {
|
||||
// if strings.Contains(protocol, "http") {
|
||||
// log.Println(username, password)
|
||||
|
||||
Reference in New Issue
Block a user