Skip to content

Commit 99bbcfa

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Fix i18n for Link Account button, re-format tmpl (go-gitea#19835) [skip ci] Updated translations via Crowdin Adding button to link accounts from user settings (go-gitea#19792) fix(telegram): fix link bot to release tag (go-gitea#19830) Fix raw endpoint PDF file headers (go-gitea#19825)
2 parents 2bb0c27 + e0273ba commit 99bbcfa

File tree

12 files changed

+77
-32
lines changed

12 files changed

+77
-32
lines changed

modules/typesniffer/typesniffer.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ import (
1717
// Use at most this many bytes to determine Content Type.
1818
const sniffLen = 1024
1919

20-
// SvgMimeType MIME type of SVG images.
21-
const SvgMimeType = "image/svg+xml"
20+
const (
21+
// SvgMimeType MIME type of SVG images.
22+
SvgMimeType = "image/svg+xml"
23+
// ApplicationOctetStream MIME type of binary files.
24+
ApplicationOctetStream = "application/octet-stream"
25+
)
2226

2327
var (
2428
svgTagRegex = regexp.MustCompile(`(?si)\A\s*(?:(<!--.*?-->|<!DOCTYPE\s+svg([\s:]+.*?>|>))\s*)*<svg[\s>\/]`)

options/locale/locale_el-GR.ini

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ code.desc=Πρόσβαση στον πηγαίο κώδικα, αρχεία, υ
10041004
branch=Κλάδος
10051005
tree=Δέντρο
10061006
clear_ref=`Καθαρισμός τρέχουσας αναφοράς`
1007-
filter_branch_and_tag=Φιλτράρισμα κλάδου ή ετικέτας
1007+
filter_branch_and_tag=Φίλτρο κλάδου ή ετικέτας
10081008
find_tag=Εύρεση ετικέτας
10091009
branches=Κλάδοι
10101010
tags=Ετικέτες
@@ -1528,8 +1528,8 @@ pulls.still_in_progress=Ακόμα είναι σε εξέλιξη;
15281528
pulls.add_prefix=Προσθήκη <strong>%s</strong> προθέματος
15291529
pulls.remove_prefix=Αφαίρεση <strong>%s</strong> προθέματος
15301530
pulls.data_broken=Αυτό το pull request είναι κατεστραμμένο λόγω των πληροφοριών του fork που λείπουν.
1531-
pulls.files_conflicted=Αυτό το pull request έχει αλλαγές που έρχονται σε σύγκρουση με το κλάδο που στοχεύει.
1532-
pulls.is_checking=Η συγχώνευση ελέγχου σύγκρουσης είναι σε εξέλιξη. Δοκιμάστε ξανά σε λίγα λεπτά.
1531+
pulls.files_conflicted=Αυτό το pull request περιέχει αλλαγές που συγκρούονται με το κλάδο προορισμού.
1532+
pulls.is_checking=Ο έλεγχος συγκρούσεων κατά την συγχώνευση είναι σε εξέλιξη. Δοκιμάστε ξανά σε λίγα λεπτά.
15331533
pulls.is_empty=Αυτός ο κλάδος είναι ίσος με τον κλάδο-στόχο.
15341534
pulls.required_status_check_failed=Ορισμένοι απαιτούμενοι έλεγχοι δεν ήταν επιτυχείς.
15351535
pulls.required_status_check_missing=Λείπουν ορισμένοι απαιτούμενοι έλεγχοι.
@@ -1542,9 +1542,9 @@ pulls.blocked_by_changed_protected_files_1=Αυτό το Pull Request έχει
15421542
pulls.blocked_by_changed_protected_files_n=Αυτό το Pull Request έχει αποκλειστεί επειδή αλλάζει προστατευμένα αρχεία:
15431543
pulls.can_auto_merge_desc=Αυτό το Pull Request μπορεί να συγχωνευθεί αυτόματα.
15441544
pulls.cannot_auto_merge_desc=Αυτό το pull request δεν μπορεί να συγχωνευθεί αυτόματα λόγω συγκρούσεων.
1545-
pulls.cannot_auto_merge_helper=Συγχώνευση χειροκίνητα για την επίλυση των συγκρούσεων.
1546-
pulls.num_conflicting_files_1=%d αλληλοσυγκρουόμενο αρχείο
1547-
pulls.num_conflicting_files_n=%d αλληλοσυγκρουόμενα αρχεία
1545+
pulls.cannot_auto_merge_helper=Χειροκίνητη Συγχώνευση για την επίλυση των συγκρούσεων.
1546+
pulls.num_conflicting_files_1=%d αρχείο σε σύγκρουση
1547+
pulls.num_conflicting_files_n=%d αρχεία σε σύγκρουση
15481548
pulls.approve_count_1=%d έγκριση
15491549
pulls.approve_count_n=%d εγκρίσεις
15501550
pulls.reject_count_1=%d αίτημα αλλαγής
@@ -1576,7 +1576,7 @@ pulls.squash_merge_pull_request_on_status_success=Στρίμωγμα και Συ
15761576
pulls.invalid_merge_option=Δεν μπορείτε να χρησιμοποιήσετε αυτήν την επιλογή συγχώνευσης για αυτό το pull request.
15771577
pulls.merge_conflict=Η Συγχώνευση Απέτυχε: Υπήρξε μια διένεξη κατά τη συγχώνευση. Υπόδειξη: Δοκιμάστε μια διαφορετική στρατηγική
15781578
pulls.merge_conflict_summary=Μήνυμα Σφάλματος
1579-
pulls.rebase_conflict=Η Συγχώνευση Απέτυχε: Υπήρξε μια διένεξη κατά την αλλαγή βάσης της υποβολής: %[1]s. Υπόδειξη: Δοκιμάστε μια διαφορετική στρατηγική
1579+
pulls.rebase_conflict=Η Συγχώνευση Απέτυχε: Υπήρξε μια σύγκρουση κατά την αλλαγή βάσης της υποβολής: %[1]s. Υπόδειξη: Δοκιμάστε μια διαφορετική στρατηγική
15801580
pulls.rebase_conflict_summary=Μήνυμα Σφάλματος
15811581
; </summary><code>%[2]s<br>%[3]s</code></details>
15821582
pulls.unrelated_histories=H Συγχώνευση Απέτυχε: Η κεφαλή και η βάση της συγχώνευσης δεν μοιράζονται μια κοινή ιστορία. Συμβουλή: Δοκιμάστε μια διαφορετική στρατηγική
@@ -1791,7 +1791,7 @@ settings.site=Ιστοσελίδα
17911791
settings.update_settings=Ενημέρωση Ρυθμίσεων
17921792
settings.branches.update_default_branch=Ενημέρωση Προεπιλεγμένου Κλάδου
17931793
settings.advanced_settings=Ρυθμίσεις Για Προχωρημένους
1794-
settings.wiki_desc=Ενεργοποίηση Wiki Αποθετηρίου
1794+
settings.wiki_desc=Ενεργοποίηση Wiki
17951795
settings.use_internal_wiki=Χρήση Εσωτερικού Wiki
17961796
settings.use_external_wiki=Χρήση Εξωτερικού Wiki
17971797
settings.external_wiki_url=URL Εξωτερικού Wiki
@@ -1805,7 +1805,7 @@ settings.external_tracker_url_error=Το URL της εξωτερικής υπη
18051805
settings.external_tracker_url_desc=Οι επισκέπτες ανακατευθύνονται στο URL εξωτερικής υπηρεσίας ζητημάτων όταν κάνετε κλικ στην καρτέλα ζητήματα.
18061806
settings.tracker_url_format=Μορφή URL Εξωτερικής Υπηρεσίας Ζητημάτων
18071807
settings.tracker_url_format_error=Η μορφή URL της εξωτερικής υπηρεσίας ζητήματων δεν είναι έγκυρη διεύθυνση URL.
1808-
settings.tracker_issue_style=Μορφή Αριθμών Εξωτερικής Υπηρεσίας Ζητημάτων
1808+
settings.tracker_issue_style=Αρίθμηση Εξωτερικής Υπηρεσίας Ζητημάτων
18091809
settings.tracker_issue_style.numeric=Αριθμητικό
18101810
settings.tracker_issue_style.alphanumeric=Αλφαριθμητικό
18111811
settings.tracker_url_format_desc=Χρησιμοποιήστε τα <code>{user}</code>, <code>{repo}</code> και <code>{index}</code> για το όνομα χρήστη, το όνομα αποθετηρίου και το ευρετήριο ζητημάτων.

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ webauthn_delete_key_desc = If you remove a security key you can no longer sign i
778778
manage_account_links = Manage Linked Accounts
779779
manage_account_links_desc = These external accounts are linked to your Gitea account.
780780
account_links_not_available = There are currently no external accounts linked to your Gitea account.
781+
link_account = Link Account
781782
remove_account_link = Remove Linked Account
782783
remove_account_link_desc = Removing a linked account will revoke its access to your Gitea account. Continue?
783784
remove_account_link_success = The linked account has been removed.

routers/common/repo.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,14 @@ func ServeData(ctx *context.Context, name string, size int64, reader io.Reader)
8888
}
8989
if (st.IsImage() || st.IsPDF()) && (setting.UI.SVG.Enabled || !st.IsSvgImage()) {
9090
ctx.Resp.Header().Set("Content-Disposition", fmt.Sprintf(`inline; filename="%s"`, name))
91-
if st.IsSvgImage() {
91+
if st.IsSvgImage() || st.IsPDF() {
9292
ctx.Resp.Header().Set("Content-Security-Policy", "default-src 'none'; style-src 'unsafe-inline'; sandbox")
9393
ctx.Resp.Header().Set("X-Content-Type-Options", "nosniff")
94-
ctx.Resp.Header().Set("Content-Type", typesniffer.SvgMimeType)
94+
if st.IsSvgImage() {
95+
ctx.Resp.Header().Set("Content-Type", typesniffer.SvgMimeType)
96+
} else {
97+
ctx.Resp.Header().Set("Content-Type", typesniffer.ApplicationOctetStream)
98+
}
9599
}
96100
} else {
97101
ctx.Resp.Header().Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, name))

routers/web/auth/oauth.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,17 @@ func SignInOAuthCallback(ctx *context.Context) {
847847
}
848848

849849
if u == nil {
850-
if !setting.Service.AllowOnlyInternalRegistration && setting.OAuth2Client.EnableAutoRegistration {
850+
if ctx.Doer != nil {
851+
// attach user to already logged in user
852+
err = externalaccount.LinkAccountToUser(ctx.Doer, gothUser)
853+
if err != nil {
854+
ctx.ServerError("UserLinkAccount", err)
855+
return
856+
}
857+
858+
ctx.Redirect(setting.AppSubURL + "/user/settings/security")
859+
return
860+
} else if !setting.Service.AllowOnlyInternalRegistration && setting.OAuth2Client.EnableAutoRegistration {
851861
// create new user with details from oauth2 provider
852862
var missingFields []string
853863
if gothUser.UserID == "" {

routers/web/user/setting/security/security.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"code.gitea.io/gitea/modules/base"
1515
"code.gitea.io/gitea/modules/context"
1616
"code.gitea.io/gitea/modules/setting"
17+
"code.gitea.io/gitea/services/auth/source/oauth2"
1718
)
1819

1920
const (
@@ -109,6 +110,14 @@ func loadSecurityData(ctx *context.Context) {
109110
}
110111
ctx.Data["AccountLinks"] = sources
111112

113+
orderedOAuth2Names, oauth2Providers, err := oauth2.GetActiveOAuth2Providers()
114+
if err != nil {
115+
ctx.ServerError("GetActiveOAuth2Providers", err)
116+
return
117+
}
118+
ctx.Data["OrderedOAuth2Names"] = orderedOAuth2Names
119+
ctx.Data["OAuth2Providers"] = oauth2Providers
120+
112121
openid, err := user_model.GetUserOpenIDs(ctx.Doer.ID)
113122
if err != nil {
114123
ctx.ServerError("GetUserOpenIDs", err)

routers/web/web.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,6 @@ func RegisterRoutes(m *web.Route) {
344344
}, openIDSignInEnabled)
345345
m.Get("/sign_up", auth.SignUp)
346346
m.Post("/sign_up", bindIgnErr(forms.RegisterForm{}), auth.SignUpPost)
347-
m.Group("/oauth2", func() {
348-
m.Get("/{provider}", auth.SignInOAuth)
349-
m.Get("/{provider}/callback", auth.SignInOAuthCallback)
350-
})
351347
m.Get("/link_account", linkAccountEnabled, auth.LinkAccount)
352348
m.Post("/link_account_signin", linkAccountEnabled, bindIgnErr(forms.SignInForm{}), auth.LinkAccountPostSignIn)
353349
m.Post("/link_account_signup", linkAccountEnabled, bindIgnErr(forms.RegisterForm{}), auth.LinkAccountPostRegister)
@@ -452,6 +448,10 @@ func RegisterRoutes(m *web.Route) {
452448
m.Get("/task/{task}", reqSignIn, user.TaskStatus)
453449
m.Get("/stopwatches", reqSignIn, user.GetStopwatches)
454450
m.Get("/search", ignExploreSignIn, user.Search)
451+
m.Group("/oauth2", func() {
452+
m.Get("/{provider}", auth.SignInOAuth)
453+
m.Get("/{provider}/callback", auth.SignInOAuthCallback)
454+
})
455455
})
456456
// ***** END: User *****
457457

services/webhook/general.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func getPullRequestPayloadInfo(p *api.PullRequestPayload, linkFormatter linkForm
141141

142142
func getReleasePayloadInfo(p *api.ReleasePayload, linkFormatter linkFormatter, withSender bool) (text string, color int) {
143143
repoLink := linkFormatter(p.Repository.HTMLURL, p.Repository.FullName)
144-
refLink := linkFormatter(p.Repository.HTMLURL+"/src/"+util.PathEscapeSegments(p.Release.TagName), p.Release.TagName)
144+
refLink := linkFormatter(p.Repository.HTMLURL+"/releases/tag/"+util.PathEscapeSegments(p.Release.TagName), p.Release.TagName)
145145

146146
switch p.Action {
147147
case api.HookReleasePublished:

services/webhook/matrix_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ func TestMatrixPayload(t *testing.T) {
165165
require.NotNil(t, pl)
166166
require.IsType(t, &MatrixPayloadUnsafe{}, pl)
167167

168-
assert.Equal(t, "[[test/repo](http://localhost:3000/test/repo)] Release created: [v1.0](http://localhost:3000/test/repo/src/v1.0) by [user1](https://try.gitea.io/user1)", pl.(*MatrixPayloadUnsafe).Body)
169-
assert.Equal(t, `[<a href="http://localhost:3000/test/repo">test/repo</a>] Release created: <a href="http://localhost:3000/test/repo/src/v1.0">v1.0</a> by <a href="https://try.gitea.io/user1">user1</a>`, pl.(*MatrixPayloadUnsafe).FormattedBody)
168+
assert.Equal(t, "[[test/repo](http://localhost:3000/test/repo)] Release created: [v1.0](http://localhost:3000/test/repo/releases/tag/v1.0) by [user1](https://try.gitea.io/user1)", pl.(*MatrixPayloadUnsafe).Body)
169+
assert.Equal(t, `[<a href="http://localhost:3000/test/repo">test/repo</a>] Release created: <a href="http://localhost:3000/test/repo/releases/tag/v1.0">v1.0</a> by <a href="https://try.gitea.io/user1">user1</a>`, pl.(*MatrixPayloadUnsafe).FormattedBody)
170170
})
171171
}
172172

services/webhook/slack_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func TestSlackPayload(t *testing.T) {
154154
require.NotNil(t, pl)
155155
require.IsType(t, &SlackPayload{}, pl)
156156

157-
assert.Equal(t, "[<http://localhost:3000/test/repo|test/repo>] Release created: <http://localhost:3000/test/repo/src/v1.0|v1.0> by <https://try.gitea.io/user1|user1>", pl.(*SlackPayload).Text)
157+
assert.Equal(t, "[<http://localhost:3000/test/repo|test/repo>] Release created: <http://localhost:3000/test/repo/releases/tag/v1.0|v1.0> by <https://try.gitea.io/user1|user1>", pl.(*SlackPayload).Text)
158158
})
159159
}
160160

0 commit comments

Comments
 (0)