Skip to content

Commit 6783900

Browse files
authored
Merge branch 'main' into fix-js-load
2 parents c33b459 + 479757f commit 6783900

Some content is hidden

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

55 files changed

+286
-226
lines changed

SECURITY.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ Please **DO NOT** file a public issue, instead send your report privately to `se
1414

1515
Due to the sensitive nature of security information, you can use the below GPG public key to encrypt your mail body.
1616

17-
The PGP key is valid until July 9, 2025.
17+
The PGP key is valid until July 4, 2026.
1818

1919
```
2020
Key ID: 6FCD2D5B
2121
Key Type: RSA
22-
Expires: 7/9/2025
22+
Expires: 7/4/2026
2323
Key Size: 4096/4096
2424
Fingerprint: 3DE0 3D1E 144A 7F06 9359 99DC AAFD 2381 6FCD 2D5B
2525
```
@@ -42,18 +42,18 @@ lzpAjnN9/KLtQroutrm+Ft0mdjDiJUeFVl1cOHDhoyfCsQh62HumoyZoZvqzQd6e
4242
AbN11nq6aViMe2Q3je1AbiBnRnQSHxt1Tc8X4IshO3MQK1Sk7oPI6LA5oQARAQAB
4343
tCJHaXRlYSBTZWN1cml0eSA8c2VjdXJpdHlAZ2l0ZWEuaW8+iQJXBBMBCABBAhsD
4444
BQsJCAcCAiICBhUKCQgLAgQWAgMBAh4HAheAFiEEPeA9HhRKfwaTWZncqv0jgW/N
45-
LVsFAmaMse0FCQW4fW8ACgkQqv0jgW/NLVtXLg/+PF4G9Jhlui15BTNlEBJAV2P/
46-
1QlAV2krk0fP7tykn0FR9RfGIfVV/kwC1f+ouosYPQDDevl9LWdUIM+g94DtNo2o
47-
7ACpcL3morvt5lVGpIZHL8TbX0qmFRXL/pB/cB+K6IwYvh2mrbp2zH+r4SCRyFYq
48-
BjgXYFTI1MylJ1ShAjU6Z+m3oJ+2xs5LzHS0X6zkTjzA2Zl4zQzciQ9T+wJcE7Zi
49-
HXdM1+YMF8KGNP8J9Rpug5oNDJ98lgZirRY7c3A/1xmYBiPn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erbwCMBvHZO+HAevA/LXDTw2OAiSIQlP5
78+
sYA4sFYLQ30OAkgJcmdp/pSgVj/erNtSN07ClrOpDb/uFpQymO6K2h0Pst3feNVK
79+
9M2VbqL9C51z/wyHLg==
80+
=SfZA
8181
-----END PGP PUBLIC KEY BLOCK-----
8282
8383
```

