added an error page if you access the site via phone

This commit is contained in:
Данил 2022-10-09 17:54:24 +03:00
parent c5343511cb
commit 06fba69099
4 changed files with 55 additions and 6 deletions

View file

@ -1,7 +1,28 @@
package page
import "net/http"
import (
"github.com/Redume/EveryNasa/functions"
"net/http"
"strings"
)
func AboutHandler(w http.ResponseWriter, r *http.Request) {
con := functions.Connected()
if con == false {
http.ServeFile(w, r, "web/src/errors/504.html")
return
}
userAgent := r.UserAgent()
if strings.Contains(userAgent, "Mobile") {
http.ServeFile(w, r, "web/src/errors/mobile.html")
return
}
if r.URL.Path != "/about" {
http.ServeFile(w, r, "web/src/errors/404.html")
return
}
http.ServeFile(w, r, "web/src/about.html")
}

View file

@ -1,9 +1,9 @@
package page
import (
"net/http"
"github.com/Redume/EveryNasa/functions"
"net/http"
"strings"
)
func GalleryHandler(w http.ResponseWriter, r *http.Request) {
@ -13,6 +13,13 @@ func GalleryHandler(w http.ResponseWriter, r *http.Request) {
return
}
userAgent := r.UserAgent()
if strings.Contains(userAgent, "Mobile") {
http.ServeFile(w, r, "web/src/errors/mobile.html")
return
}
if r.URL.Path != "/" {
http.ServeFile(w, r, "web/src/errors/404.html")
return

View file

@ -1,7 +1,28 @@
package page
import "net/http"
import (
"github.com/Redume/EveryNasa/functions"
"net/http"
"strings"
)
func SettingsHandler(w http.ResponseWriter, r *http.Request) {
con := functions.Connected()
if con == false {
http.ServeFile(w, r, "web/src/errors/504.html")
return
}
userAgent := r.UserAgent()
if strings.Contains(userAgent, "Mobile") {
http.ServeFile(w, r, "web/src/errors/mobile.html")
return
}
if r.URL.Path != "/settings" {
http.ServeFile(w, r, "web/src/errors/404.html")
return
}
http.ServeFile(w, r, "web/src/settings.html")
}

View file

@ -48,5 +48,5 @@
}
#createLabelButton {
margin-left: -12em;
}
margin-left: -12em;
}