Skip to content

Commit 17f77f3

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Fix line number width in code preview (go-gitea#31307) Delete legacy cookie before setting new cookie (go-gitea#31306) [skip ci] Updated translations via Crowdin Use `querySelector` over alternative DOM methods (go-gitea#31280) Remove jQuery `.text()` (go-gitea#30506) [skip ci] Updated translations via Crowdin Remove sub-path from container registry realm (go-gitea#31293) Fix some URLs whose sub-path is missing (go-gitea#31289)
2 parents 77ff67f + 397930d commit 17f77f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+476
-365
lines changed

.eslintrc.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ rules:
324324
jquery/no-sizzle: [2]
325325
jquery/no-slide: [2]
326326
jquery/no-submit: [2]
327-
jquery/no-text: [0]
327+
jquery/no-text: [2]
328328
jquery/no-toggle: [2]
329329
jquery/no-trigger: [0]
330330
jquery/no-trim: [2]
@@ -477,7 +477,7 @@ rules:
477477
no-jquery/no-slide: [2]
478478
no-jquery/no-sub: [2]
479479
no-jquery/no-support: [2]
480-
no-jquery/no-text: [0]
480+
no-jquery/no-text: [2]
481481
no-jquery/no-trigger: [0]
482482
no-jquery/no-trim: [2]
483483
no-jquery/no-type: [2]
@@ -798,7 +798,7 @@ rules:
798798
unicorn/prefer-object-has-own: [0]
799799
unicorn/prefer-optional-catch-binding: [2]
800800
unicorn/prefer-prototype-methods: [0]
801-
unicorn/prefer-query-selector: [0]
801+
unicorn/prefer-query-selector: [2]
802802
unicorn/prefer-reflect-apply: [0]
803803
unicorn/prefer-regexp-test: [2]
804804
unicorn/prefer-set-has: [0]

modules/setting/packages.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package setting
66
import (
77
"fmt"
88
"math"
9-
"net/url"
109
"os"
1110
"path/filepath"
1211

@@ -19,7 +18,6 @@ var (
1918
Storage *Storage
2019
Enabled bool
2120
ChunkedUploadPath string
22-
RegistryHost string
2321

2422
LimitTotalOwnerCount int64
2523
LimitTotalOwnerSize int64
@@ -66,9 +64,6 @@ func loadPackagesFrom(rootCfg ConfigProvider) (err error) {
6664
return err
6765
}
6866

69-
appURL, _ := url.Parse(AppURL)
70-
Packages.RegistryHost = appURL.Host
71-
7267
Packages.ChunkedUploadPath = filepath.ToSlash(sec.Key("CHUNKED_UPLOAD_PATH").MustString("tmp/package-upload"))
7368
if !filepath.IsAbs(Packages.ChunkedUploadPath) {
7469
Packages.ChunkedUploadPath = filepath.ToSlash(filepath.Join(AppDataPath, Packages.ChunkedUploadPath))

modules/test/utils.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ func IsNormalPageCompleted(s string) bool {
3434
return strings.Contains(s, `<footer class="page-footer"`) && strings.Contains(s, `</html>`)
3535
}
3636

37-
func MockVariableValue[T any](p *T, v T) (reset func()) {
37+
func MockVariableValue[T any](p *T, v ...T) (reset func()) {
3838
old := *p
39-
*p = v
39+
if len(v) > 0 {
40+
*p = v[0]
41+
}
4042
return func() { *p = old }
4143
}

modules/web/middleware/cookie.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ func GetSiteCookie(req *http.Request, name string) string {
3535

3636
// SetSiteCookie returns given cookie value from request header.
3737
func SetSiteCookie(resp http.ResponseWriter, name, value string, maxAge int) {
38+
// Previous versions would use a cookie path with a trailing /.
39+
// These are more specific than cookies without a trailing /, so
40+
// we need to delete these if they exist.
41+
deleteLegacySiteCookie(resp, name)
3842
cookie := &http.Cookie{
3943
Name: name,
4044
Value: url.QueryEscape(value),
@@ -46,10 +50,6 @@ func SetSiteCookie(resp http.ResponseWriter, name, value string, maxAge int) {
4650
SameSite: setting.SessionConfig.SameSite,
4751
}
4852
resp.Header().Add("Set-Cookie", cookie.String())
49-
// Previous versions would use a cookie path with a trailing /.
50-
// These are more specific than cookies without a trailing /, so
51-
// we need to delete these if they exist.
52-
deleteLegacySiteCookie(resp, name)
5353
}
5454

5555
// deleteLegacySiteCookie deletes the cookie with the given name at the cookie

options/locale/locale_fr-FR.ini

Lines changed: 116 additions & 6 deletions
Large diffs are not rendered by default.

options/locale/locale_ja-JP.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,7 @@ commitstatus.success=成功
13781378
ext_issues=外部イシューへのアクセス
13791379
ext_issues.desc=外部のイシュートラッカーへのリンク。
13801380

1381+
projects.desc=プロジェクトでイシューとプルリクエストを管理します。
13811382
projects.description=説明 (オプション)
13821383
projects.description_placeholder=説明
13831384
projects.create=プロジェクトを作成
@@ -1552,7 +1553,9 @@ issues.no_content=説明はありません。
15521553
issues.close=イシューをクローズ
15531554
issues.comment_pull_merged_at=がコミット %[1]s を %[2]s にマージ %[3]s
15541555
issues.comment_manually_pull_merged_at=がコミット %[1]s を %[2]s に手動マージ %[3]s
1556+
issues.close_comment_issue=コメントしてクローズ
15551557
issues.reopen_issue=再オープンする
1558+
issues.reopen_comment_issue=コメントして再オープン
15561559
issues.create_comment=コメントする
15571560
issues.comment.blocked_user=投稿者またはリポジトリのオーナーがあなたをブロックしているため、コメントの作成や編集はできません。
15581561
issues.closed_at=`がイシューをクローズ <a id="%[1]s" href="#%[1]s">%[2]s</a>`
@@ -3412,6 +3415,7 @@ error.unit_not_allowed=このセクションへのアクセスが許可されて
34123415
title=パッケージ
34133416
desc=リポジトリ パッケージを管理します。
34143417
empty=パッケージはまだありません。
3418+
no_metadata=メタデータがありません。
34153419
empty.documentation=パッケージレジストリの詳細については、 <a target="_blank" rel="noopener noreferrer" href="%s">ドキュメント</a> を参照してください。
34163420
empty.repo=パッケージはアップロード済みで、ここに表示されていないですか? <a href="%[1]s">パッケージ設定</a>を開いて、パッケージをこのリポジトリにリンクしてください。
34173421
registry.documentation=%sレジストリの詳細については、 <a target="_blank" rel="noopener noreferrer" href="%s">ドキュメント</a> を参照してください。
@@ -3634,6 +3638,7 @@ runs.pushed_by=pushed by
36343638
runs.invalid_workflow_helper=ワークフロー設定ファイルは無効です。あなたの設定ファイルを確認してください: %s
36353639
runs.no_matching_online_runner_helper=ラベルに一致するオンラインのランナーが見つかりません: %s
36363640
runs.no_job_without_needs=ワークフローには依存関係のないジョブが少なくとも1つ含まれている必要があります。
3641+
runs.no_job=ワークフローには少なくとも1つのジョブが含まれている必要があります
36373642
runs.actor=アクター
36383643
runs.status=ステータス
36393644
runs.actors_no_select=すべてのアクター

routers/api/packages/container/container.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ func apiErrorDefined(ctx *context.Context, err *namedError) {
116116
}
117117

118118
func apiUnauthorizedError(ctx *context.Context) {
119-
// TODO: it doesn't seem quite right but it doesn't really cause problem at the moment.
120-
// container registry requires that the "/v2" must be in the root, so the sub-path in AppURL should be removed, ideally.
121-
ctx.Resp.Header().Add("WWW-Authenticate", `Bearer realm="`+httplib.GuessCurrentAppURL(ctx)+`v2/token",service="container_registry",scope="*"`)
119+
// container registry requires that the "/v2" must be in the root, so the sub-path in AppURL should be removed
120+
realmURL := strings.TrimSuffix(httplib.GuessCurrentAppURL(ctx), setting.AppSubURL+"/") + "/v2/token"
121+
ctx.Resp.Header().Add("WWW-Authenticate", `Bearer realm="`+realmURL+`",service="container_registry",scope="*"`)
122122
apiErrorDefined(ctx, errUnauthorized)
123123
}
124124

routers/web/user/package.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package user
55

66
import (
77
"net/http"
8+
"net/url"
89

910
"code.gitea.io/gitea/models/db"
1011
org_model "code.gitea.io/gitea/models/organization"
@@ -15,6 +16,7 @@ import (
1516
repo_model "code.gitea.io/gitea/models/repo"
1617
"code.gitea.io/gitea/modules/base"
1718
"code.gitea.io/gitea/modules/container"
19+
"code.gitea.io/gitea/modules/httplib"
1820
"code.gitea.io/gitea/modules/log"
1921
"code.gitea.io/gitea/modules/optional"
2022
alpine_module "code.gitea.io/gitea/modules/packages/alpine"
@@ -178,7 +180,11 @@ func ViewPackageVersion(ctx *context.Context) {
178180

179181
switch pd.Package.Type {
180182
case packages_model.TypeContainer:
181-
ctx.Data["RegistryHost"] = setting.Packages.RegistryHost
183+
registryAppURL, err := url.Parse(httplib.GuessCurrentAppURL(ctx))
184+
if err != nil {
185+
registryAppURL, _ = url.Parse(setting.AppURL)
186+
}
187+
ctx.Data["RegistryHost"] = registryAppURL.Host
182188
case packages_model.TypeAlpine:
183189
branches := make(container.Set[string])
184190
repositories := make(container.Set[string])

templates/admin/packages/list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{{ctx.Locale.Tr "admin.packages.total_size" (FileSize .TotalBlobSize)}},
66
{{ctx.Locale.Tr "admin.packages.unreferenced_size" (FileSize .TotalUnreferencedBlobSize)}})
77
<div class="ui right">
8-
<form method="post" action="/admin/packages/cleanup">
8+
<form method="post" action="{{AppSubUrl}}/admin/packages/cleanup">
99
{{.CsrfTokenHtml}}
1010
<button class="ui primary tiny button">{{ctx.Locale.Tr "admin.packages.cleanup"}}</button>
1111
</form>

templates/devtest/fetch-action.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<div><label><input name="check" type="checkbox"> check</label></div>
2626
<div><button name="btn">submit post</button></div>
2727
</form>
28-
<form method="post" action="/no-such-uri" class="form-fetch-action">
28+
<form method="post" action="no-such-uri" class="form-fetch-action">
2929
<div class="tw-py-8">bad action url</div>
3030
<div><button name="btn">submit test</button></div>
3131
</form>

0 commit comments

Comments
 (0)