modules/web/router_path.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func (g *RouterPathGroup) ServeHTTP(resp http.ResponseWriter, req *http.Request)
2626
path := chiCtx.URLParam(g.pathParam)
2727
for _, m := range g.matchers {
2828
if m.matchPath(chiCtx, path) {
29+
chiCtx.RoutePatterns = append(chiCtx.RoutePatterns, m.pattern)
2930
handler := m.handlerFunc
3031
for i := len(m.middlewares) - 1; i >= 0; i-- {
3132
handler = m.middlewares[i](handler).ServeHTTP
@@ -38,6 +39,7 @@ func (g *RouterPathGroup) ServeHTTP(resp http.ResponseWriter, req *http.Request)
3839
}
3940

4041
type RouterPathGroupPattern struct {
42+
pattern string
4143
re *regexp.Regexp
4244
params []routerPathParam
4345
middlewares []any
@@ -62,6 +64,7 @@ type routerPathParam struct {
6264

6365
type routerPathMatcher struct {
6466
methods container.Set[string]
67+
pattern string
6568
re *regexp.Regexp
6669
params []routerPathParam
6770
middlewares []func(http.Handler) http.Handler
@@ -117,7 +120,7 @@ func newRouterPathMatcher(methods string, patternRegexp *RouterPathGroupPattern,
117120
}
118121
p.methods.Add(method)
119122
}
120-
p.re, p.params = patternRegexp.re, patternRegexp.params
123+
p.pattern, p.re, p.params = patternRegexp.pattern, patternRegexp.re, patternRegexp.params
121124
return p
122125
}
123126

@@ -157,7 +160,7 @@ func patternRegexp(pattern string, h ...any) *RouterPathGroupPattern {
157160
p.params = append(p.params, param)
158161
}
159162
re = append(re, '$')
160-
p.re = regexp.MustCompile(string(re))
163+
p.pattern, p.re = pattern, regexp.MustCompile(string(re))
161164
return p
162165
}
163166

modules/web/router_test.go

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,20 @@ func TestRouter(t *testing.T) {
5656
recorder.Body = buff
5757

5858
type resultStruct struct {
59-
method string
60-
pathParams map[string]string
61-
handlerMarks []string
59+
method string
60+
pathParams map[string]string
61+
handlerMarks []string
62+
chiRoutePattern *string
6263
}
6364

6465
var res resultStruct
6566
h := func(optMark ...string) func(resp http.ResponseWriter, req *http.Request) {
6667
mark := util.OptionalArg(optMark, "")
6768
return func(resp http.ResponseWriter, req *http.Request) {
69+
chiCtx := chi.RouteContext(req.Context())
6870
res.method = req.Method
69-
res.pathParams = chiURLParamsToMap(chi.RouteContext(req.Context()))
71+
res.pathParams = chiURLParamsToMap(chiCtx)
72+
res.chiRoutePattern = util.ToPointer(chiCtx.RoutePattern())
7073
if mark != "" {
7174
res.handlerMarks = append(res.handlerMarks, mark)
7275
}
@@ -125,21 +128,29 @@ func TestRouter(t *testing.T) {
125128
req, err := http.NewRequest(methodPathFields[0], methodPathFields[1], nil)
126129
assert.NoError(t, err)
127130
r.ServeHTTP(recorder, req)
131+
if expected.chiRoutePattern == nil {
132+
res.chiRoutePattern = nil
133+
}
128134
assert.Equal(t, expected, res)
129135
})
130136
}
131137

132138
t.Run("RootRouter", func(t *testing.T) {
133-
testRoute(t, "GET /the-user/the-repo/other", resultStruct{method: "GET", handlerMarks: []string{"not-found:/"}})
139+
testRoute(t, "GET /the-user/the-repo/other", resultStruct{
140+
method: "GET",
141+
handlerMarks: []string{"not-found:/"},
142+
chiRoutePattern: util.ToPointer(""),
143+
})
134144
testRoute(t, "GET /the-user/the-repo/pulls", resultStruct{
135145
method: "GET",
136146
pathParams: map[string]string{"username": "the-user", "reponame": "the-repo", "type": "pulls"},
137147
handlerMarks: []string{"list-issues-b"},
138148
})
139149
testRoute(t, "GET /the-user/the-repo/issues/123", resultStruct{
140-
method: "GET",
141-
pathParams: map[string]string{"username": "the-user", "reponame": "the-repo", "type": "issues", "index": "123"},
142-
handlerMarks: []string{"view-issue"},
150+
method: "GET",
151+
pathParams: map[string]string{"username": "the-user", "reponame": "the-repo", "type": "issues", "index": "123"},
152+
handlerMarks: []string{"view-issue"},
153+
chiRoutePattern: util.ToPointer("/{username}/{reponame}/{type:issues|pulls}/{index}"),
143154
})
144155
testRoute(t, "GET /the-user/the-repo/issues/123?stop=hijack", resultStruct{
145156
method: "GET",
@@ -154,7 +165,10 @@ func TestRouter(t *testing.T) {
154165
})
155166

156167
t.Run("Sub Router", func(t *testing.T) {
157-
testRoute(t, "GET /api/v1/other", resultStruct{method: "GET", handlerMarks: []string{"not-found:/api/v1"}})
168+
testRoute(t, "GET /api/v1/other", resultStruct{
169+
method: "GET",
170+
handlerMarks: []string{"not-found:/api/v1"},
171+
})
158172
testRoute(t, "GET /api/v1/repos/the-user/the-repo/branches", resultStruct{
159173
method: "GET",
160174
pathParams: map[string]string{"username": "the-user", "reponame": "the-repo"},
@@ -211,9 +225,10 @@ func TestRouter(t *testing.T) {
211225
})
212226

213227
testRoute(t, "GET /api/v1/repos/the-user/the-repo/branches/d1/d2/fn?stop=s3", resultStruct{
214-
method: "GET",
215-
pathParams: map[string]string{"username": "the-user", "reponame": "the-repo", "*": "d1/d2/fn", "dir": "d1/d2", "file": "fn"},
216-
handlerMarks: []string{"s1", "s2", "s3"},
228+
method: "GET",
229+
pathParams: map[string]string{"username": "the-user", "reponame": "the-repo", "*": "d1/d2/fn", "dir": "d1/d2", "file": "fn"},
230+
handlerMarks: []string{"s1", "s2", "s3"},
231+
chiRoutePattern: util.ToPointer("/api/v1/repos/{username}/{reponame}/branches/<dir:*>/<file:[a-z]{1,2}>"),
217232
})
218233
})
219234
}

options/locale/locale_cs-CZ.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,8 +2274,6 @@ settings.hooks_desc=Webové háčky automaticky vytvářejí dotazy HTTP POST na
22742274
settings.webhook_deletion=Odstranit webový háček
22752275
settings.webhook_deletion_desc=Odstranění webového háčku smaže jeho nastavení a historii doručení. Pokračovat?
22762276
settings.webhook_deletion_success=Webový háček byl smazán.
2277-
settings.webhook.test_delivery=Test doručitelnosti
2278-
settings.webhook.test_delivery_desc=Vyzkoušet tento webový háček pomocí falešné události.
22792277
settings.webhook.test_delivery_desc_disabled=Chcete-li tento webový háček otestovat s falešnou událostí, aktivujte ho.
22802278
settings.webhook.request=Požadavek
22812279
settings.webhook.response=Odpověď

options/locale/locale_de-DE.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,8 +2316,6 @@ settings.hooks_desc=Webhooks senden bei bestimmten Gitea-Events automatisch „H
23162316
settings.webhook_deletion=Webhook löschen
23172317
settings.webhook_deletion_desc=Das Entfernen eines Webhooks löscht seine Einstellungen und Zustellungsverlauf. Fortfahren?
23182318
settings.webhook_deletion_success=Webhook wurde entfernt.
2319-
settings.webhook.test_delivery=Senden testen
2320-
settings.webhook.test_delivery_desc=Teste diesen Webhook mit einem Fake-Event.
23212319
settings.webhook.test_delivery_desc_disabled=Um diesen Webhook mit einem Fake-Event zu testen, aktiviere ihn.
23222320
settings.webhook.request=Anfrage
23232321
settings.webhook.response=Antwort

options/locale/locale_el-GR.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,8 +2066,6 @@ settings.hooks_desc=Τα Webhooks κάνουν αυτόματα αιτήσεις
20662066
settings.webhook_deletion=Αφαίρεση Webhook
20672067
settings.webhook_deletion_desc=Η αφαίρεση ενός webhook διαγράφει τις ρυθμίσεις και το ιστορικό παραδόσεων. Συνέχεια;
20682068
settings.webhook_deletion_success=Το webhook έχει αφαιρεθεί.
2069-
settings.webhook.test_delivery=Δοκιμή Παράδοσης
2070-
settings.webhook.test_delivery_desc=Δοκιμάστε αυτό το webhook με ένα ψεύτικο συμβάν.
20712069
settings.webhook.test_delivery_desc_disabled=Για να δοκιμάσετε αυτό το webhook με μια ψεύτικη κλήση, ενεργοποιήστε το.
20722070
settings.webhook.request=Αίτημα
20732071
settings.webhook.response=Απάντηση

options/locale/locale_en-US.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,8 +2334,8 @@ settings.hooks_desc = Webhooks automatically make HTTP POST requests to a server
23342334
settings.webhook_deletion = Remove Webhook
23352335
settings.webhook_deletion_desc = Removing a webhook deletes its settings and delivery history. Continue?
23362336
settings.webhook_deletion_success = The webhook has been removed.
2337-
settings.webhook.test_delivery = Test Delivery
2338-
settings.webhook.test_delivery_desc = Test this webhook with a fake event.
2337+
settings.webhook.test_delivery = Test Push Event
2338+
settings.webhook.test_delivery_desc = Test this webhook with a fake push event.
23392339
settings.webhook.test_delivery_desc_disabled = To test this webhook with a fake event, activate it.
23402340
settings.webhook.request = Request
23412341
settings.webhook.response = Response

options/locale/locale_es-ES.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,8 +2050,6 @@ settings.hooks_desc=Los webhooks automáticamente hacen peticiones HTTP POST a u
20502050
settings.webhook_deletion=Eliminar Webhook
20512051
settings.webhook_deletion_desc=Eliminar un webhook borra sus ajustes e historial de entrega. ¿Continuar?
20522052
settings.webhook_deletion_success=El webhook ha sido eliminado.
2053-
settings.webhook.test_delivery=Test de entrega
2054-
settings.webhook.test_delivery_desc=Prueba este webhook con un evento falso.
20552053
settings.webhook.test_delivery_desc_disabled=Para probar este webhook con un evento falso, actívalo.
20562054
settings.webhook.request=Petición
20572055
settings.webhook.response=Respuesta

options/locale/locale_fa-IR.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,8 +1591,6 @@ settings.hooks_desc=هوک تحت وب به صورت خودکار درخواست
15911591
settings.webhook_deletion=حذف Webhook
15921592
settings.webhook_deletion_desc=حذف هوک تحت وب موجب حذف تنظیمات آن و تاریخچه تحویل آن می‌شود. همچنان ادامه می‌دهید؟
15931593
settings.webhook_deletion_success=هوک تحت وب حذف شد.
1594-
settings.webhook.test_delivery=امتحان‌کردن تحویل
1595-
settings.webhook.test_delivery_desc=Webhook را با رویداد جعلی امتحان کنید.
15961594
settings.webhook.request=درخواست
15971595
settings.webhook.response=پاسخ
15981596
settings.webhook.headers=سربرگ‎ها

options/locale/locale_fi-FI.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,6 @@ settings.teams=Tiimit
10971097
settings.add_team=Lisää tiimi
10981098
settings.add_webhook=Lisää webkoukku
10991099
settings.webhook_deletion=Poista webkoukku
1100-
settings.webhook.test_delivery=Testitoimitus
11011100
settings.webhook.request=Pyyntö
11021101
settings.webhook.response=Vastaus
11031102
settings.webhook.headers=Otsikot

0 commit comments

Comments
 (0)