新增通用的浏览器自动化扩展插件

This commit is contained in:
zyj
2025-11-21 14:09:59 +08:00
parent 87a077d40c
commit b448227d3e
17 changed files with 2156 additions and 2 deletions

View File

@@ -144,15 +144,27 @@ 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() // 获取当前系统的浏览器目录
// path, _ := launcher.LookPath() // 获取当前系统的浏览器目录
// 判断是否传递代理
// var proxyHandle utils.ProxyHandle
// protocol, username, password, ip, port, errProxy := proxyHandle.ParseProxy(params.Proxy)
// 加载扩展
expandPath, _ := filepath.Abs("expand/general-auto")
// 验证扩展目录
if _, err := os.Stat(expandPath); os.IsNotExist(err) {
log.Fatal("扩展目录不存在:", expandPath)
}
manifestPath := filepath.Join(expandPath, "manifest.json")
if _, err := os.Stat(manifestPath); os.IsNotExist(err) {
log.Fatal("manifest.json 不存在:", manifestPath)
}
ipInfo := external.GetIpInfo(strings.TrimSpace(string(params.Proxy)))
l := launcher.New().
Bin(path).
// Bin(path).
Set("load-extension", expandPath).
// Proxy("210.51.27.121:50003"). // 直接传入完整认证URL
Delete("use-mock-keychain"). // delete flag "--use-mock-keychain"
Set("disable-blink-features", "AutomationControlled"). // 绕过自动化检测