2 Commits

Author SHA1 Message Date
Adrian Zürcher
e05c3a06ae some changes
All checks were successful
Build Slideshow App / build (amd64, .exe, windows) (push) Successful in 2m0s
Build Slideshow App / build (amd64, , linux) (push) Successful in 2m20s
Build Slideshow App / build (arm, 7, , linux) (push) Successful in 1m57s
Build Slideshow App / build (arm64, , linux) (push) Successful in 1m58s
2026-01-31 20:37:03 +01:00
Adrian Zürcher
5e551b4eaf add content-type header and error response
All checks were successful
Build Slideshow App / build (amd64, , linux) (push) Successful in 1m37s
Build Slideshow App / build (amd64, .exe, windows) (push) Successful in 1m19s
Build Slideshow App / build (arm, 7, , linux) (push) Successful in 1m27s
Build Slideshow App / build (arm64, , linux) (push) Successful in 1m28s
2026-01-31 20:14:54 +01:00
2 changed files with 12 additions and 12 deletions

6
env/enviroment.go vendored
View File

@@ -26,7 +26,11 @@ func Load(path string) error {
}
func (key EnvKey) GetValue() string {
return os.Getenv(string(key))
port := os.Getenv(string(key))
if port == "" {
port = "8080"
}
return port
}
func (key EnvKey) SetValue(value string) {

View File

@@ -34,20 +34,16 @@ func getActiveIP() string {
}
func InfoHandler(w http.ResponseWriter, r *http.Request) {
port := env.Port.GetValue()
if port == "" {
port = "8080"
}
speed := env.IntervalDefault.GetValue()
if speed == "" {
speed = "10"
}
w.Header().Set("Content-Type", "application/json")
data := map[string]string{
"ip": GetLocalIP(),
"port": port,
"port": env.Port.GetValue(),
"speed": GetInterval(),
}
json.NewEncoder(w).Encode(data)
err := json.NewEncoder(w).Encode(data)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}