fix: macOS bcopy conflict and Docker host binding

- Fix #11: Guard bcopy/bzero declarations with _VISUALCPP in commoninclude.h
  to avoid redefinition errors on macOS where <strings.h> provides them
- Fix #12: Add --host flag to serve command, default 127.0.0.1
  Docker now binds to 0.0.0.0 so Colima can reach the server from host
- Also fix truncate() panic when n < 3
This commit is contained in:
2026-06-21 21:40:41 -07:00
parent 649a73984d
commit 48d6d8c4d3
4 changed files with 17 additions and 4 deletions
+10 -3
View File
@@ -24,6 +24,7 @@ var webUI embed.FS
func cmdServe(args []string) {
port := 0
host := "127.0.0.1"
openBrowser := true
for i := 0; i < len(args); i++ {
@@ -33,6 +34,11 @@ func cmdServe(args []string) {
port, _ = strconv.Atoi(args[i+1])
i++
}
case "--host":
if i+1 < len(args) {
host = args[i+1]
i++
}
case "--no-browser":
openBrowser = false
}
@@ -52,18 +58,19 @@ func cmdServe(args []string) {
mux.HandleFunc("/api/extract", handleAPIExtract)
mux.HandleFunc("/api/progress", handleProgress)
addr := fmt.Sprintf("127.0.0.1:%d", port)
addr := fmt.Sprintf("%s:%d", host, port)
listener, err := net.Listen("tcp", addr)
if err != nil {
fatal("listen: %v", err)
}
realPort := listener.Addr().(*net.TCPAddr).Port
realHost := listener.Addr().(*net.TCPAddr).IP.String()
fmt.Printf("\n AKAI Utils Server\n")
fmt.Printf(" =================\n\n")
fmt.Printf(" Local: http://localhost:%d\n", realPort)
fmt.Printf(" API: http://localhost:%d/api/\n", realPort)
fmt.Printf(" Local: http://%s:%d\n", realHost, realPort)
fmt.Printf(" API: http://%s:%d/api/\n", realHost, realPort)
fmt.Printf(" Quit: Ctrl+C\n\n")
if openBrowser {