webui-dev / go-webui

Use any web browser as GUI, with Go in the backend and modern web technologies in the frontend.
https://webui.me/
MIT License
161 stars 13 forks source link

There are two issues 1. with linking and 2. Setport not working as expected #43

Open MaheshE99ME25 opened 1 month ago

MaheshE99ME25 commented 1 month ago

With go library v2.4.2 the following issues occur:

Issue 1: when using the following -tags webui_log with Go build, a linker error occurs:

go build -ldflags "-w -s " -tags webui_log -o ..\path\to\output.exe

/x86_64-w64-mingw32/bin/ld.exe: cannot find -lwebui-2-static: No such file or directory collect2.exe: error: ld returned 1 exit status

Without -tags webui_log the program compiles with out any error.

Issue 2: The following does not work similar to Custom web server application in C and Nim repo examples:

if os.Getenv("Desktop") != "" { ch := make(chan int) go runServer(r, ch) // r is *gin.Engine, listen and serve on http://localhost:8080/ w := ui.NewWindow() w.SetPort(8081) w.Show("http://localhost:8080/") ui.Wait() res := <-ch println("Exiting program ", res) } It seems window closes on timeout (30 s) whereas server continues to run.

Also, minimal.go in examples work, but the following doesnt work (window closes abruptly): ch := make(chan int) go runServer(r, ch) // r is *gin.Engine, listen and serve on http://localhost:8080/ w := ui.NewWindow() w.Show("<html><head><script src=\"webui.js\"></script></head> Hello World</html>") w.Navigate("http://localhost:8080/") // if this line is commented out the window doesnt close abruptly ui.Wait() res := <-ch println("Exiting program ", res)

AlbertShown commented 1 month ago

Deno wrapper is not updated yet to v2.5 where all those issues are fixed. However, if 8080 is your own server, make sure your HTML files has webui.js

Alternatively, you can take a look on the C custom_web_server example to be sure is working.