8 Commits

Author SHA1 Message Date
Adrian Zürcher
9b4ff41145 fix /api/info error
All checks were successful
Build Slideshow App / build (amd64, .exe, windows) (push) Successful in 2m2s
Build Slideshow App / build (amd64, , linux) (push) Successful in 2m19s
Build Slideshow App / build (arm, 7, , linux) (push) Successful in 2m14s
Build Slideshow App / build (arm64, , linux) (push) Successful in 2m10s
2026-02-03 15:03:19 +01:00
Adrian Zürcher
1e13a6d4cd change variable back to constant slideshowapp
All checks were successful
Build Slideshow App / build (amd64, .exe, windows) (push) Successful in 1m59s
Build Slideshow App / build (amd64, , linux) (push) Successful in 2m14s
Build Slideshow App / build (arm, 7, , linux) (push) Successful in 2m2s
Build Slideshow App / build (arm64, , linux) (push) Successful in 2m1s
2026-02-03 14:24:29 +01:00
Adrian Zürcher
9d039b4e2c new entry
All checks were successful
Build Slideshow App / build (amd64, .exe, windows) (push) Successful in 1m57s
Build Slideshow App / build (amd64, , linux) (push) Successful in 2m18s
Build Slideshow App / build (arm, 7, , linux) (push) Successful in 2m3s
Build Slideshow App / build (arm64, , linux) (push) Successful in 1m58s
2026-02-03 14:04:06 +01:00
543383186a .gitea/workflows/build.yml aktualisiert
change name to lower case
2026-02-03 14:02:49 +01:00
Adrian Zürcher
46a56e130f change appname constant to variable
All checks were successful
Build Slideshow App / build (amd64, .exe, windows) (push) Successful in 1m58s
Build Slideshow App / build (amd64, , linux) (push) Successful in 2m16s
Build Slideshow App / build (arm, 7, , linux) (push) Successful in 1m54s
Build Slideshow App / build (arm64, , linux) (push) Successful in 1m56s
2026-02-03 11:28:08 +01:00
Adrian Zürcher
aa900d5e3b fix enviroment bug
All checks were successful
Build Slideshow App / build (amd64, .exe, windows) (push) Successful in 2m11s
Build Slideshow App / build (amd64, , linux) (push) Successful in 2m25s
Build Slideshow App / build (arm, 7, , linux) (push) Successful in 2m16s
Build Slideshow App / build (arm64, , linux) (push) Successful in 2m12s
2026-02-03 09:19:06 +01:00
Adrian Zürcher
91cb3a48f8 fix active ip for all os 2026-02-03 09:18:55 +01:00
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
6 changed files with 28 additions and 20 deletions

2
.env
View File

@@ -1,5 +1,5 @@
#empty|development|debug
ENV=
ENV=
PHOTO_DIR=images
HOST=0.0.0.0
PORT=8080

View File

@@ -6,7 +6,7 @@ on:
- '*'
env:
APP_NAME: slideshowApp
APP_NAME: slideshowapp
jobs:
build:

4
.gitignore vendored
View File

@@ -1,4 +1,6 @@
images/
slideshowApp
slideshowapp
schedule.json
*.log
*.log
*.exe

8
env/enviroment.go vendored
View File

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

View File

@@ -20,34 +20,34 @@ func GetLocalIP() string {
}
func getActiveIP() string {
conn, err := net.Dial("udp", "8.8.8.8:80")
addrs, err := net.InterfaceAddrs()
if err != nil {
return ""
}
defer conn.Close()
addr := conn.LocalAddr()
if udpAddr, ok := addr.(*net.UDPAddr); ok {
return udpAddr.IP.String()
for _, address := range addrs {
if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
if ipnet.IP.To4() != nil {
ipStr := ipnet.IP.String()
if ipnet.IP.IsLinkLocalUnicast() {
continue
}
return ipStr
}
}
}
return ""
}
func InfoHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
port := env.Port.GetValue()
if port == "" {
port = "8080"
}
speed := env.IntervalDefault.GetValue()
if speed == "" {
speed = "10"
}
data := map[string]string{
"ip": GetLocalIP(),
"port": port,
"port": env.Port.GetValue(),
"speed": GetInterval(),
}
err := json.NewEncoder(w).Encode(data)

View File

@@ -66,7 +66,7 @@ func GetInterval() string {
}
if interval, ok := settings["default_interval"]; ok {
return interval.(string)
return fmt.Sprintf("%v", interval)
}
return "10"
}