Skip to content

Commit

Permalink
Merge branch 'main' into feature-container-architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored Apr 2, 2023
2 parents beceb01 + f5593d0 commit 7b61d2f
Show file tree
Hide file tree
Showing 21 changed files with 169 additions and 101 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ rules:
jquery/no-parse-html: [2]
jquery/no-prop: [0]
jquery/no-proxy: [2]
jquery/no-ready: [0]
jquery/no-ready: [2]
jquery/no-serialize: [2]
jquery/no-show: [2]
jquery/no-size: [2]
Expand Down
9 changes: 8 additions & 1 deletion models/auth/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,14 @@ func UpdateSource(source *Source) error {
}
}

_, err := db.GetEngine(db.DefaultContext).ID(source.ID).AllCols().Update(source)
has, err := db.GetEngine(db.DefaultContext).Where("name=? AND id!=?", source.Name, source.ID).Exist(new(Source))
if err != nil {
return err
} else if has {
return ErrSourceAlreadyExist{source.Name}
}

_, err = db.GetEngine(db.DefaultContext).ID(source.ID).AllCols().Update(source)
if err != nil {
return err
}
Expand Down
10 changes: 5 additions & 5 deletions modules/public/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ func AssetsHandlerFunc(opts *Options) http.HandlerFunc {
return
}

var corsSent bool
if opts.CorsHandler != nil {
var corsSent bool
opts.CorsHandler(http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
corsSent = true
})).ServeHTTP(resp, req)
}
// If CORS is not sent, the response must have been written by other handlers
if !corsSent {
return
// If CORS is not sent, the response must have been written by other handlers
if !corsSent {
return
}
}

file := req.URL.Path[len(opts.Prefix):]
Expand Down
12 changes: 8 additions & 4 deletions options/locale/locale_pt-PT.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2140,10 +2140,10 @@ settings.dismiss_stale_approvals_desc=Quando novos cometimentos que mudam o cont
settings.require_signed_commits=Exigir cometimentos assinados
settings.require_signed_commits_desc=Rejeitar envios para este ramo que não estejam assinados ou que não sejam validáveis.
settings.protect_branch_name_pattern=Padrão do nome do ramo protegido
settings.protect_protected_file_patterns=`Padrões de ficheiros protegidos (separados com ponto e vírgula ' ;'):`
settings.protect_protected_file_patterns_desc=`Não é permitido alterar imediatamente ficheiros protegidos, mesmo que o utilizador tenha autorização para adicionar, editar ou eliminar ficheiros neste ramo. Podem ser usados múltiplos padrões separados por ponto e vírgula (' ;'). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.`
settings.protect_unprotected_file_patterns=`Padrões de ficheiros desprotegidos (separados com ponto e vírgula ' ;'):`
settings.protect_unprotected_file_patterns_desc=`Ficheiros desprotegidos que é permitido alterar imediatamente se o utilizador tiver permissão de escrita, passando ao lado da restrição no envio. Podem ser usados múltiplos padrões separados por ponto e vírgula (' ;'). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.`
settings.protect_protected_file_patterns=Padrões de ficheiros protegidos (separados com ponto e vírgula ';'):
settings.protect_protected_file_patterns_desc=Ficheiros protegidos não podem ser modificados imediatamente, mesmo que o utilizador tenha direitos para adicionar, editar ou eliminar ficheiros neste ramo. Múltiplos padrões podem ser separados com ponto e vírgula (';'). Veja a documentação em <a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a> para ver a sintaxe. Exemplos: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.
settings.protect_unprotected_file_patterns=Padrões de ficheiros desprotegidos (separados com ponto e vírgula ';'):
settings.protect_unprotected_file_patterns_desc=Ficheiros desprotegidos que podem ser modificados imediatamente se o utilizador tiver direitos de escrita, contornando a restrição no envio. Múltiplos padrões podem ser separados com ponto e vírgula (';'). Veja a documentação em <a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a> para ver a sintaxe. Exemplos: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.
settings.add_protected_branch=Habilitar salvaguarda
settings.delete_protected_branch=Desabilitar salvaguarda
settings.update_protect_branch_success=A salvaguarda do ramo '%s' foi modificada.
Expand Down Expand Up @@ -2280,6 +2280,8 @@ diff.image.side_by_side=Lado a Lado
diff.image.swipe=Deslizar
diff.image.overlay=Sobrepor
diff.has_escaped=Esta linha tem caracteres unicode escondidos
diff.show_file_tree=Mostrar árvore de ficheiros
diff.hide_file_tree=Esconder árvore de ficheiros

