mirror of
https://github.com/Starlio-app/StarlioX
synced 2024-11-06 06:13:57 +03:00
added an error page if you access the site via phone
This commit is contained in:
parent
c5343511cb
commit
06fba69099
4 changed files with 55 additions and 6 deletions
|
@ -1,7 +1,28 @@
|
||||||
package page
|
package page
|
||||||
|
|
||||||
import "net/http"
|
import (
|
||||||
|
"github.com/Redume/EveryNasa/functions"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
func AboutHandler(w http.ResponseWriter, r *http.Request) {
|
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")
|
http.ServeFile(w, r, "web/src/about.html")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package page
|
package page
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/Redume/EveryNasa/functions"
|
"github.com/Redume/EveryNasa/functions"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GalleryHandler(w http.ResponseWriter, r *http.Request) {
|
func GalleryHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -13,6 +13,13 @@ func GalleryHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
userAgent := r.UserAgent()
|
||||||
|
|
||||||
|
if strings.Contains(userAgent, "Mobile") {
|
||||||
|
http.ServeFile(w, r, "web/src/errors/mobile.html")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if r.URL.Path != "/" {
|
if r.URL.Path != "/" {
|
||||||
http.ServeFile(w, r, "web/src/errors/404.html")
|
http.ServeFile(w, r, "web/src/errors/404.html")
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,7 +1,28 @@
|
||||||
package page
|
package page
|
||||||
|
|
||||||
import "net/http"
|
import (
|
||||||
|
"github.com/Redume/EveryNasa/functions"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
func SettingsHandler(w http.ResponseWriter, r *http.Request) {
|
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")
|
http.ServeFile(w, r, "web/src/settings.html")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue