0
0
Fork 0

added disclaimer

This commit is contained in:
ston1th 2025-04-12 21:52:56 +02:00
commit 10510c5322
2 changed files with 23 additions and 8 deletions

6
README.md Normal file
View file

@ -0,0 +1,6 @@
# uvgo
This application downloads and parses the latest UV data from BfS (Bundesamt für Strahlenschutz).
This data is then displayed on a simple web UI.
All UV data copyright belongs to BfS.

25
main.go
View file

@ -98,8 +98,6 @@ func getUV(img image.Image) (vals []float64) {
return return
} }
var listen string
var tmp = `<!doctype html> var tmp = `<!doctype html>
<html> <html>
<head> <head>
@ -114,10 +112,15 @@ a, a:link, a:visited {
<body style="background-color:#d6d6d6;"> <body style="background-color:#d6d6d6;">
<center> <center>
<h5 style="font-size:4em;">UV Index</h5> <h5 style="font-size:4em;">UV Index</h5>
<h1 style="font-size:18em;color:#%s;">%s</h1> <h1 style="font-size:15em;color:#%s;">%s</h1>
<h5 style="font-size:4em;">Updated: %s</h5> <h5 style="font-size:2em;">Updated: %s</h5>
<h5 style="font-size:4em;">Server: %s</h5> <h5 style="font-size:2em;">Server: %s</h5>
<h5 style="font-size:4em;"><a href="/set">Location</a>: %s</h5> <h5 style="font-size:3em;"><a href="/set">Location</a>: %s</h5>
<footer>UV data copyright belongs to <a href="https://www.bfs.de/DE/themen/opt/uv/uv-index/aktuelle-tagesverlaeufe/aktuell_node.html" rel="nofollow noreferrer noopener" target="_blank">Bundesamt für Strahlenschutz</a><br>
Use this service at your own risk.<br>
I take no responsibility for missing or incorrect data.<br>
© <a href="https://git.giftfish.de/ston1th/uvgo" rel="nofollow noreferrer noopener" target="_blank">uvgo</a> %s<br><br>
</footer>
</center> </center>
</body> </body>
</html>` </html>`
@ -149,7 +152,11 @@ func getColor(v float64) string {
return "000000" return "000000"
} }
var locPage = "" var (
locPage string
version string
listen string
)
func main() { func main() {
flag.StringVar(&listen, "l", ":7878", "listen addr") flag.StringVar(&listen, "l", ":7878", "listen addr")
@ -204,13 +211,13 @@ func main() {
mod = mod.Local() mod = mod.Local()
location := selectListReverse[loc] location := selectListReverse[loc]
if err != nil { if err != nil {
fmt.Fprintf(w, tmp, fmt.Fprintf(w, tmp,
"000000", "000000",
"Err", "Err",
mod.Format(time.RFC1123), mod.Format(time.RFC1123),
time.Now().Format(time.RFC1123), time.Now().Format(time.RFC1123),
location, location,
version,
) )
return return
} }
@ -222,6 +229,7 @@ func main() {
mod.Format(time.RFC1123), mod.Format(time.RFC1123),
time.Now().Format(time.RFC1123), time.Now().Format(time.RFC1123),
location, location,
version,
) )
return return
} }
@ -232,6 +240,7 @@ func main() {
mod.Format(time.RFC1123), mod.Format(time.RFC1123),
time.Now().Format(time.RFC1123), time.Now().Format(time.RFC1123),
location, location,
version,
) )
}) })
err := http.ListenAndServe(listen, nil) err := http.ListenAndServe(listen, nil)