|
|
|
|
@ -16,6 +16,7 @@ import (
|
|
|
|
|
"github.com/cloudreve/Cloudreve/v4/pkg/request"
|
|
|
|
|
"github.com/cloudreve/Cloudreve/v4/pkg/serializer"
|
|
|
|
|
"github.com/cloudreve/Cloudreve/v4/pkg/util"
|
|
|
|
|
"github.com/gin-contrib/cors"
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
"github.com/gofrs/uuid"
|
|
|
|
|
)
|
|
|
|
|
@ -157,3 +158,13 @@ func Logging() gin.HandlerFunc {
|
|
|
|
|
c.Errors.ByType(gin.ErrorTypePrivate).String(), start)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ContentCORS() gin.HandlerFunc {
|
|
|
|
|
return cors.New(cors.Config{
|
|
|
|
|
AllowOrigins: []string{"*"},
|
|
|
|
|
AllowMethods: []string{"GET", "HEAD", "OPTIONS"},
|
|
|
|
|
AllowHeaders: []string{"Range", "If-Range", "Authorization", "Content-Type"},
|
|
|
|
|
ExposeHeaders: []string{"Content-Range", "Accept-Ranges", "Content-Length", "Content-Disposition", "Content-Disposition", "ETag"},
|
|
|
|
|
AllowCredentials: false,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|