This commit is contained in:
init
2025-10-16 16:53:19 +08:00
repo.diff.parent 10cadede44
repo.diff.commit fea3674818
repo.diff.stats_desc%!(EXTRA int=6, int=22, int=17)

repo.diff.view_file

@@ -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 {

repo.diff.view_file

@@ -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. <br>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

repo.diff.view_file

@@ -3834,7 +3834,7 @@ variables.creation=添加变量
variables.none=目前还没有变量。
variables.deletion=删除变量
variables.deletion.description=删除变量是永久性的,无法撤消。继续吗?
variables.description=使用$加变量名可以引用
variables.description=1.作为变量使用:「$变量名可以在变量值和devcontainer.json指定的脚本中引用。<br>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=工作流

repo.diff.view_file

@@ -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)
}

repo.diff.view_file

@@ -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 中提取

repo.diff.view_file

@@ -1,9 +1,12 @@
<h4 class="ui top attached header">
脚本管理
{{ctx.Locale.Tr "devcontainer.scripts"}}
</h4>
{{if or .Variables .DevstarVariables}}
<div class="dynamic-tags" data-tags='{{.Tags}}'></div>
{{end}}
<div class="ui attached segment">
{{ctx.Locale.Tr "devcontainer.scripts.description"}}
{{if or .Variables .DevstarVariables}}
<div class="dynamic-tags" data-tags='{{.Tags}}'></div>
{{end}}
</div>
<h4 class="ui top attached header">
{{ctx.Locale.Tr "devcontainer.variables.management"}}
<div class="ui right">
@@ -171,7 +174,7 @@ function initDynamicTags() {
const inputContainer = document.createElement('span');
inputContainer.className = 'tag-input-container';
inputContainer.innerHTML = `
<button class="tag-add-button">+ New Tag</button>
<button class="tag-add-button">+ New Script</button>
<input type="text" class="tag-input" style="display: none;" placeholder="Enter tag">
`;