parent
17881510a4
commit
4d2269b799
|
@ -5,3 +5,4 @@
|
||||||
*.log
|
*.log
|
||||||
/config/config.yml
|
/config/config.yml
|
||||||
/chromium-857950/
|
/chromium-857950/
|
||||||
|
/web/
|
||||||
|
|
|
@ -36,9 +36,10 @@ type Config struct {
|
||||||
Host string `json:"host" yaml:"host"`
|
Host string `json:"host" yaml:"host"`
|
||||||
Port int `json:"port" yaml:"port"`
|
Port int `json:"port" yaml:"port"`
|
||||||
} `json:"web"`
|
} `json:"web"`
|
||||||
Cron string `json:"cron" yaml:"cron"`
|
Cron string `json:"cron" yaml:"cron"`
|
||||||
EdgePath string `json:"edge_path" yaml:"edge_path"`
|
EdgePath string `json:"edge_path" yaml:"edge_path"`
|
||||||
QrCOde bool `json:"qr_code" yaml:"qr_code"`
|
QrCOde bool `json:"qr_code" yaml:"qr_code"`
|
||||||
|
StartWait int `json:"start_wait" yaml:"start_wait"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -43,3 +43,12 @@ tg:
|
||||||
# "9 19 * * *" 每天19点9分执行一次
|
# "9 19 * * *" 每天19点9分执行一次
|
||||||
# "* 10 * * *” 每天早上十点执行一次
|
# "* 10 * * *” 每天早上十点执行一次
|
||||||
cron: ""
|
cron: ""
|
||||||
|
|
||||||
|
#windows环境自定义浏览器路径,仅支持chromium系列
|
||||||
|
edge_path: ""
|
||||||
|
|
||||||
|
# 是否推送二维码
|
||||||
|
qr_code: false
|
||||||
|
|
||||||
|
# 启动时等待时间,为了防止代理启动比软件慢而报错,默认不等待,单位秒
|
||||||
|
start_wait: 0
|
|
@ -231,7 +231,7 @@ func (c *Core) initWondows() {
|
||||||
Channel: nil,
|
Channel: nil,
|
||||||
ChromiumSandbox: nil,
|
ChromiumSandbox: nil,
|
||||||
Devtools: nil,
|
Devtools: nil,
|
||||||
DownloadsPath: nil,
|
DownloadsPath: playwright.String("./tools/temp/"),
|
||||||
ExecutablePath: playwright.String(path),
|
ExecutablePath: playwright.String(path),
|
||||||
HandleSIGHUP: nil,
|
HandleSIGHUP: nil,
|
||||||
HandleSIGINT: nil,
|
HandleSIGINT: nil,
|
||||||
|
@ -250,7 +250,8 @@ func (c *Core) initWondows() {
|
||||||
c.browser = browser
|
c.browser = browser
|
||||||
|
|
||||||
context, err := c.browser.NewContext()
|
context, err := c.browser.NewContext()
|
||||||
c.browser.NewContext()
|
_ = context.AddInitScript(playwright.BrowserContextAddInitScriptOptions{
|
||||||
|
Script: playwright.String("Object.defineProperties(navigator, {webdriver:{get:()=>undefined}});")})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -313,9 +314,9 @@ func (c *Core) initNotWindows() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.browser = browser
|
c.browser = browser
|
||||||
|
|
||||||
context, err := c.browser.NewContext()
|
context, err := c.browser.NewContext()
|
||||||
c.browser.NewContext()
|
_ = context.AddInitScript(playwright.BrowserContextAddInitScriptOptions{
|
||||||
|
Script: playwright.String("Object.defineProperties(navigator, {webdriver:{get:()=>undefined}});")})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
4
main.go
4
main.go
|
@ -61,6 +61,10 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
if config.StartWait > 0 {
|
||||||
|
log.Infoln(fmt.Sprintf("将等待%d秒后启动程序", config.StartWait))
|
||||||
|
time.Sleep(time.Second * time.Duration(config.StartWait))
|
||||||
|
}
|
||||||
switch {
|
switch {
|
||||||
case config.Cron != "":
|
case config.Cron != "":
|
||||||
log.Infoln("已采用定时执行模式")
|
log.Infoln("已采用定时执行模式")
|
||||||
|
|
Loading…
Reference in New Issue