summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-08 23:12:31 -0500
committerJeff Carr <[email protected]>2025-09-08 23:14:03 -0500
commitf1c1ca950c0a2868dc7feb6f86a0b48254d95a94 (patch)
tree7c9ef143f6589397b28ba2032742a082128afc90 /main.go
parent7ea7393d6c41b8d656442ead4030c8ea8be27dda (diff)
stub in a gui. doesn't workv0.0.30
Diffstat (limited to 'main.go')
-rw-r--r--main.go71
1 files changed, 3 insertions, 68 deletions
diff --git a/main.go b/main.go
index 995d55d..bdd834d 100644
--- a/main.go
+++ b/main.go
@@ -77,6 +77,9 @@ func main() {
}
if argv.Daemon == true {
+ if argv.Gui != nil {
+ go doGui()
+ }
mux := http.NewServeMux()
okHandlerFunc := http.HandlerFunc(okHandler)
@@ -104,74 +107,6 @@ func main() {
okExit("")
}
- /*
- // --- Best Practice: Create a custom http.Server ---
- server := &http.Server{
- Addr: p,
- Handler: mux,
-
- // ReadTimeout is the total time to read the entire request, including the body.
- // Increase this to a value that can accommodate your largest expected uploads.
- // For example, 5 minutes.
- ReadTimeout: 5 * time.Minute,
-
- // WriteTimeout is the maximum duration before timing out writes of the response.
- WriteTimeout: 10 * time.Second,
-
- // IdleTimeout is the maximum amount of time to wait for the
- // next request when keep-alives are enabled.
- IdleTimeout: 120 * time.Second,
- }
- */
-
- /*
- log.Println(argv.Version(), "HOSTNAME set to:", HOSTNAME)
- log.Println("Running on port", "http://localhost"+p)
- log.Println("Running on port", "http://localhost"+p+"/ipv6.png")
- // if err := http.ListenAndServe(p, nil); err != nil {
- if err := server.ListenAndServe(); err != nil {
- log.Fatalf("Could not start server: %s\n", err)
- }
- /*
- log.Info("Running in --daemon mode")
- http.HandleFunc("/", okHandler)
- // go https() // use caddy instead
- p := fmt.Sprintf(":%d", argv.Port)
- log.Println(argv.Version(), "HOSTNAME set to:", HOSTNAME)
- log.Println("Running on port", "http://localhost"+p)
- log.Println("Running on port", "http://localhost"+p+"/ipv6.png")
- err := http.ListenAndServe(p, nil)
- if err != nil {
- log.Println("Error starting server:", err)
- }
- return
- }
- */
log.Info("--daemon was not set. Just list the patches.")
// doList()
}
-
-func formatDuration(d time.Duration) string {
- seconds := int(d.Seconds()) % 60
- minutes := int(d.Minutes()) % 60
- hours := int(d.Hours()) % 24
- days := int(d.Hours()) / 24
-
- result := ""
- if days > 0 {
- result += fmt.Sprintf("%dd ", days)
- return result
- }
- if hours > 0 {
- result += fmt.Sprintf("%dh ", hours)
- return result
- }
- if minutes > 0 {
- result += fmt.Sprintf("%dm ", minutes)
- return result
- }
- if seconds > 0 {
- result += fmt.Sprintf("%ds", seconds)
- }
- return result
-}