diff --git a/internal/cmd/web.go b/internal/cmd/web.go index a081be6b6..6ba7e3f3e 100644 --- a/internal/cmd/web.go +++ b/internal/cmd/web.go @@ -147,7 +147,7 @@ func newFlamego() *flamego.Flame { f.Use(captcha.Captchaer(captcha.Options{ URLPrefix: conf.Server.Subpath, })) - + // Custom health check endpoint (replaces toolbox) f.Get("/-/healthz", func(w http.ResponseWriter) { if err := database.Ping(); err != nil { @@ -158,7 +158,7 @@ func newFlamego() *flamego.Flame { w.WriteHeader(http.StatusOK) fmt.Fprint(w, "ok") }) - + return f } @@ -172,23 +172,23 @@ func runWeb(c *cli.Context) error { // Apply global middleware f.Use(session.Sessioner(session.Options{ - Provider: conf.Session.Provider, - Config: conf.Session.ProviderConfig, - CookieName: conf.Session.CookieName, - CookiePath: conf.Server.Subpath, - Gclifetime: conf.Session.GCInterval, + Provider: conf.Session.Provider, + Config: conf.Session.ProviderConfig, + CookieName: conf.Session.CookieName, + CookiePath: conf.Server.Subpath, + Gclifetime: conf.Session.GCInterval, Maxlifetime: conf.Session.MaxLifeTime, - Secure: conf.Session.CookieSecure, + Secure: conf.Session.CookieSecure, })) f.Use(csrf.Csrfer(csrf.Options{ - Secret: conf.Security.SecretKey, - Header: "X-CSRF-Token", - Cookie: conf.Session.CSRFCookieName, - Domain: conf.Server.URL.Hostname(), - Path: conf.Server.Subpath, - HTTPOnly: true, - SetCookie: true, - Secure: conf.Server.URL.Scheme == "https", + Secret: conf.Security.SecretKey, + Header: "X-CSRF-Token", + Cookie: conf.Session.CSRFCookieName, + Domain: conf.Server.URL.Hostname(), + Path: conf.Server.Subpath, + HTTPOnly: true, + SetCookie: true, + Secure: conf.Server.URL.Scheme == "https", })) f.Use(context.Contexter(context.NewStore())) diff --git a/internal/context/auth.go b/internal/context/auth.go index 92e4fd722..904133c6c 100644 --- a/internal/context/auth.go +++ b/internal/context/auth.go @@ -143,7 +143,7 @@ func authenticatedUserID(store AuthStore, c flamego.Context, sess session.Sessio if !database.HasEngine { return 0, false } - + req := c.Request() // Check access token. @@ -204,7 +204,7 @@ func authenticatedUser(store AuthStore, ctx flamego.Context, sess session.Sessio } uid, isTokenAuth := authenticatedUserID(store, ctx, sess) - + req := ctx.Request() if uid <= 0 { diff --git a/internal/context/context.go b/internal/context/context.go index 6b2dcc691..4227bddf4 100644 --- a/internal/context/context.go +++ b/internal/context/context.go @@ -36,7 +36,7 @@ type Context struct { ResponseWriter http.ResponseWriter Request *http.Request Data template.Data - + Link string // Current request URL User *database.User IsLogged bool