Image proxy preview

This commit is contained in:
2025-03-30 21:28:24 +08:00
parent 820d7a9f42
commit f306ee2e1e
5 changed files with 28 additions and 9 deletions

View File

@ -2,9 +2,10 @@ package api
import (
"fmt"
"github.com/spf13/viper"
"strings"
"github.com/spf13/viper"
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
"git.solsynth.dev/hypernet/paperclip/pkg/internal/database"
"git.solsynth.dev/hypernet/paperclip/pkg/internal/server/exts"
@ -40,9 +41,9 @@ func openAttachment(c *fiber.Ctx) error {
var err error
var url, mimetype string
if len(region) > 0 {
url, mimetype, err = services.OpenAttachmentByRID(id, region)
url, mimetype, err = services.OpenAttachmentByRID(id, c.QueryBool("preview", true), region)
} else {
url, mimetype, err = services.OpenAttachmentByRID(id)
url, mimetype, err = services.OpenAttachmentByRID(id, c.QueryBool("preview", true))
}
if err != nil {

View File

@ -2,12 +2,13 @@ package api
import (
"fmt"
"github.com/samber/lo"
"strings"
"github.com/samber/lo"
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
"git.solsynth.dev/hypernet/paperclip/pkg/internal/database"
"git.solsynth.dev/hypernet/paperclip/pkg/filekit/models"
"git.solsynth.dev/hypernet/paperclip/pkg/internal/database"
"git.solsynth.dev/hypernet/paperclip/pkg/internal/server/exts"
"git.solsynth.dev/hypernet/paperclip/pkg/internal/services"
"github.com/gofiber/fiber/v2"
@ -42,9 +43,9 @@ func openStickerByAlias(c *fiber.Ctx) error {
var url, mimetype string
if len(region) > 0 {
url, mimetype, err = services.OpenAttachmentByRID(sticker.Attachment.Rid, region)
url, mimetype, err = services.OpenAttachmentByRID(sticker.Attachment.Rid, true, region)
} else {
url, mimetype, err = services.OpenAttachmentByRID(sticker.Attachment.Rid)
url, mimetype, err = services.OpenAttachmentByRID(sticker.Attachment.Rid, true)
}
if err != nil {