You've already forked pocketbase
mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-11-24 23:24:00 +02:00
added native echo.HandlerFunc support and .staticDirectoryHandler bind
This commit is contained in:
26
apis/base.go
26
apis/base.go
@@ -193,19 +193,6 @@ func bindStaticAdminUI(app core.App, e *echo.Echo) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
const totalAdminsCacheKey = "@totalAdmins"
|
||||
|
||||
func updateTotalAdminsCache(app core.App) error {
|
||||
total, err := app.Dao().TotalAdmins()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
app.Cache().Set(totalAdminsCacheKey, total)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func uiCacheControl() echo.MiddlewareFunc {
|
||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
@@ -220,6 +207,19 @@ func uiCacheControl() echo.MiddlewareFunc {
|
||||
}
|
||||
}
|
||||
|
||||
const totalAdminsCacheKey = "@totalAdmins"
|
||||
|
||||
func updateTotalAdminsCache(app core.App) error {
|
||||
total, err := app.Dao().TotalAdmins()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
app.Cache().Set(totalAdminsCacheKey, total)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// installerRedirect redirects the user to the installer admin UI page
|
||||
// when the application needs some preliminary configurations to be done.
|
||||
func installerRedirect(app core.App) echo.MiddlewareFunc {
|
||||
|
||||
Reference in New Issue
Block a user