28 lines
592 B
Go
28 lines
592 B
Go
|
// Copyright 2024 Brian Newman. All rights reserved.
|
||
|
|
||
|
// Package handlers ...
|
||
|
package handlers
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
"strings"
|
||
|
|
||
|
"go.cdmnky.io/v2/net/session"
|
||
|
)
|
||
|
|
||
|
func IsAuthorized(w http.ResponseWriter, r *http.Request, session *session.Manager) string {
|
||
|
|
||
|
authorized := "no"
|
||
|
// s := session.SessionStart(w, r)
|
||
|
// if s.Get("authorized") != nil {
|
||
|
// authorized = s.Get("authorized").(string)
|
||
|
// }
|
||
|
|
||
|
return authorized
|
||
|
}
|
||
|
|
||
|
func IsMobile(userAgent string) bool {
|
||
|
return (strings.Contains(strings.ToLower(userAgent), "android") ||
|
||
|
strings.Contains(strings.ToLower(userAgent), "iphone"))
|
||
|
}
|