pkg

package
v0.0.0-...-b03f85f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserKey = "user"
)

Variables

This section is empty.

Functions

func CheckFFmpegInstalled

func CheckFFmpegInstalled() bool

CheckFFmpegInstalled 检查 FFmpeg 是否已安装

func ClearUserSession

func ClearUserSession(c *gin.Context) error

清除用户会话

func CompressImageWithFFmpeg

func CompressImageWithFFmpeg(inputData []byte, ext string) ([]byte, error)

CompressImageWithFFmpeg 使用 FFmpeg 压缩图片

func CompressVideoWithFFmpeg

func CompressVideoWithFFmpeg(inputPath string) (string, error)

func GetFirstLine

func GetFirstLine(text string) string

GetFirstLine 获取文本的第一行作为标题

func GetUserSession

func GetUserSession(c *gin.Context) (models.User, bool)

获取用户会话

func InitSession

func InitSession(r *gin.Engine)

初始化 Session

func MD5Encrypt

func MD5Encrypt(str string) string

MD5Encrypt 使用 MD5 算法加密字符串

func MdToHTML

func MdToHTML(md []byte) []byte

渲染 Markdown 为 HTML

func SaveUserSession

func SaveUserSession(c *gin.Context, user models.User) error

保存用户会话

func TruncateText

func TruncateText(text string, maxLength int) string

TruncateText 截取文本,保持完整的单词

func UploadAttachmentToCloud

func UploadAttachmentToCloud(cfg *models.SiteConfig, fileName string, content io.ReadSeeker, contentType string) (string, error)

UploadAttachmentToCloud 上传附件到云存储

func UploadImage

func UploadImage(c *gin.Context, allowedExtensions []string, siteConfig *models.SiteConfig) (string, error)

UploadImage 上传图片并返回图片的URL

func UploadVideo

func UploadVideo(c *gin.Context, allowedExtensions []string, siteConfig *models.SiteConfig) (string, error)

UploadVideo 上传视频并返回视频的URL

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址