releases.desc=Acompanhe as versões e as descargas do repositório.
release.releases=Lançamentos
Expand All @@ -2293,6 +2295,7 @@ release.compare=Comparar
release.edit=editar
release.ahead.commits=<strong>%d</strong> cometimentos
release.ahead.target=para %s desde este lançamento
tag.ahead.target=para o ramo %s desde esta etiqueta
release.source_code=Código fonte
release.new_subheader=Lançamentos organizam as versões do trabalho.
release.edit_subheader=Lançamentos organizam as versões do trabalho.
Expand Down Expand Up @@ -3364,6 +3367,7 @@ runners.status.idle=Parada
runners.status.active=Em funcionamento
runners.status.offline=Desconectada
runners.version=Versão
runners.reset_registration_token_success=O código de incrição do executor foi reposto com sucesso

runs.all_workflows=Todas as sequências de trabalho
runs.open_tab=%d abertas
Expand Down
17 changes: 13 additions & 4 deletions options/locale/locale_zh-CN.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@ release=版本发布
releases=版本发布
tag=Git标签
released_this=发布
tagged_this=已标记
file.title=%s 位于 %s
file_raw=原始文件
file_history=文件历史
Expand Down Expand Up @@ -1276,6 +1277,7 @@ issues.choose.blank=默认模板
issues.choose.blank_about=从默认模板创建一个工单。
issues.choose.ignore_invalid_templates=已忽略无效模板
issues.choose.invalid_templates=发现了 %v 个无效模板
issues.choose.invalid_config=问题配置包含错误:
issues.no_ref=分支/标记未指定
issues.create=创建工单
issues.new_label=创建标签
Expand Down Expand Up @@ -1489,6 +1491,9 @@ issues.due_date_invalid=到期日期无效或超出范围。请使用 'yyyy-mm-d
issues.dependency.title=依赖工单
issues.dependency.issue_no_dependencies=没有设置依赖项。
issues.dependency.pr_no_dependencies=没有设置依赖项。
issues.dependency.no_permission_1=您没有读取 %d 依赖关系的权限
issues.dependency.no_permission_n=您没有读取 %d 依赖关系的权限
issues.dependency.no_permission.can_remove=您没有读取此依赖关系的权限,但可以删除此依赖关系
issues.dependency.add=添加依赖工单...
issues.dependency.cancel=取消
issues.dependency.remove=删除
Expand Down Expand Up @@ -2135,10 +2140,10 @@ settings.dismiss_stale_approvals_desc=当新的提交更改合并请求内容被
settings.require_signed_commits=需要签名提交
settings.require_signed_commits_desc=拒绝推送未签名或无法验证的提交到分支
settings.protect_branch_name_pattern=受保护的分支名称模式
settings.protect_protected_file_patterns=`"受保护的文件模式 (使用分号 '\;' 分隔):" ;'):``
settings.protect_protected_file_patterns_desc=`即使用户有权添加、编辑或删除此分支中的文件,也不允许直接更改受保护的文件。 可以使用分号分隔多个模式(' ;'). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.`
settings.protect_unprotected_file_patterns=`不受保护的文件模式 (使用分号分隔 ' ;'):`
settings.protect_unprotected_file_patterns_desc=`如果用户有写入权限,则允许直接更改的不受保护的文件,以绕过推送限制。可以使用分号分隔多重模式 (' ;'). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.`
settings.protect_protected_file_patterns=受保护的文件模式(使用分号 ';' 分隔):
settings.protect_protected_file_patterns_desc=即使用户有权添加、编辑或删除此分支中的文件,也不允许直接更改受保护的文件。 可以使用分号 (';') 分隔多个模式。 见<a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a>文档了解模式语法。例如: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>
settings.protect_unprotected_file_patterns=不受保护的文件模式(使用分号 ';' 分隔):
settings.protect_unprotected_file_patterns_desc=如果用户有写权限,则允许直接更改的不受保护的文件,以绕过推送限制。可以使用分号分隔多个模式 (';')。 见 <a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a> 文档了解模式语法。例如: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>
settings.add_protected_branch=启用保护
settings.delete_protected_branch=禁用保护
settings.update_protect_branch_success=分支 "%s" 的分支保护已更新。
Expand Down Expand Up @@ -2275,6 +2280,8 @@ diff.image.side_by_side=双排
diff.image.swipe=滑动
diff.image.overlay=叠加
diff.has_escaped=这一行有隐藏的 Unicode 字符
diff.show_file_tree=显示文件树
diff.hide_file_tree=隐藏文件树

releases.desc=跟踪项目版本和下载。
release.releases=版本发布
Expand All @@ -2288,6 +2295,7 @@ release.compare=比较
release.edit=编辑
release.ahead.commits=<strong>%d</strong> 次提交
release.ahead.target=在此版本发布后被加入到 %s
tag.ahead.target=自此标签到 %s
release.source_code=源代码
release.new_subheader=版本发布组织项目的版本。
release.edit_subheader=版本发布组织项目的版本。
Expand Down Expand Up @@ -3359,6 +3367,7 @@ runners.status.idle=空闲
runners.status.active=激活
runners.status.offline=离线
runners.version=版本
runners.reset_registration_token_success=成功重置运行器注册令牌
runs.all_workflows=所有工作流
runs.open_tab=%d 开启中
Expand Down
10 changes: 10 additions & 0 deletions options/locale/locale_zh-TW.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,7 @@ issues.choose.blank=預設
issues.choose.blank_about=從預設範本建立問題。
issues.choose.ignore_invalid_templates=已忽略無效的範本
issues.choose.invalid_templates=找到了 %v 個無效的範本
issues.choose.invalid_config=問題設定包含錯誤:
issues.no_ref=未指定分支或標籤
issues.create=建立問題
issues.new_label=新增標籤
Expand Down Expand Up @@ -1935,6 +1936,7 @@ settings.trust_model.collaborator.long=協作者: 信任協作者的簽署
settings.trust_model.collaborator.desc=此儲存庫協作者的有效簽署將被標記為「受信任」(無論它們是否符合提交者),簽署只符合提交者時將標記為「不受信任」,都不符合時標記為「不符合」。
settings.trust_model.committer=提交者
settings.trust_model.committer.long=提交者: 信任與提交者相符的簽署 (此選項與 GitHub 相同,這會強制 Gitea 簽署提交並以 Gitea 作為提交者)
settings.trust_model.committer.desc=提交者的有效簽署將被標記為「受信任」,否則將被標記為「不符合」。這將會強制 Gitea 成為受簽署提交的提交者,實際的提交者將於提交訊息結尾被標記為「Co-authored-by:」和「Co-committed-by:」。預設的 Gitea 金鑰必須符合資料庫中的一位使用者。
settings.trust_model.collaboratorcommitter=協作者+提交者
settings.trust_model.collaboratorcommitter.long=協作者 + 提交者: 信任協作者同時是提交者的簽署
settings.trust_model.collaboratorcommitter.desc=此儲存庫協作者的有效簽署在他同時是提交者時將被標記為「受信任」,簽署只符合提交者時將標記為「不受信任」,都不符合時標記為「不符合」。這會強制 Gitea 成為受簽署提交的提交者,實際的提交者將於提交訊息結尾被標記為「Co-Authored-By:」和「Co-Committed-By:」。預設的 Gitea 金鑰必須符合資料庫中的一位使用者。
Expand Down Expand Up @@ -2134,6 +2136,10 @@ settings.dismiss_stale_approvals_desc=當新的提交有修改到合併請求的
settings.require_signed_commits=僅接受經簽署的提交
settings.require_signed_commits_desc=拒絕未經簽署或未經驗證的提交推送到此分支。
settings.protect_branch_name_pattern=受保護的分支名稱模式
settings.protect_protected_file_patterns=受保護的檔案模式 (以分號區隔「;」):
settings.protect_protected_file_patterns_desc=即便使用者有權限新增、修改、刪除此分支的檔案,仍不允許直接修改受保護的檔案。可以用半形分號「;」分隔多個模式。請於 <a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a> 文件查看模式格式。範例: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>。
settings.protect_unprotected_file_patterns=未受保護的檔案模式 (以分號區隔「;」):
settings.protect_unprotected_file_patterns_desc=當使用者有寫入權限時,可繞過推送限制,直接修改未受保護的檔案。可以用半形分號「;」分隔多個模式。請於 <a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a> 文件查看模式格式。範例: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>。
settings.add_protected_branch=啟用保護
settings.delete_protected_branch=停用保護
settings.update_protect_branch_success=已更新「%s」的分支保護。
Expand Down Expand Up @@ -2270,6 +2276,8 @@ diff.image.side_by_side=並列
diff.image.swipe=滑動
diff.image.overlay=重疊
diff.has_escaped=這一行有隱藏的 Unicode 字元
diff.show_file_tree=顯示檔案樹狀圖
diff.hide_file_tree=隱藏檔案樹狀圖

releases.desc=追蹤專案版本和檔案下載。
release.releases=版本發布
Expand All @@ -2283,6 +2291,7 @@ release.compare=比較
release.edit=編輯
release.ahead.commits=<strong>%d</strong> 次提交
release.ahead.target=在此版本發布後被加入到 %s
tag.ahead.target=在此標籤後被加入到 %s
release.source_code=程式碼
release.new_subheader=發布、整理專案的版本。
release.edit_subheader=發布、整理專案的版本。
Expand Down Expand Up @@ -3354,6 +3363,7 @@ runners.status.idle=閒置
runners.status.active=啟用
runners.status.offline=離線
runners.version=版本
runners.reset_registration_token_success=成功重設了 Runner 註冊 Token

runs.all_workflows=所有工作流程
runs.open_tab=%d 開放中
Expand Down
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"add-asset-webpack-plugin": "2.0.1",
"ansi-to-html": "0.7.2",
"asciinema-player": "3.2.0",
"clippie": "3.1.4",
"css-loader": "6.7.3",
"dropzone": "6.0.0-beta.2",
"easymde": "2.18.0",
Expand Down Expand Up @@ -55,6 +56,7 @@
"@playwright/test": "1.31.2",
"@rollup/pluginutils": "5.0.2",
"@stoplight/spectral-cli": "6.6.0",
"@vitejs/plugin-vue": "4.1.0",
"eslint": "8.36.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jquery": "1.5.1",
Expand Down
6 changes: 4 additions & 2 deletions routers/web/admin/auths.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,11 @@ func EditAuthSourcePost(ctx *context.Context) {
source.IsActive = form.IsActive
source.IsSyncEnabled = form.IsSyncEnabled
source.Cfg = config
// FIXME: if the name conflicts, it will result in 500: Error 1062: Duplicate entry 'aa' for key 'login_source.UQE_login_source_name'
if err := auth.UpdateSource(source); err != nil {
if oauth2.IsErrOpenIDConnectInitialize(err) {
if auth.IsErrSourceAlreadyExist(err) {
ctx.Data["Err_Name"] = true
ctx.RenderWithErr(ctx.Tr("admin.auths.login_source_exist", err.(auth.ErrSourceAlreadyExist).Name), tplAuthEdit, form)
} else if oauth2.IsErrOpenIDConnectInitialize(err) {
ctx.Flash.Error(err.Error(), true)
ctx.Data["Err_DiscoveryURL"] = true
ctx.HTML(http.StatusOK, tplAuthEdit)
Expand Down
8 changes: 3 additions & 5 deletions templates/home.tmpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{{template "base/head" .}}
<div role="main" aria-label="{{if .IsSigned}}{{.locale.Tr "dashboard"}}{{else}}{{.locale.Tr "home"}}{{end}}" class="page-content home">
<div class="ui stackable middle very relaxed page grid">
<div class="sixteen wide center aligned centered column">
<div>
<img class="logo" width="220" height="220" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{.locale.Tr "logo"}}">
</div>
<div class="gt-mb-5 gt-px-5">
<div class="center">
<img class="logo" width="220" height="220" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{.locale.Tr "logo"}}">
<div class="hero">
<h1 class="ui icon header title">
{{AppName}}
Expand Down
1 change: 1 addition & 0 deletions templates/repo/diff/comment_form.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
{{if $.reply}}
<button class="ui submit green tiny button btn-reply" type="submit">{{$.root.locale.Tr "repo.diff.comment.reply"}}</button>
<input type="hidden" name="reply" value="{{$.reply}}">
<input type="hidden" name="single_review" value="true">
{{else}}
{{if $.root.CurrentReview}}
<button name="pending_review" type="submit" class="ui submit green tiny button btn-add-comment">{{$.root.locale.Tr "repo.diff.comment.add_review_comment"}}</button>
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/issue/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
{{.locale.Tr "repo.issues.filter_sort"}}
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
</span>
<div class="left menu">
<div class="menu">
<a class="{{if or (eq .SortType "latest") (not .SortType)}}active {{end}}item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort=latest&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_sort.latest"}}</a>
<a class="{{if eq .SortType "oldest"}}active {{end}}item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort=oldest&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_sort.oldest"}}</a>
<a class="{{if eq .SortType "recentupdate"}}active {{end}}item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort=recentupdate&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_sort.recentupdate"}}</a>
Expand Down
2 changes: 2 additions & 0 deletions vitest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {defineConfig} from 'vitest/dist/config.js';
import {readFile} from 'node:fs/promises';
import {dataToEsm} from '@rollup/pluginutils';
import {extname} from 'node:path';
import vue from '@vitejs/plugin-vue';

function stringPlugin() {
return {
Expand All @@ -28,5 +29,6 @@ export default defineConfig({
},
plugins: [
stringPlugin(),
vue(),
],
});
Loading

0 comments on commit 7b61d2f

Please sign in to comment.