mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 10:17:17 +08:00
refactor: rename app to panel
This commit is contained in:
@@ -6,13 +6,13 @@ import (
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
sessionmiddleware "github.com/go-rat/sessions/middleware"
|
||||
|
||||
"github.com/TheTNB/panel/internal/app"
|
||||
"github.com/TheTNB/panel/internal/panel"
|
||||
)
|
||||
|
||||
// GlobalMiddleware is a collection of global middleware that will be applied to every request.
|
||||
func GlobalMiddleware() []func(http.Handler) http.Handler {
|
||||
return []func(http.Handler) http.Handler{
|
||||
sessionmiddleware.StartSession(app.Session),
|
||||
sessionmiddleware.StartSession(panel.Session),
|
||||
//middleware.SupressNotFound(app.Http),// bug https://github.com/go-chi/chi/pull/940
|
||||
middleware.CleanPath,
|
||||
middleware.StripSlashes,
|
||||
|
||||
@@ -7,13 +7,13 @@ import (
|
||||
"github.com/go-rat/chix"
|
||||
"github.com/spf13/cast"
|
||||
|
||||
"github.com/TheTNB/panel/internal/app"
|
||||
"github.com/TheTNB/panel/internal/panel"
|
||||
)
|
||||
|
||||
// MustLogin 确保已登录
|
||||
func MustLogin(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
session, err := app.Session.GetSession(r)
|
||||
session, err := panel.Session.GetSession(r)
|
||||
if err != nil {
|
||||
render := chix.NewRender(w)
|
||||
render.Status(http.StatusInternalServerError)
|
||||
|
||||
Reference in New Issue
Block a user