Moment editor C-V upload attachment

This commit is contained in:
2024-03-20 22:32:50 +08:00
parent 298e1fe617
commit 30e55a5c6e
3 changed files with 63 additions and 38 deletions

View File

@ -1,14 +1,15 @@
package server
import (
"path/filepath"
"git.solsynth.dev/hydrogen/interactive/pkg/models"
"git.solsynth.dev/hydrogen/interactive/pkg/services"
"github.com/gofiber/fiber/v2"
"github.com/spf13/viper"
"path/filepath"
)
func openAttachment(c *fiber.Ctx) error {
func readAttachment(c *fiber.Ctx) error {
id := c.Params("fileId")
basepath := viper.GetString("content")

View File

@ -66,7 +66,7 @@ func NewServer() {
api.Get("/attachments/o/:fileId", cache.New(cache.Config{
Expiration: 365 * 24 * time.Hour,
CacheControl: true,
}), openAttachment)
}), readAttachment)
api.Post("/attachments", authMiddleware, uploadAttachment)
api.Get("/feed", listFeed)