Fixup README

This commit is contained in:
2025-10-18 02:20:30 -04:00
parent 42d2b88e79
commit 3e77ef3370
4 changed files with 10 additions and 38 deletions

View File

@@ -21,7 +21,6 @@ import (
webview "github.com/webview/webview_go"
)
//go:embed index.html ui/* images/*
var content embed.FS
type saveReq struct {
@@ -34,7 +33,6 @@ type saveResp struct {
}
func main() {
// Static files
subFS, err := fs.Sub(content, ".")
if err != nil {
log.Fatalf("fs.Sub error: %v", err)
@@ -42,7 +40,6 @@ func main() {
mux := http.NewServeMux()
mux.Handle("/", http.FileServer(http.FS(subFS)))
// /save endpoint writes to Downloads
mux.HandleFunc("/save", func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
defer func() { log.Printf("%s %s %s", r.Method, r.URL.Path, time.Since(start)) }()
@@ -77,14 +74,12 @@ func main() {
_ = json.NewEncoder(w).Encode(saveResp{Path: path})
})
// Simple request logger
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
mux.ServeHTTP(w, r)
log.Printf("%s %s %s", r.Method, r.URL.Path, time.Since(start))
})
// Start server on ephemeral port
ln, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
log.Fatalf("listen: %v", err)
@@ -99,7 +94,6 @@ func main() {
}
}()
// Native webview window (debug true for dev tools/log signals)
debug := true
w := webview.New(debug)
defer w.Destroy()