Files
info/main.go
2025-10-08 00:54:42 +02:00

29 lines
669 B
Go

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)
}
}