Skip to content

Commit 78e56ee

Browse files
author
Gusted
committed
[gitea] week 2025-15 cherry pick (gitea/main -> forgejo) (go-gitea#7538)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7538 Reviewed-by: Earl Warren <[email protected]> Reviewed-by: Gusted <[email protected]>
2 parents 9a4ded7 + 504bb09 commit 78e56ee

File tree

7 files changed

+62
-11
lines changed

7 files changed

+62
-11
lines changed

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2444,7 +2444,7 @@ LEVEL = Info
24442444
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
24452445
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
24462446
;; Set the maximum number of characters in a mermaid source. (Set to -1 to disable limits)
2447-
;MERMAID_MAX_SOURCE_CHARACTERS = 5000
2447+
;MERMAID_MAX_SOURCE_CHARACTERS = 50000
24482448
;; Set the maximum number of lines allowed for a filepreview. (Set to -1 to disable limits; set to 0 to disable the feature)
24492449
;FILEPREVIEW_MAX_LINES = 50
24502450

docker/root/etc/s6/openssh/setup

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,19 @@ if [ -e /data/ssh/ssh_host_ecdsa_cert ]; then
3131
SSH_ECDSA_CERT=${SSH_ECDSA_CERT:-"/data/ssh/ssh_host_ecdsa_cert"}
3232
fi
3333

34-
if [ -e /data/ssh/ssh_host_ed25519-cert.pub ]; then
35-
SSH_ED25519_CERT=${SSH_ED25519_CERT:-"/data/ssh/ssh_host_ed25519-cert.pub"}
34+
# In case someone wants to sign the `{keyname}.pub` key by `ssh-keygen -s ca -I identity ...` to
35+
# make use of the ssh-key certificate authority feature (see ssh-keygen CERTIFICATES section),
36+
# the generated key file name is `{keyname}-cert.pub`
37+
if [ -e /data/ssh/ssh_host_ed25519_key-cert.pub ]; then
38+
SSH_ED25519_CERT=${SSH_ED25519_CERT:-"/data/ssh/ssh_host_ed25519_key-cert.pub"}
3639
fi
3740

38-
if [ -e /data/ssh/ssh_host_rsa-cert.pub ]; then
39-
SSH_RSA_CERT=${SSH_RSA_CERT:-"/data/ssh/ssh_host_rsa-cert.pub"}
41+
if [ -e /data/ssh/ssh_host_rsa_key-cert.pub ]; then
42+
SSH_RSA_CERT=${SSH_RSA_CERT:-"/data/ssh/ssh_host_rsa_key-cert.pub"}
4043
fi
4144

42-
if [ -e /data/ssh/ssh_host_ecdsa-cert.pub ]; then
43-
SSH_ECDSA_CERT=${SSH_ECDSA_CERT:-"/data/ssh/ssh_host_ecdsa-cert.pub"}
45+
if [ -e /data/ssh/ssh_host_ecdsa_key-cert.pub ]; then
46+
SSH_ECDSA_CERT=${SSH_ECDSA_CERT:-"/data/ssh/ssh_host_ecdsa_key-cert.pub"}
4447
fi
4548

4649
if [ -d /etc/ssh ]; then

models/webhook/webhook_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func TestWebhook_EventsArray(t *testing.T) {
9191
func TestCreateWebhook(t *testing.T) {
9292
hook := &Webhook{
9393
RepoID: 3,
94-
URL: "www.example.com/unit_test",
94+
URL: "https://www.example.com/unit_test",
9595
ContentType: ContentTypeJSON,
9696
Events: `{"push_only":false,"send_everything":false,"choose_events":false,"events":{"create":false,"push":true,"pull_request":true}}`,
9797
}

modules/setting/markup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ type MarkupSanitizerRule struct {
6262
func loadMarkupFrom(rootCfg ConfigProvider) {
6363
mustMapSetting(rootCfg, "markdown", &Markdown)
6464

65-
MermaidMaxSourceCharacters = rootCfg.Section("markup").Key("MERMAID_MAX_SOURCE_CHARACTERS").MustInt(5000)
65+
MermaidMaxSourceCharacters = rootCfg.Section("markup").Key("MERMAID_MAX_SOURCE_CHARACTERS").MustInt(50000)
6666
FilePreviewMaxLines = rootCfg.Section("markup").Key("FILEPREVIEW_MAX_LINES").MustInt(50)
6767
ExternalMarkupRenderers = make([]*MarkupRenderer, 0, 10)
6868
ExternalSanitizerRules = make([]MarkupSanitizerRule, 0, 10)

services/migrations/github.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func (g *GithubDownloaderV3) LogString() string {
140140
func (g *GithubDownloaderV3) addClient(client *http.Client, baseURL string) {
141141
githubClient := github.NewClient(client)
142142
if baseURL != "https://github.com" {
143-
githubClient, _ = github.NewClient(client).WithEnterpriseURLs(baseURL, baseURL)
143+
githubClient, _ = githubClient.WithEnterpriseURLs(baseURL, baseURL)
144144
}
145145
g.clients = append(g.clients, githubClient)
146146
g.rates = append(g.rates, nil)
@@ -885,3 +885,18 @@ func (g *GithubDownloaderV3) GetReviews(reviewable base.Reviewable) ([]*base.Rev
885885
}
886886
return allReviews, nil
887887
}
888+
889+
// FormatCloneURL add authentication into remote URLs
890+
func (g *GithubDownloaderV3) FormatCloneURL(opts MigrateOptions, remoteAddr string) (string, error) {
891+
u, err := url.Parse(remoteAddr)
892+
if err != nil {
893+
return "", err
894+
}
895+
if len(opts.AuthToken) > 0 {
896+
// "multiple tokens" are used to benefit more "API rate limit quota"
897+
// git clone doesn't count for rate limits, so only use the first token.
898+
// source: https://github.com/orgs/community/discussions/44515
899+
u.User = url.UserPassword("oauth2", strings.Split(opts.AuthToken, ",")[0])
900+
}
901+
return u.String(), nil
902+
}

services/migrations/github_test.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,3 +433,36 @@ func TestGitHubDownloadRepo(t *testing.T) {
433433
},
434434
}, reviews)
435435
}
436+
437+
func TestGithubMultiToken(t *testing.T) {
438+
testCases := []struct {
439+
desc string
440+
token string
441+
expectedCloneURL string
442+
}{
443+
{
444+
desc: "Single Token",
445+
token: "single_token",
446+
expectedCloneURL: "https://oauth2:[email protected]",
447+
},
448+
{
449+
desc: "Multi Token",
450+
token: "token1,token2",
451+
expectedCloneURL: "https://oauth2:[email protected]",
452+
},
453+
}
454+
factory := GithubDownloaderV3Factory{}
455+
456+
for _, tC := range testCases {
457+
t.Run(tC.desc, func(t *testing.T) {
458+
opts := base.MigrateOptions{CloneAddr: "https://github.com/go-gitea/gitea", AuthToken: tC.token}
459+
client, err := factory.New(t.Context(), opts)
460+
require.NoError(t, err)
461+
462+
cloneURL, err := client.FormatCloneURL(opts, "https://github.com")
463+
require.NoError(t, err)
464+
465+
assert.Equal(t, tC.expectedCloneURL, cloneURL)
466+
})
467+
}
468+
}

templates/user/dashboard/milestones.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
{{ctx.Locale.Tr "repo.milestones.closed" $closedDate}}
115115
{{else}}
116116
{{if .DeadlineString}}
117-
<span{{if .IsOverdue}} class="text red"{{end}}>
117+
<span class="flex-text-inline {{if .IsOverdue}}text red{{end}}">
118118
{{svg "octicon-calendar" 14}}
119119
{{DateUtils.AbsoluteShort (.DeadlineString|DateUtils.ParseLegacy)}}
120120
</span>

0 commit comments

Comments
 (0)