Skip to content

Commit 8ceaf14

Browse files
committed
Merge branch 'main' of github.com:0xis-cn/gitea into main
2 parents e80db9b + 1816c7f commit 8ceaf14

File tree

13 files changed

+42
-74
lines changed

13 files changed

+42
-74
lines changed

.github/workflows/pull-e2e-tests.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected]
3939
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
4040
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1
4141
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1
42-
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1
42+
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1.7.9
4343
GOPLS_PACKAGE ?= golang.org/x/tools/[email protected]
4444

4545
DOCKER_IMAGE ?= gitea/gitea

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
gitea.com/go-chi/binding v0.0.0-20240430071103-39a851e106ed
1818
gitea.com/go-chi/cache v0.2.1
1919
gitea.com/go-chi/captcha v0.0.0-20240315150714-fb487f629098
20-
gitea.com/go-chi/session v0.0.0-20250926004215-636cadd82e15
20+
gitea.com/go-chi/session v0.0.0-20251124165456-68e0254e989e
2121
gitea.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96
2222
gitea.com/lunny/levelqueue v0.4.2-0.20230414023320-3c0159fe0fe4
2323
github.com/42wim/httpsig v1.2.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ gitea.com/go-chi/cache v0.2.1 h1:bfAPkvXlbcZxPCpcmDVCWoHgiBSBmZN/QosnZvEC0+g=
4141
gitea.com/go-chi/cache v0.2.1/go.mod h1:Qic0HZ8hOHW62ETGbonpwz8WYypj9NieU9659wFUJ8Q=
4242
gitea.com/go-chi/captcha v0.0.0-20240315150714-fb487f629098 h1:p2ki+WK0cIeNQuqjR98IP2KZQKRzJJiV7aTeMAFwaWo=
4343
gitea.com/go-chi/captcha v0.0.0-20240315150714-fb487f629098/go.mod h1:LjzIOHlRemuUyO7WR12fmm18VZIlCAaOt9L3yKw40pk=
44-
gitea.com/go-chi/session v0.0.0-20250926004215-636cadd82e15 h1:qFYmz05u/s9664o7+XEgrlHXSPQ4uHO8/ccZGUb1uxA=
45-
gitea.com/go-chi/session v0.0.0-20250926004215-636cadd82e15/go.mod h1:0iEpFKnwO5dG0aF98O4eq6FMsAiXkNBaDIlUOlq4BtM=
44+
gitea.com/go-chi/session v0.0.0-20251124165456-68e0254e989e h1:4bugwPyGMLvblEm3pZ8fZProSPVxE4l0UXF2Kv6IJoY=
45+
gitea.com/go-chi/session v0.0.0-20251124165456-68e0254e989e/go.mod h1:KDvcfMUoXfATPHs2mbMoXFTXT45/FAFAS39waz9tPk0=
4646
gitea.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96 h1:+wWBi6Qfruqu7xJgjOIrKVQGiLUZdpKYCZewJ4clqhw=
4747
gitea.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96/go.mod h1:VyMQP6ue6MKHM8UsOXfNfuMKD0oSAWZdXVcpHIN2yaY=
4848
gitea.com/lunny/levelqueue v0.4.2-0.20230414023320-3c0159fe0fe4 h1:IFT+hup2xejHqdhS7keYWioqfmxdnfblFDTGoOwcZ+o=

modules/auth/webauthn/webauthn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var WebAuthn *webauthn.WebAuthn
2222

