diff --git a/models/devcontainer/devcontainer.go b/models/devcontainer/devcontainer.go index e0f296f5a3..61cde07003 100644 --- a/models/devcontainer/devcontainer.go +++ b/models/devcontainer/devcontainer.go @@ -43,6 +43,7 @@ type DevcontainerScript struct { } func init() { + db.RegisterModel(new(Devcontainer)) db.RegisterModel(new(DevcontainerScript)) db.RegisterModel(new(DevcontainerOutput)) @@ -54,7 +55,7 @@ func GetScript(ctx context.Context, userId, repoID int64) (map[string]string, er // Devstar level // 从远程获取Devstar变量 client := &http.Client{} - req, err := http.NewRequest("GET", "http://192.168.245.128:3000/variables/export", nil) + req, err := http.NewRequest("GET", "http://devstar.cn/variables/export", nil) if err != nil { log.Error("Failed to create request for devstar variables: %v", err) } else { diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 5be7a6a4a8..bf7f52b7d8 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -3846,7 +3846,7 @@ variables.creation = Add Variable variables.none = There are no variables yet. variables.deletion = Remove variable variables.deletion.description = Removing a variable is permanent and cannot be undone. Continue? -variables.description = Variables will be passed to certain actions and cannot be read otherwise. +variables.description = 1. As a variable: "$variable name" can be referenced in the variable value and the script specified in devcontainer.json.
2. As a script: Script management adds variable names to become the initialization script content of the development container. variables.id_not_exist = Variable with ID %d does not exist. variables.edit = Edit Variable variables.deletion.failed = Failed to remove variable. @@ -3855,7 +3855,8 @@ variables.creation.failed = Failed to add variable. variables.creation.success = The variable "%s" has been added. variables.update.failed = Failed to edit variable. variables.update.success = The variable has been edited. - +scripts=Script Management +scripts.description=Add variable names to become the initialization script content of the development container, with the priority being: User > Repository > Administrator. [actions] actions = Actions diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 5ffdaca41f..f474eb793c 100644 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -3834,7 +3834,7 @@ variables.creation=添加变量 variables.none=目前还没有变量。 variables.deletion=删除变量 variables.deletion.description=删除变量是永久性的,无法撤消。继续吗? -variables.description=使用$加变量名可以引用。 +variables.description=1.作为变量使用:「$变量名」可以在变量值和devcontainer.json指定的脚本中引用。
2.作为脚本使用:脚本管理添加变量名成为开发容器的初始化脚本内容。 variables.id_not_exist=ID为 %d 的变量不存在。 variables.edit=编辑变量 variables.deletion.failed=变量删除失败。 @@ -3843,8 +3843,8 @@ variables.creation.failed=变量添加失败。 variables.creation.success=变量「%s」添加成功。 variables.update.failed=变量编辑失败。 variables.update.success=变量已编辑。 - - +scripts=脚本管理 +scripts.description=添加变量名成为开发容器的初始化脚本内容,优先级:用户>仓库>管理员。 [actions] actions=工作流 diff --git a/routers/web/devcontainer/devstar_home.go b/routers/web/devcontainer/devstar_home.go index 4fc8c8935e..482a9d55e7 100644 --- a/routers/web/devcontainer/devstar_home.go +++ b/routers/web/devcontainer/devstar_home.go @@ -8,14 +8,14 @@ import ( ) const ( - // TplDevstarHome 显示 DevStar Home 页面 templates/vscode-home.tmpl - TplDevstarHome templates.TplName = "repo/devcontainer/vscode-home" + // TplVscodeHome 显示 Vscode Home 页面 templates/vscode-home.tmpl + TplVscodeHome templates.TplName = "repo/devcontainer/vscode-home" ) -// DevstarHome 渲染适配于 VSCode 插件的 DevStar Home 页面 -func DevstarHome(ctx *gitea_web_context.Context) { +// VscodeHome 渲染适配于 VSCode 插件的 Vscode Home 页面 +func VscodeHome(ctx *gitea_web_context.Context) { ctx.Data["Title"] = ctx.Tr("home") ctx.Resp.Header().Del("X-Frame-Options") //ctx.Resp.Header().Set("Content-Security-Policy", "frame-ancestors *") - ctx.HTML(http.StatusOK, TplDevstarHome) + ctx.HTML(http.StatusOK, TplVscodeHome) } diff --git a/routers/web/web.go b/routers/web/web.go index 87788cbe00..db067777f5 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1439,7 +1439,7 @@ func registerWebRoutes(m *web.Router) { // 具有code读取权限 context.RepoAssignment, reqUnitCodeReader, ) - m.Get("/devstar-home", devcontainer_web.DevstarHome) + m.Get("/devstar-home", devcontainer_web.VscodeHome) m.Group("/api/devcontainer", func() { // 获取 某用户在某仓库中的 DevContainer 细节(包括SSH连接信息),默认不会等待 (wait = false) // 请求方式: GET /api/devcontainer?repoId=${repoId}&wait=true // 无需传入 userId,直接从 token 中提取 diff --git a/templates/shared/devcontainer/variable_list.tmpl b/templates/shared/devcontainer/variable_list.tmpl index 2731f906ef..4289b25b77 100644 --- a/templates/shared/devcontainer/variable_list.tmpl +++ b/templates/shared/devcontainer/variable_list.tmpl @@ -1,9 +1,12 @@

- 脚本管理 + {{ctx.Locale.Tr "devcontainer.scripts"}}

-{{if or .Variables .DevstarVariables}} -
-{{end}} +
+ {{ctx.Locale.Tr "devcontainer.scripts.description"}} + {{if or .Variables .DevstarVariables}} +
+ {{end}} +

{{ctx.Locale.Tr "devcontainer.variables.management"}}
@@ -171,7 +174,7 @@ function initDynamicTags() { const inputContainer = document.createElement('span'); inputContainer.className = 'tag-input-container'; inputContainer.innerHTML = ` - + `;