2
0
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:
耗子
2024-09-18 19:08:45 +08:00
parent ef2ecfcc80
commit 2e26af435a
26 changed files with 173 additions and 173 deletions

View File

@@ -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,

View File

@@ -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)