feat: 分类/变体体系 + 用户认证 + 管理后台
- 运行时分类体系:Shell/Python/JavaScript/Ruby/PHP 各含变体 - 用户注册/登录(JWT + bcrypt),首个注册用户为管理员 - 管理后台 /admin 动态管理分类和变体 - 脚本市场支持按分类筛选 - CodeMirror 语言模式根据分类名称自动切换 - 结果页展示该分类下所有变体的运行命令 - source 命令变体用于 Shell 类继承环境变量 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"gitea.kmux.cn/zhilv/scriptforge/internal/config"
|
||||
"gitea.kmux.cn/zhilv/scriptforge/internal/service"
|
||||
)
|
||||
|
||||
@@ -25,12 +24,13 @@ func GetRawScript(svc *service.ScriptService) gin.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
rt, _ := config.GetRuntime(script.Runtime)
|
||||
mime := rt.MIMEType
|
||||
ext := rt.Extension
|
||||
if mime == "" {
|
||||
mime = "text/plain"
|
||||
ext = ".sh"
|
||||
// Use default variant for MIME/extension
|
||||
variant, verr := svc.GetDefaultVariant(script.CategoryID)
|
||||
mime := "text/plain"
|
||||
ext := ".sh"
|
||||
if verr == nil {
|
||||
mime = variant.MIMEType
|
||||
ext = variant.Extension
|
||||
}
|
||||
|
||||
c.Header("Content-Type", mime+"; charset=utf-8")
|
||||
@@ -38,4 +38,4 @@ func GetRawScript(svc *service.ScriptService) gin.HandlerFunc {
|
||||
c.Header("X-Content-Type-Options", "nosniff")
|
||||
c.String(http.StatusOK, script.Content)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user