2025-04-09 16:56:05 +08:00
|
|
|
package utils // 示例:插件接口
|
|
|
|
|
import (
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-01 17:59:10 +08:00
|
|
|
type Plugin interface {
|
2026-02-12 15:45:11 +08:00
|
|
|
//OnArticleCreate(article *models.Article) // 文章创建钩子
|
2025-04-01 17:59:10 +08:00
|
|
|
RegisterRoutes(r *gin.Engine) // 添加新路由
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 主题ZIP上传示例
|
|
|
|
|
func handleThemeUpload(c *gin.Context) {
|
|
|
|
|
file, _ := c.FormFile("theme")
|
|
|
|
|
if !strings.HasSuffix(file.Filename, ".zip") {
|
|
|
|
|
c.AbortWithStatus(400)
|
|
|
|
|
}
|
|
|
|
|
// 解压到临时目录并校验文件结构
|
2025-04-09 16:56:05 +08:00
|
|
|
}
|