add download, fix empty apicontext, add url to describe

This commit is contained in:
2023-03-17 13:04:52 +01:00
parent 11802a56e9
commit f5e0284c40
10 changed files with 145 additions and 6 deletions

View File

@@ -54,28 +54,31 @@ func Runserver(conf *cfg.Config, args []string) error {
// authenticated routes
api := router.Group(conf.ApiPrefix + ApiVersion)
{
// authenticated routes
// upload
api.Post("/file/", auth, func(c *fiber.Ctx) error {
return FilePut(c, conf, db)
})
// download w/o expire
api.Get("/file/:id/:file", auth, func(c *fiber.Ctx) error {
return FileGet(c, conf, db)
})
api.Get("/file/:id/", auth, func(c *fiber.Ctx) error {
return FileGet(c, conf, db)
})
// remove
api.Delete("/file/:id/", auth, func(c *fiber.Ctx) error {
err := DeleteUpload(c, conf, db)
return SendResponse(c, "", err)
})
// listing
api.Get("/list/", auth, func(c *fiber.Ctx) error {
return List(c, conf, db)
})
// info
api.Get("/upload/:id/", auth, func(c *fiber.Ctx) error {
return Describe(c, conf, db)
})