♻️ Migrated to nexus

This commit is contained in:
2024-10-27 13:13:40 +08:00
parent 07417deea9
commit 2e32de4716
25 changed files with 348 additions and 378 deletions

View File

@@ -1,6 +1,9 @@
package api
import "github.com/gofiber/fiber/v2"
import (
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
"github.com/gofiber/fiber/v2"
)
func MapAPIs(app *fiber.App, baseURL string) {
app.Get("/.well-known/destinations", getDestinations)
@@ -9,32 +12,32 @@ func MapAPIs(app *fiber.App, baseURL string) {
{
api.Get("/pools", listPost)
api.Get("/pools/:id", getPool)
api.Post("/pools", createPool)
api.Put("/pools/:id", updatePool)
api.Delete("/pools/:id", deletePool)
api.Post("/pools", sec.ValidatorMiddleware, createPool)
api.Put("/pools/:id", sec.ValidatorMiddleware, updatePool)
api.Delete("/pools/:id", sec.ValidatorMiddleware, deletePool)
api.Get("/attachments", listAttachment)
api.Get("/attachments/:id/meta", getAttachmentMeta)
api.Get("/attachments/:id", openAttachment)
api.Post("/attachments", createAttachmentDirectly)
api.Put("/attachments/:id", updateAttachmentMeta)
api.Delete("/attachments/:id", deleteAttachment)
api.Post("/attachments", sec.ValidatorMiddleware, createAttachmentDirectly)
api.Put("/attachments/:id", sec.ValidatorMiddleware, updateAttachmentMeta)
api.Delete("/attachments/:id", sec.ValidatorMiddleware, deleteAttachment)
api.Post("/attachments/multipart", createAttachmentMultipartPlaceholder)
api.Post("/attachments/multipart/:file/:chunk", uploadAttachmentMultipart)
api.Post("/attachments/multipart", sec.ValidatorMiddleware, createAttachmentMultipartPlaceholder)
api.Post("/attachments/multipart/:file/:chunk", sec.ValidatorMiddleware, uploadAttachmentMultipart)
api.Get("/stickers/lookup", lookupStickerBatch)
api.Get("/stickers/lookup/:alias", lookupSticker)
api.Get("/stickers/packs", listStickerPacks)
api.Get("/stickers/packs/:packId", getStickerPack)
api.Post("/stickers/packs", createStickerPack)
api.Put("/stickers/packs/:packId", updateStickerPack)
api.Delete("/stickers/packs/:packId", deleteStickerPack)
api.Post("/stickers/packs", sec.ValidatorMiddleware, createStickerPack)
api.Put("/stickers/packs/:packId", sec.ValidatorMiddleware, updateStickerPack)
api.Delete("/stickers/packs/:packId", sec.ValidatorMiddleware, deleteStickerPack)
api.Get("/stickers", listStickers)
api.Get("/stickers/:stickerId", getSticker)
api.Post("/stickers", createSticker)
api.Put("/stickers/:stickerId", updateSticker)
api.Delete("/stickers/:stickerId", deleteSticker)
api.Post("/stickers", sec.ValidatorMiddleware, createSticker)
api.Put("/stickers/:stickerId", sec.ValidatorMiddleware, updateSticker)
api.Delete("/stickers/:stickerId", sec.ValidatorMiddleware, deleteSticker)
}
}