2022-09-18 19:28:19 +03:00
|
|
|
package page
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/Redume/EveryNasa/functions"
|
2022-10-09 17:54:24 +03:00
|
|
|
"net/http"
|
|
|
|
"strings"
|
2022-09-18 19:28:19 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func GalleryHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
con := functions.Connected()
|
|
|
|
if con == false {
|
|
|
|
http.ServeFile(w, r, "web/src/errors/504.html")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-10-09 17:54:24 +03:00
|
|
|
userAgent := r.UserAgent()
|
|
|
|
|
|
|
|
if strings.Contains(userAgent, "Mobile") {
|
|
|
|
http.ServeFile(w, r, "web/src/errors/mobile.html")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-09-18 19:28:19 +03:00
|
|
|
if r.URL.Path != "/" {
|
|
|
|
http.ServeFile(w, r, "web/src/errors/404.html")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
http.ServeFile(w, r, "web/src/gallery.html")
|
|
|
|
}
|