2323
// Init initializes the WebAuthn instance from the config.
2424
func Init() {
25-
gob.Register(&webauthn.SessionData{})
25+
gob.Register(&webauthn.SessionData{}) // TODO: CHI-SESSION-GOB-REGISTER.
2626

2727
appURL, _ := protocol.FullyQualifiedOrigin(setting.AppURL)
2828

options/locale/locale_zh-CN.ini

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ need_account=需要一个帐户?
426426
sign_up_tip=您正在系统中注册第一个帐户,它拥有管理员权限。请仔细记住您的用户名和密码。 如果您忘记了用户名或密码,请参阅 Gitea 文档以恢复账户。
427427
sign_up_now=立即注册。
428428
sign_up_successful=帐户创建成功。欢迎!
429-
confirmation_mail_sent_prompt_ex=一封新的确认邮件已经发送到 <b>%s</b>。请在下一个 %s 中检查您的收件箱以完成注册流程。 如果您的注册邮箱地址不正确,您可以重新登录并更改它。
429+
confirmation_mail_sent_prompt_ex=一封新的确认邮件已经发送到 <b>%s</b>。请在 %s 内检查您的收件箱以完成注册流程。 如果您的注册邮箱地址不正确,您可以重新登录并更改它。
430430
must_change_password=更新您的密码
431431
allow_password_change=要求用户更改密码(推荐)
432432
reset_password_mail_sent_prompt=确认邮件已被发送到 <b>%s</b>。请您在 %s 内检查您的收件箱 ,完成密码重置流程。
@@ -1483,6 +1483,7 @@ projects.column.new_submit=创建列
14831483
projects.column.new=创建列
14841484
projects.column.set_default=设为默认
14851485
projects.column.set_default_desc=设置此列为未分类问题和合并请求的默认值
1486+
projects.column.default_column_hint=添加到此项目的新议题将被添加到此列
14861487
projects.column.delete=删除列
14871488
projects.column.deletion_desc=删除项目列会将所有相关问题移至默认列。是否继续?
14881489
projects.column.color=颜色
@@ -1970,6 +1971,9 @@ pulls.status_checks_requested=必须
19701971
pulls.status_checks_details=详情
19711972
pulls.status_checks_hide_all=隐藏所有检查
19721973
pulls.status_checks_show_all=显示所有检查
1974+
pulls.status_checks_approve_all=批准所有工作流
1975+
pulls.status_checks_need_approvals=%d 个工作流等待批准
1976+
pulls.status_checks_need_approvals_helper=此工作流在仓库维护者批准后才会运行。
19731977
pulls.update_branch=通过合并更新分支
19741978
pulls.update_branch_rebase=通过变基更新分支
19751979
pulls.update_branch_success=分支更新成功
@@ -3036,6 +3040,7 @@ dashboard.update_migration_poster_id=更新迁移的发表者ID
30363040
dashboard.git_gc_repos=对仓库进行垃圾回收
30373041
dashboard.resync_all_sshkeys=使用 Gitea 的 SSH 密钥更新「.ssh/authorized_keys」文件。
30383042
dashboard.resync_all_sshprincipals=使用 Gitea 的 SSH 规则更新「.ssh/authorized_principals」文件。
3043+
dashboard.resync_all_hooks=重新同步所有仓库的 pre-receive、update 和 post-receive 钩子
30393044
dashboard.reinit_missing_repos=重新初始化所有丢失的 Git 仓库存在的记录
30403045
dashboard.sync_external_users=同步外部用户数据
30413046
dashboard.cleanup_hook_task_table=清理 hook_task 表
@@ -3070,7 +3075,7 @@ dashboard.total_gc_time=GC 暂停时间总量
30703075
dashboard.total_gc_pause=GC 暂停时间总量
30713076
dashboard.last_gc_pause=上次 GC 暂停时间
30723077
dashboard.gc_times=GC 执行次数
3073-
dashboard.delete_old_actions=从数据库中删除所有旧工作流记录
3078+
dashboard.delete_old_actions=从数据库中删除所有旧操作记录
30743079
dashboard.delete_old_actions.started=已开始从数据库中删除所有旧工作流记录。
30753080
dashboard.update_checker=更新检查器
30763081
dashboard.delete_old_system_notices=从数据库中删除所有旧系统通知
@@ -3890,6 +3895,7 @@ workflow.has_workflow_dispatch=此工作流有一个 workflow_dispatch 事件触
38903895
workflow.has_no_workflow_dispatch=工作流「%s」没有 workflow_dispatch 事件触发器。
38913896

38923897
need_approval_desc=该工作流由派生仓库的合并请求所触发,需要批准方可运行。
3898+
approve_all_success=已成功批准所有工作流运行。
38933899

38943900
variables=变量
38953901
variables.management=变量管理
@@ -3910,6 +3916,14 @@ variables.update.success=变量已编辑。
39103916
logs.always_auto_scroll=总是自动滚动日志
39113917
logs.always_expand_running=总是展开运行日志
39123918

3919+
general=常规
3920+
general.enable_actions=启用工作流
3921+
general.collaborative_owners_management=协作所有者管理
3922+
general.collaborative_owners_management_help=协作所有者是指其私有仓库有权访问此仓库的工作流的用户或组织。
3923+
general.add_collaborative_owner=添加协作所有者
3924+
general.collaborative_owner_not_exist=协作所有者不存在。
3925+
general.remove_collaborative_owner=移除协作所有者
3926+
general.remove_collaborative_owner_desc=移除协作所有者将阻止该所有者的其他仓库访问此仓库中的工作流。是否继续?
39133927

39143928
[projects]
39153929
deleted.display_name=已删除项目

routers/common/middleware.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package common
55

66
import (
77
"fmt"
8+
"log"
89
"net/http"
910
"strings"
1011

@@ -107,7 +108,11 @@ func ForwardedHeadersHandler(limit int, trustedProxies []string) func(h http.Han
107108
return proxy.ForwardedHeaders(opt)
108109
}
109110

110-
func Sessioner() (func(next http.Handler) http.Handler, error) {
111+
func MustInitSessioner() func(next http.Handler) http.Handler {
112+
// TODO: CHI-SESSION-GOB-REGISTER: chi-session has a design problem: it calls gob.Register for "Set"
113+
// But if the server restarts, then the first "Get" will fail to decode the previously stored session data because the structs are not registered yet.
114+
// So each package should make sure their structs are registered correctly during startup for session storage.
115+
111116
middleware, err := session.Sessioner(session.Options{
112117
Provider: setting.SessionConfig.Provider,
113118
ProviderConfig: setting.SessionConfig.ProviderConfig,
@@ -120,8 +125,7 @@ func Sessioner() (func(next http.Handler) http.Handler, error) {
120125
Domain: setting.SessionConfig.Domain,
121126
})
122127
if err != nil {
123-
return nil, fmt.Errorf("failed to create session middleware: %w", err)
128+
log.Fatalf("common.Sessioner failed: %v", err)
124129
}
125-
126-
return middleware, nil
130+
return middleware
127131
}

routers/install/install.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ func getSupportedDbTypeNames() (dbTypeNames []map[string]string) {
5555
return dbTypeNames
5656
}
5757

58-
// Contexter prepare for rendering installation page
59-
func Contexter() func(next http.Handler) http.Handler {
58+
// installContexter prepare for rendering installation page
59+
func installContexter() func(next http.Handler) http.Handler {
6060
rnd := templates.HTMLRenderer()
6161
dbTypeNames := getSupportedDbTypeNames()
6262
envConfigKeys := setting.CollectEnvConfigKeys()

routers/install/routes.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"html"
99
"net/http"
1010

11-
"code.gitea.io/gitea/modules/log"
1211
"code.gitea.io/gitea/modules/public"
1312
"code.gitea.io/gitea/modules/setting"
1413
"code.gitea.io/gitea/modules/web"
@@ -25,11 +24,8 @@ func Routes() *web.Router {
2524
base.Methods("GET, HEAD", "/assets/*", public.FileHandlerFunc())
2625

2726
r := web.NewRouter()
28-
if sessionMid, err := common.Sessioner(); err == nil && sessionMid != nil {
29-
r.Use(sessionMid, Contexter())
30-
} else {
31-
log.Fatal("common.Sessioner failed: %v", err)
32-
}
27+
r.Use(common.MustInitSessioner(), installContexter())
28+
3329
r.Get("/", Install) // it must be on the root, because the "install.js" use the window.location to replace the "localhost" AppURL
3430
r.Post("/", web.Bind(forms.InstallForm{}), SubmitInstall)
3531
r.Get("/post-install", InstallDone)

routers/web/auth/oauth.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,11 @@ type LinkAccountData struct {
277277
GothUser goth.User
278278
}
279279

280+
func init() {
281+
gob.Register(LinkAccountData{}) // TODO: CHI-SESSION-GOB-REGISTER
282+
}
283+
280284
func oauth2GetLinkAccountData(ctx *context.Context) *LinkAccountData {
281-
gob.Register(LinkAccountData{})
282285
v, ok := ctx.Session.Get("linkAccountData").(LinkAccountData)
283286
if !ok {
284287
return nil
@@ -287,7 +290,6 @@ func oauth2GetLinkAccountData(ctx *context.Context) *LinkAccountData {
287290
}
288291

289292
func Oauth2SetLinkAccountData(ctx *context.Context, linkAccountData LinkAccountData) error {
290-
gob.Register(LinkAccountData{})
291293
return updateSession(ctx, nil, map[string]any{
292294
"linkAccountData": linkAccountData,
293295
})

0 commit comments

Comments
 (0)