main.go 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. package main
  2. import (
  3. "container/list"
  4. "embed"
  5. <<<<<<< HEAD
  6. =======
  7. "github.com/wailsapp/wails/v2"
  8. "github.com/wailsapp/wails/v2/pkg/options"
  9. "github.com/wailsapp/wails/v2/pkg/options/assetserver"
  10. qu "jygit.jydev.jianyu360.cn/data_processing/common_utils"
  11. >>>>>>> 3146e627030e181299474dd54a941ed33c8183bb
  12. be "spider_creator/backend"
  13. bdb "spider_creator/backend/db"
  14. "spider_creator/backend/script"
  15. bvm "spider_creator/backend/vm"
  16. bws "spider_creator/backend/webservice"
  17. <<<<<<< HEAD
  18. qu "jygit.jydev.jianyu360.cn/data_processing/common_utils"
  19. "github.com/wailsapp/wails/v2"
  20. "github.com/wailsapp/wails/v2/pkg/options"
  21. "github.com/wailsapp/wails/v2/pkg/options/assetserver"
  22. =======
  23. >>>>>>> 3146e627030e181299474dd54a941ed33c8183bb
  24. )
  25. var (
  26. //go:embed all:frontend/dist
  27. assets embed.FS
  28. app *App
  29. db *bdb.SpiderDb
  30. exitCh chan bool
  31. baseDir, attachesDir string = ".", ""
  32. currentSpiderConfig *be.SpiderConfig = new(be.SpiderConfig)
  33. currentResults = list.New() //b.ResultItems = make(b.ResultItems, 0)
  34. vm *bvm.VM
  35. glvm *script.GLVm
  36. ws *bws.WebService
  37. <<<<<<< HEAD
  38. //重点网站和正式环境
  39. isOnly4MainSite string = "false"
  40. browserDisableLoadResources = "ws://;wss://;.tof;.woff;.ico;.mp4;.zip;.rar;.exe;"
  41. serverAddress = "http://visualizeld.spdata.jianyu360.com/%s" //正式环境
  42. =======
  43. isOnly4MainSite = "false"
  44. serverAddress = "http://visualizeld.spdata.jianyu360.com/%s" //正式环境
  45. >>>>>>> 3146e627030e181299474dd54a941ed33c8183bb
  46. //serverAddress = "http://127.0.0.1:8091/%s" //正式环境
  47. )
  48. //build
  49. // wails build -ldflags="-X 'main.isOnly4MainSite=false'" -o="剑鱼可视化爬虫开发工具_正式.exe"
  50. func init() {
  51. <<<<<<< HEAD
  52. //be.LoadConfig("./config.yaml")
  53. be.Cfg.DisableLoadResource = browserDisableLoadResources
  54. =======
  55. be.LoadConfig("backend/config.yaml")
  56. >>>>>>> 3146e627030e181299474dd54a941ed33c8183bb
  57. be.Cfg.IsOnly4MainSite = isOnly4MainSite == "true"
  58. if be.Cfg.IsOnly4MainSite {
  59. serverAddress = "http://visualize.spdata.jianyu360.com/%s" //重点网站
  60. }
  61. <<<<<<< HEAD
  62. =======
  63. >>>>>>> 3146e627030e181299474dd54a941ed33c8183bb
  64. qu.Debug("重点网站:", be.Cfg.IsOnly4MainSite, serverAddress)
  65. }
  66. func main() {
  67. go updateData() //数据保存
  68. // Create an instance of the app structure
  69. app = NewApp()
  70. // Create application with options
  71. err := wails.Run(&options.App{
  72. Title: "剑鱼-爬虫开发平台 v1.0",
  73. Width: 1224,
  74. Height: 668,
  75. AssetServer: &assetserver.Options{
  76. Assets: assets,
  77. },
  78. BackgroundColour: &options.RGBA{R: 255, G: 255, B: 255, A: 1},
  79. OnStartup: app.startup,
  80. OnShutdown: app.destory,
  81. Bind: []interface{}{
  82. app,
  83. },
  84. })
  85. if err != nil {
  86. println("Error:", err.Error())
  87. }
  88. }