fix cookies not match while using subPath (#51)
This commit is contained in:
parent
8e31fe25ac
commit
2ea9df0aba
@ -23,11 +23,12 @@ type StatsData struct {
|
|||||||
var (
|
var (
|
||||||
key = []byte(securecookie.GenerateRandomKey(32))
|
key = []byte(securecookie.GenerateRandomKey(32))
|
||||||
store = sessions.NewCookieStore(key)
|
store = sessions.NewCookieStore(key)
|
||||||
|
conf = config.LoadedConfig()
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
store.Options = &sessions.Options{
|
store.Options = &sessions.Options{
|
||||||
Path: "/stats",
|
Path: conf.BaseURL+"/stats",
|
||||||
MaxAge: 3600 * 1, // 1 hour
|
MaxAge: 3600 * 1, // 1 hour
|
||||||
HttpOnly: true,
|
HttpOnly: true,
|
||||||
SameSite: http.SameSiteStrictMode,
|
SameSite: http.SameSiteStrictMode,
|
||||||
@ -43,8 +44,6 @@ func Stats(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
conf := config.LoadedConfig()
|
|
||||||
|
|
||||||
if conf.DatabaseType == "none" {
|
if conf.DatabaseType == "none" {
|
||||||
render.PlainText(w, r, "Statistics are disabled")
|
render.PlainText(w, r, "Statistics are disabled")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user