package main import ( "container/list" "embed" be "spider_creator/backend" bdb "spider_creator/backend/db" "spider_creator/backend/script" bvm "spider_creator/backend/vm" bws "spider_creator/backend/webservice" "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options/assetserver" qu "jygit.jydev.jianyu360.cn/data_processing/common_utils" ) var ( //go:embed all:frontend/dist assets embed.FS app *App db *bdb.SpiderDb exitCh chan bool baseDir, attachesDir string = ".", "" currentSpiderConfig *be.SpiderConfig = new(be.SpiderConfig) currentResults = list.New() //b.ResultItems = make(b.ResultItems, 0) vm *bvm.VM glvm *script.GLVm ws *bws.WebService browserLoadResourceTimeout int64 = 5 //重点网站和正式环境 isOnly4MainSite = "false" browserDisableLoadResources = "ws://;wss://;.tof;.woff;.ico;.mp4;.zip;.rar;.exe;" //serverAddress = "http://visualizeld.spdata.jianyu360.com/%s" //正式环境 serverAddress = "http://127.0.0.1:8091/%s" //正式环境 //验证码服务 serverCodeTimeOut int64 = 15 serverCodeAddress = "http://pycaptcha.spdata.jianyu360.com/v1/images/discern?pic_type=" serverCodeFreeAddressOcr = "http://pycaptcha.spdata.jianyu360.com/v1/images/verify" serverCodeFreeAddressArithmetic = "http://pycaptcha.spdata.jianyu360.com/v1/images/arithmetic" serverCodeUsername = "jianyu001" serverCodePassword = "123qwe!A" ) //build // wails build -ldflags="-X 'main.isOnly4MainSite=false'" -o="剑鱼可视化爬虫开发工具_正式.exe" func init() { //be.LoadConfig("./config.yaml") //从配置文件外,编译时设定浏览器排除加载资源。比配置文件优先级低 if browserDisableLoadResources != "" { be.Cfg.DisableLoadResource = browserDisableLoadResources } if browserLoadResourceTimeout > 0 { be.Cfg.BrowserLoadResourceTimeout = browserLoadResourceTimeout } //验证码 if serverCodeTimeOut > 0 { be.Cfg.ServerCodeTimeOut = serverCodeTimeOut } if serverCodeFreeAddressOcr != "" { be.Cfg.ServerCodeFreeAddressOcr = serverCodeFreeAddressOcr } if serverCodeFreeAddressArithmetic != "" { be.Cfg.ServerCodeFreeAddressArithmetic = serverCodeFreeAddressArithmetic } if serverCodeUsername != "" { be.Cfg.ServerCodeUsername = serverCodeUsername } if serverCodePassword != "" { be.Cfg.ServerCodePassword = serverCodePassword } //客户端版本 be.Cfg.IsOnly4MainSite = isOnly4MainSite == "true" if be.Cfg.IsOnly4MainSite { serverAddress = "http://visualize.spdata.jianyu360.com/%s" //重点网站 } qu.Debug("重点网站:", be.Cfg.IsOnly4MainSite, serverAddress) } func main() { go updateData() //数据保存 // Create an instance of the app structure app = NewApp() // Create application with options err := wails.Run(&options.App{ Title: "剑鱼-爬虫开发平台 v1.0", Width: 1224, Height: 668, AssetServer: &assetserver.Options{ Assets: assets, }, BackgroundColour: &options.RGBA{R: 255, G: 255, B: 255, A: 1}, OnStartup: app.startup, OnShutdown: app.destory, Bind: []interface{}{ app, }, }) if err != nil { println("Error:", err.Error()) } }