init code

This commit is contained in:
johlanse 2021-11-12 16:44:19 +08:00
parent 412120689c
commit 8fe277be6f
2 changed files with 6 additions and 5 deletions

View File

@ -14,9 +14,10 @@ import (
) )
type Core struct { type Core struct {
pw *playwright.Playwright pw *playwright.Playwright
browser playwright.Browser browser playwright.Browser
context playwright.BrowserContext context playwright.BrowserContext
ShowBrowser bool
} }
type cookie struct { type cookie struct {
@ -62,7 +63,7 @@ func (c *Core) Init() {
HandleSIGHUP: nil, HandleSIGHUP: nil,
HandleSIGINT: nil, HandleSIGINT: nil,
HandleSIGTERM: nil, HandleSIGTERM: nil,
Headless: playwright.Bool(false), Headless: playwright.Bool(c.ShowBrowser),
Proxy: nil, Proxy: nil,
SlowMo: nil, SlowMo: nil,
Timeout: nil, Timeout: nil,

View File

@ -48,7 +48,7 @@ func main() {
2只刷文章和视频和每日答题 2只刷文章和视频和每日答题
3刷文章和视频和每日答题每周答题和专项答题`) 3刷文章和视频和每日答题每周答题和专项答题`)
log.Infoln("检测到模式", config.Model) log.Infoln("检测到模式", config.Model)
core := lib.Core{} core := lib.Core{ShowBrowser: config.ShowBrowser}
defer core.Quit() defer core.Quit()
core.Init() core.Init()
login, err := core.Login() login, err := core.Login()