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:
2026-05-29 15:02:20 +08:00
parent 58a80cb196
commit 5414c9c865
24 changed files with 1309 additions and 295 deletions

View File

@@ -0,0 +1,21 @@
package seed
import (
"gorm.io/gorm"
"gitea.kmux.cn/zhilv/scriptforge/internal/model"
)
func Run(db *gorm.DB) {
// Seed categories only if table is empty
var count int64
db.Model(&model.RuntimeCategory{}).Count(&count)
if count == 0 {
for i, cat := range model.DefaultCategories {
cat.ID = uint(i + 1)
db.Create(&cat)
}
for _, v := range model.DefaultVariants {
db.Create(&v)
}
}
}