-
Notifications
You must be signed in to change notification settings - Fork 193
fix(updater): 同步 updater pubkey 与新签名密钥对 #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
veyvin
wants to merge
13
commits into
Cloxl:main
Choose a base branch
from
veyvin:trae/agent-knpO3O
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4f82758
feat: 执行 Release 结果
veyvin 280f75d
Merge pull request #1 from veyvin/trae/agent-n1Cgnd
veyvin 799751a
feat: GoReleaser Git Tag Error
veyvin 5c4f5e5
Merge pull request #2 from veyvin/trae/agent-akbVM6
veyvin ddb1b71
feat: Fix Node.js and pnpm Compatibility
veyvin f39334e
Merge pull request #3 from veyvin/trae/agent-asms2i
veyvin 3e2ff6c
fix(ci): pin pnpm 9 to avoid ERR_PNPM_IGNORED_BUILDS on release
veyvin d34399d
ci: add TAURI_UPDATER_PRIVATE_KEY env for tauri-action
veyvin 6eddd72
Merge pull request #4 from veyvin/veyvin-improved-engine
veyvin d3427d0
feat: Tauri Build Failed: Secret Key Error
veyvin 1e3bb3c
Merge pull request #5 from veyvin/trae/agent-0KIATB
veyvin bc3c8ab
feat: Tauri Updater Private Key Error
veyvin d31eeeb
feat: Tauri Updater Private Key Error
veyvin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # 编译产物 | ||
| cursorpool-server | ||
| *.exe | ||
| *.dll | ||
| *.so | ||
| *.dylib | ||
|
|
||
| # 数据库文件 | ||
| data/ | ||
| *.db | ||
| *.db-journal | ||
| *.sqlite | ||
| *.sqlite3 | ||
|
|
||
| # IDE | ||
| .idea/ | ||
| .vscode/ | ||
| *.swp | ||
|
|
||
| # 日志 | ||
| *.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package config | ||
|
|
||
| import "os" | ||
|
|
||
| // Config 全局配置 | ||
| type Config struct { | ||
| Port string | ||
| JWTSecret string | ||
| DBPath string | ||
| APIPrefix string // 路由前缀,客户端请求 /api/xxx,这里反代去掉 /api | ||
| SMTPHost string | ||
| SMTPPort string | ||
| SMTPUser string | ||
| SMTPPass string | ||
| } | ||
|
|
||
| var App Config | ||
|
|
||
| func Load() { | ||
| App = Config{ | ||
| Port: getEnv("PORT", "8787"), | ||
| JWTSecret: getEnv("JWT_SECRET", "cursor-pool-demo-secret-change-me"), | ||
| DBPath: getEnv("DB_PATH", "./data/cursorpool.db"), | ||
| APIPrefix: getEnv("API_PREFIX", ""), // 直接挂在根路径,如需 /api 前缀由反代处理 | ||
| SMTPHost: getEnv("SMTP_HOST", ""), | ||
| SMTPPort: getEnv("SMTP_PORT", "465"), | ||
| SMTPUser: getEnv("SMTP_USER", ""), | ||
| SMTPPass: getEnv("SMTP_PASS", ""), | ||
| } | ||
| } | ||
|
|
||
| func getEnv(key, fallback string) string { | ||
| if v := os.Getenv(key); v != "" { | ||
| return v | ||
| } | ||
| return fallback | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| package database | ||
|
|
||
| import ( | ||
| "log" | ||
| "os" | ||
| "path/filepath" | ||
| "time" | ||
|
|
||
| "cursorpool-server/config" | ||
| "cursorpool-server/models" | ||
|
|
||
| "golang.org/x/crypto/bcrypt" | ||
| "gorm.io/driver/sqlite" | ||
| "gorm.io/gorm" | ||
| "gorm.io/gorm/logger" | ||
| ) | ||
|
|
||
| var DB *gorm.DB | ||
|
|
||
| // Init 初始化数据库并自动建表 + 写入种子数据 | ||
| func Init() { | ||
| // 确保 data 目录存在 | ||
| if dir := filepath.Dir(config.App.DBPath); dir != "" { | ||
| if err := os.MkdirAll(dir, 0755); err != nil { | ||
| log.Fatalf("创建数据库目录失败: %v", err) | ||
| } | ||
| } | ||
|
|
||
| db, err := gorm.Open(sqlite.Open(config.App.DBPath), &gorm.Config{ | ||
| Logger: logger.Default.LogMode(logger.Warn), | ||
| }) | ||
| if err != nil { | ||
| log.Fatalf("连接数据库失败: %v", err) | ||
| } | ||
| DB = db | ||
|
|
||
| // 自动建表(对齐客户端 types.rs 字段) | ||
| if err := db.AutoMigrate( | ||
| &models.User{}, | ||
| &models.CursorAccount{}, | ||
| &models.ActivationCode{}, | ||
| &models.Article{}, | ||
| &models.PublicInfo{}, | ||
| ); err != nil { | ||
| log.Fatalf("自动建表失败: %v", err) | ||
| } | ||
|
|
||
| seed(db) | ||
| } | ||
|
|
||
| // seed 写入演示数据,便于首次启动直接测试 | ||
| func seed(db *gorm.DB) { | ||
| // 默认账号(密码 123456) | ||
| var userCount int64 | ||
| db.Model(&models.User{}).Count(&userCount) | ||
| if userCount == 0 { | ||
| hash, _ := bcrypt.GenerateFromPassword([]byte("123456"), bcrypt.DefaultCost) | ||
| db.Create(&models.User{ | ||
| Email: "demo@cursorpool.test", | ||
| Password: string(hash), | ||
| Username: "demo", | ||
| Level: 1, | ||
| TotalCount: 100, | ||
| ExpireTime: time.Now().Add(365 * 24 * time.Hour), | ||
| }) | ||
| } | ||
|
|
||
| // 默认 Cursor 账户池 | ||
| var accCount int64 | ||
| db.Model(&models.CursorAccount{}).Count(&accCount) | ||
| if accCount == 0 { | ||
| db.Create(&models.CursorAccount{ | ||
| Email: "cursor-account-1@example.com", | ||
| Password: "dummy", | ||
| Token: "demo-cursor-token-1", | ||
| UsageCount: 0, | ||
| Status: 1, | ||
| }) | ||
| } | ||
|
|
||
| // 默认激活码 | ||
| var codeCount int64 | ||
| db.Model(&models.ActivationCode{}).Count(&codeCount) | ||
| if codeCount == 0 { | ||
| db.Create(&models.ActivationCode{ | ||
| Code: "DEMO2024", | ||
| Type: 1, | ||
| Name: "体验码", | ||
| Level: 1, | ||
| Duration: 30, | ||
| MaxUses: 1000, | ||
| UsedCount: 0, | ||
| Status: 1, | ||
| }) | ||
| } | ||
|
|
||
| // 默认公告 | ||
| var artCount int64 | ||
| db.Model(&models.Article{}).Count(&artCount) | ||
| if artCount == 0 { | ||
| db.Create(&models.Article{ | ||
| Title: "欢迎使用 Cursor Pool", | ||
| Content: "这是后端演示数据。请根据业务需求修改 handlers 目录下的实现。", | ||
| }) | ||
| } | ||
|
|
||
| // 默认公告信息 | ||
| var pubCount int64 | ||
| db.Model(&models.PublicInfo{}).Count(&pubCount) | ||
| if pubCount == 0 { | ||
| db.Create(&models.PublicInfo{ | ||
| Type: "info", | ||
| Closeable: true, | ||
| Title: "系统公告", | ||
| Description: "Cursor Pool 后端服务已启动", | ||
| ActionText: "前往官网", | ||
| ActionURL: "https://pool.52ai.org", | ||
| ActionType: "link", | ||
| }) | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk):
version这个 workflow 输入目前只用于 run-name,而不会用来决定实际的发布/标签版本。这种行为与输入描述不符,也可能会让用户误以为
version会控制发布/标签版本,而事实并非如此。请考虑要么将inputs.version接入Get Version逻辑(在其被设置时优先使用),要么更新描述,使其准确表达版本始终来自package.json。Original comment in English
suggestion (bug_risk): The
versionworkflow input is only used for the run-name and not for determining the actual release/tag version.This behavior doesn’t match the input description and may suggest to users that
versioncontrols the release/tag version when it doesn’t. Please either routeinputs.versioninto theGet Versionlogic (preferring it when set) or update the description so it accurately reflects that the version always comes frompackage.json.