mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-08 16:46:37 +08:00
fix(api): align upload permissions and mount robots and swagger routes
This commit is contained in:
@@ -112,6 +112,7 @@ func (p *Plugin) Apply(ctx *core.Context) error {
|
||||
return err
|
||||
}
|
||||
loginMW := authSvc.RequireAuthMiddleware().(gin.HandlerFunc)
|
||||
adminMW := authSvc.RequireAdminMiddleware().(gin.HandlerFunc)
|
||||
|
||||
// 0a. Register migrations
|
||||
ctx.Migrations().Register("upload", uploadMigrations)
|
||||
@@ -123,16 +124,14 @@ func (p *Plugin) Apply(ctx *core.Context) error {
|
||||
uploadGroup := ctx.Router().Group("/api/v1/upload", loginMW)
|
||||
{
|
||||
uploadGroup.POST("", handler.UploadFile)
|
||||
uploadGroup.GET("", handler.ListFiles)
|
||||
uploadGroup.DELETE("/:id", handler.DeleteFile)
|
||||
uploadGroup.POST("/batch-download", handler.BatchDownloadFiles)
|
||||
uploadGroup.DELETE("/:id", handler.DeleteMyFile)
|
||||
uploadGroup.GET("/my", handler.ListMyFiles)
|
||||
uploadGroup.PUT("/:id", handler.UpdateMyFile)
|
||||
uploadGroup.GET("/download/:id", handler.DownloadFile)
|
||||
uploadGroup.POST("/download/batch", handler.BatchDownloadFiles)
|
||||
}
|
||||
|
||||
adminUploadGroup := ctx.Router().Group("/api/v1/admin/uploads", loginMW)
|
||||
adminUploadGroup := ctx.Router().Group("/api/v1/admin/uploads", loginMW, adminMW)
|
||||
{
|
||||
adminUploadGroup.GET("", handler.ListFiles)
|
||||
adminUploadGroup.GET("/stats", handler.GetFileStats)
|
||||
|
||||
Reference in New Issue
Block a user