feat: respond static file on loading storages (#2686)
This commit is contained in:
parent
5043815d48
commit
a2e8e96c71
@ -1,7 +1,10 @@
|
|||||||
package middlewares
|
package middlewares
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/alist-org/alist/v3/internal/conf"
|
"github.com/alist-org/alist/v3/internal/conf"
|
||||||
|
"github.com/alist-org/alist/v3/pkg/utils"
|
||||||
"github.com/alist-org/alist/v3/server/common"
|
"github.com/alist-org/alist/v3/server/common"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
@ -10,6 +13,17 @@ func StoragesLoaded(c *gin.Context) {
|
|||||||
if conf.StoragesLoaded {
|
if conf.StoragesLoaded {
|
||||||
c.Next()
|
c.Next()
|
||||||
} else {
|
} else {
|
||||||
|
if utils.SliceContains([]string{"", "/", "/favicon.ico"}, c.Request.URL.Path) {
|
||||||
|
c.Next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
paths := []string{"/assets", "/images", "/streamer"}
|
||||||
|
for _, path := range paths {
|
||||||
|
if strings.HasPrefix(c.Request.URL.Path, path) {
|
||||||
|
c.Next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
common.ErrorStrResp(c, "Loading storage, please wait", 500)
|
common.ErrorStrResp(c, "Loading storage, please wait", 500)
|
||||||
c.Abort()
|
c.Abort()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user