fix: api routes need to use ApplyMiddlewares
This commit is contained in:
parent
527334f829
commit
2cc600b78b
26
api/s5.go
26
api/s5.go
|
@ -37,13 +37,13 @@ func getRoutes(h *s5.HttpHandler, portal interfaces.Portal) map[string]jape.Hand
|
|||
"POST /s5/account/register": h.AccountRegister,
|
||||
"GET /s5/account/login": h.AccountLoginChallenge,
|
||||
"POST /s5/account/login": h.AccountLogin,
|
||||
"GET /s5/account": middleware.AuthMiddleware(h.AccountInfo, portal),
|
||||
"GET /s5/account/stats": middleware.AuthMiddleware(h.AccountStats, portal),
|
||||
"GET /s5/account/pins.bin": middleware.AuthMiddleware(h.AccountPins, portal),
|
||||
"GET /s5/account": middleware.ApplyMiddlewares(h.AccountInfo, middleware.AuthMiddleware(portal)),
|
||||
"GET /s5/account/stats": middleware.ApplyMiddlewares(h.AccountStats, middleware.AuthMiddleware(portal)),
|
||||
"GET /s5/account/pins.bin": middleware.ApplyMiddlewares(h.AccountPins, middleware.AuthMiddleware(portal)),
|
||||
|
||||
// Upload API
|
||||
"POST /s5/upload": middleware.AuthMiddleware(h.SmallFileUpload, portal),
|
||||
"POST /s5/upload/directory": middleware.AuthMiddleware(h.DirectoryUpload, portal),
|
||||
"POST /s5/upload": middleware.ApplyMiddlewares(h.SmallFileUpload, middleware.AuthMiddleware(portal)),
|
||||
"POST /s5/upload/directory": middleware.ApplyMiddlewares(h.DirectoryUpload, middleware.AuthMiddleware(portal)),
|
||||
|
||||
// Tus API
|
||||
"POST /s5/upload/tus": tusHandler,
|
||||
|
@ -52,20 +52,20 @@ func getRoutes(h *s5.HttpHandler, portal interfaces.Portal) map[string]jape.Hand
|
|||
"PATCH /s5/upload/tus/:id": tusHandler,
|
||||
|
||||
// Download API
|
||||
"GET /s5/blob/:cid": middleware.AuthMiddleware(h.DownloadBlob, portal),
|
||||
"GET /s5/blob/:cid": middleware.ApplyMiddlewares(h.DownloadBlob, middleware.AuthMiddleware(portal)),
|
||||
"GET /s5/metadata/:cid": h.DownloadMetadata,
|
||||
|
||||
// Pins API
|
||||
"POST /s5/pin/:cid": middleware.AuthMiddleware(h.AccountPin, portal),
|
||||
"DELETE /s5/delete/:cid": middleware.AuthMiddleware(h.AccountPinDelete, portal),
|
||||
"POST /s5/pin/:cid": middleware.ApplyMiddlewares(h.AccountPin, middleware.AuthMiddleware(portal)),
|
||||
"DELETE /s5/delete/:cid": middleware.ApplyMiddlewares(h.AccountPinDelete, middleware.AuthMiddleware(portal)),
|
||||
|
||||
// Debug API
|
||||
"GET /s5/debug/download_urls/:cid": middleware.AuthMiddleware(h.DebugDownloadUrls, portal),
|
||||
"GET /s5/debug/storage_locations/:hash": middleware.AuthMiddleware(h.DebugStorageLocations, portal),
|
||||
"GET /s5/debug/download_urls/:cid": middleware.ApplyMiddlewares(h.DebugDownloadUrls, middleware.AuthMiddleware(portal)),
|
||||
"GET /s5/debug/storage_locations/:hash": middleware.ApplyMiddlewares(h.DebugStorageLocations, middleware.AuthMiddleware(portal)),
|
||||
|
||||
// Registry API
|
||||
"GET /s5/registry": middleware.AuthMiddleware(h.RegistryQuery, portal),
|
||||
"POST /s5/registry": middleware.AuthMiddleware(h.RegistrySet, portal),
|
||||
"GET /s5/registry/subscription": middleware.AuthMiddleware(h.RegistrySubscription, portal),
|
||||
"GET /s5/registry": middleware.ApplyMiddlewares(h.RegistryQuery, middleware.AuthMiddleware(portal)),
|
||||
"POST /s5/registry": middleware.ApplyMiddlewares(h.RegistrySet, middleware.AuthMiddleware(portal)),
|
||||
"GET /s5/registry/subscription": middleware.ApplyMiddlewares(h.RegistrySubscription, middleware.AuthMiddleware(portal)),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue