From b233172108e28be78a3a9084a8fa0b1bde7d2cc0 Mon Sep 17 00:00:00 2001 From: albert Date: Wed, 8 Oct 2025 00:54:42 +0200 Subject: [PATCH] Add main.go --- main.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 main.go diff --git a/main.go b/main.go new file mode 100644 index 0000000..f03062e --- /dev/null +++ b/main.go @@ -0,0 +1,29 @@ +package main + +import ( + "log" + "net/http" + "os/exec" +) + +func handler(w http.ResponseWriter, r *http.Request) { + cmd := exec.Command("fastfetch") + out, err := cmd.CombinedOutput() + if err != nil { + http.Error(w, "Error running fastfetch: "+err.Error(), http.StatusInternalServerError) + return + } + + w.Header().Set("Content-Type", "text/plain") + w.Write(out) +} + +func main() { + http.HandleFunc("/", handler) + + log.Println("Server listening on :8080") + err := http.ListenAndServe(":8080", nil) + if err != nil { + log.Fatal(err) + } +} \ No newline at end of file