Skip to content

Commit f17020c

Browse files
committed
Merge branch 'main' into lunny/issue_dev
2 parents c8a8fc6 + 9206fbb commit f17020c

File tree

214 files changed

+5895
-805
lines changed

Some content is hidden

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

214 files changed

+5895
-805
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ TEST_PGSQL_DBNAME ?= testgitea
179179
TEST_PGSQL_USERNAME ?= postgres
180180
TEST_PGSQL_PASSWORD ?= postgres
181181
TEST_PGSQL_SCHEMA ?= gtestschema
182+
TEST_MINIO_ENDPOINT ?= minio:9000
182183
TEST_MSSQL_HOST ?= mssql:1433
183184
TEST_MSSQL_DBNAME ?= gitea
184185
TEST_MSSQL_USERNAME ?= sa
@@ -574,6 +575,7 @@ generate-ini-pgsql:
574575
-e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
575576
-e 's|{{TEST_PGSQL_PASSWORD}}|${TEST_PGSQL_PASSWORD}|g' \
576577
-e 's|{{TEST_PGSQL_SCHEMA}}|${TEST_PGSQL_SCHEMA}|g' \
578+
-e 's|{{TEST_MINIO_ENDPOINT}}|${TEST_MINIO_ENDPOINT}|g' \
577579
-e 's|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
578580
-e 's|{{TEST_LOGGER}}|$(or $(TEST_LOGGER),test$(COMMA)file)|g' \
579581
-e 's|{{TEST_TYPE}}|$(or $(TEST_TYPE),integration)|g' \

cmd/admin_auth_ldap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ func (a *authService) addLdapSimpleAuth(c *cli.Context) error {
386386
return a.createAuthSource(ctx, authSource)
387387
}
388388

389-
// updateLdapBindDn updates a new LDAP (simple auth) authentication source.
389+
// updateLdapSimpleAuth updates a new LDAP (simple auth) authentication source.
390390
func (a *authService) updateLdapSimpleAuth(c *cli.Context) error {
391391
ctx, cancel := installSignals()
392392
defer cancel()

cmd/hook.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,9 @@ Gitea or set your environment appropriately.`, "")
591591
// S: ... ...
592592
// S: flush-pkt
593593
hookOptions := private.HookOptions{
594-
UserName: pusherName,
595-
UserID: pusherID,
594+
UserName: pusherName,
595+
UserID: pusherID,
596+
GitPushOptions: make(map[string]string),
596597
}
597598
hookOptions.OldCommitIDs = make([]string, 0, hookBatchSize)
598599
hookOptions.NewCommitIDs = make([]string, 0, hookBatchSize)
@@ -617,8 +618,6 @@ Gitea or set your environment appropriately.`, "")
617618
hookOptions.RefFullNames = append(hookOptions.RefFullNames, git.RefName(t[2]))
618619
}
619620

620-
hookOptions.GitPushOptions = make(map[string]string)
621-
622621
if hasPushOptions {
623622
for {
624623
rs, err = readPktLine(ctx, reader, pktLineTypeUnknow)
@@ -629,11 +628,7 @@ Gitea or set your environment appropriately.`, "")
629628
if rs.Type == pktLineTypeFlush {
630629
break
631630
}
632-
633-
kv := strings.SplitN(string(rs.Data), "=", 2)
634-
if len(kv) == 2 {
635-
hookOptions.GitPushOptions[kv[0]] = kv[1]
636-
}
631+
hookOptions.GitPushOptions.AddFromKeyValue(string(rs.Data))
637632
}
638633
}
639634

contrib/backport/backport.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ func main() {
6464
Value: "",
6565
Usage: "Forked user name on Github",
6666
},
67+
&cli.StringFlag{
68+
Name: "gh-access-token",
69+
Value: "",
70+
Usage: "Access token for GitHub api request",
71+
},
6772
&cli.BoolFlag{
6873
Name: "no-fetch",
6974
Usage: "Set this flag to prevent fetch of remote branches",
@@ -169,9 +174,10 @@ func runBackport(c *cli.Context) error {
169174
fmt.Printf("* Backporting %s to %s as %s\n", pr, localReleaseBranch, backportBranch)
170175

171176
sha := c.String("cherry-pick")
177+
accessToken := c.String("gh-access-token")
172178
if sha == "" {
173179
var err error
174-
sha, err = determineSHAforPR(ctx, pr)
180+
sha, err = determineSHAforPR(ctx, pr, accessToken)
175181
if err != nil {
176182
return err
177183
}
@@ -427,13 +433,16 @@ func readVersion() string {
427433
return strings.Join(split[:2], ".")
428434
}
429435

430-
func determineSHAforPR(ctx context.Context, prStr string) (string, error) {
436+
func determineSHAforPR(ctx context.Context, prStr, accessToken string) (string, error) {
431437
prNum, err := strconv.Atoi(prStr)
432438
if err != nil {
433439
return "", err
434440
}
435441

436442
client := github.NewClient(http.DefaultClient)
443+
if accessToken != "" {
444+
client = client.WithAuthToken(accessToken)
445+
}
437446

438447
pr, _, err := client.PullRequests.Get(ctx, "go-gitea", "gitea", prNum)
439448
if err != nil {

custom/conf/app.example.ini

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,24 @@ LEVEL = Info
907907
;; Valid site url schemes for user profiles
908908
;VALID_SITE_URL_SCHEMES=http,https
909909

910+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
911+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
912+
;[service.explore]
913+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
914+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
915+
;;
916+
;; Only allow signed in users to view the explore pages.
917+
;REQUIRE_SIGNIN_VIEW = false
918+
;;
919+
;; Disable the users explore page.
920+
;DISABLE_USERS_PAGE = false
921+
;;
922+
;; Disable the organizations explore page.
923+
;DISABLE_ORGANIZATIONS_PAGE = false
924+
;;
925+
;; Disable the code explore page.
926+
;DISABLE_CODE_PAGE = false
927+
;;
910928

911929
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
912930
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1507,6 +1525,8 @@ LEVEL = Info
15071525
;; - manage_gpg_keys: a user cannot configure gpg keys
15081526
;; - manage_mfa: a user cannot configure mfa devices
15091527
;; - manage_credentials: a user cannot configure emails, passwords, or openid
1528+
;; - change_username: a user cannot change their username
1529+
;; - change_full_name: a user cannot change their full name
15101530
;;EXTERNAL_USER_DISABLE_FEATURES =
15111531

15121532
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ require (
5454
github.com/go-chi/chi/v5 v5.0.13
5555
github.com/go-chi/cors v1.2.1
5656
github.com/go-co-op/gocron v1.37.0
57-
github.com/go-enry/go-enry/v2 v2.8.8
57+
github.com/go-enry/go-enry/v2 v2.9.1
5858
github.com/go-git/go-billy/v5 v5.5.0
5959
github.com/go-git/go-git/v5 v5.12.0
6060
github.com/go-ldap/ldap/v3 v3.4.6
@@ -331,7 +331,7 @@ replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1
331331

332332
replace github.com/shurcooL/vfsgen => github.com/lunny/vfsgen v0.0.0-20220105142115-2c99e1ffdfa0
333333

334-
replace github.com/nektos/act => gitea.com/gitea/act v0.259.1
334+
replace github.com/nektos/act => gitea.com/gitea/act v0.261.3
335335

336336
replace github.com/charmbracelet/git-lfs-transfer => gitea.com/gitea/git-lfs-transfer v0.2.0
337337

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
1616
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
1717
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 h1:cliQ4HHsCo6xi2oWZYKWW4bly/Ory9FuTpFPRxj/mAg=
1818
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078/go.mod h1:g/V2Hjas6Z1UHUp4yIx6bATpNzJ7DYtD0FG3+xARWxs=
19-
gitea.com/gitea/act v0.259.1 h1:8GG1o/xtUHl3qjn5f0h/2FXrT5ubBn05TJOM5ry+FBw=
20-
gitea.com/gitea/act v0.259.1/go.mod h1:UxZWRYqQG2Yj4+4OqfGWW5a3HELwejyWFQyU7F1jUD8=
19+
gitea.com/gitea/act v0.261.3 h1:BhiYpGJQKGq0XMYYICCYAN4KnsEWHyLbA6dxhZwFcV4=
20+
gitea.com/gitea/act v0.261.3/go.mod h1:Pg5C9kQY1CEA3QjthjhlrqOC/QOT5NyWNjOjRHw23Ok=
2121
gitea.com/gitea/git-lfs-transfer v0.2.0 h1:baHaNoBSRaeq/xKayEXwiDQtlIjps4Ac/Ll4KqLMB40=
2222
gitea.com/gitea/git-lfs-transfer v0.2.0/go.mod h1:UrXUCm3xLQkq15fu7qlXHUMlrhdlXHoi13KH2Dfiits=
2323
gitea.com/go-chi/binding v0.0.0-20240430071103-39a851e106ed h1:EZZBtilMLSZNWtHHcgq2mt6NSGhJSZBuduAlinMEmso=
@@ -315,8 +315,8 @@ github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
315315
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
316316
github.com/go-co-op/gocron v1.37.0 h1:ZYDJGtQ4OMhTLKOKMIch+/CY70Brbb1dGdooLEhh7b0=
317317
github.com/go-co-op/gocron v1.37.0/go.mod h1:3L/n6BkO7ABj+TrfSVXLRzsP26zmikL4ISkLQ0O8iNY=
318-
github.com/go-enry/go-enry/v2 v2.8.8 h1:EhfxWpw4DQ3WEFB1Y77X8vKqZL0D0EDUUWYDUAIv9/4=
319-
github.com/go-enry/go-enry/v2 v2.8.8/go.mod h1:9yrj4ES1YrbNb1Wb7/PWYr2bpaCXUGRt0uafN0ISyG8=
318+
github.com/go-enry/go-enry/v2 v2.9.1 h1:G9iDteJ/Mc0F4Di5NeQknf83R2OkRbwY9cAYmcqVG6U=
319+
github.com/go-enry/go-enry/v2 v2.9.1/go.mod h1:9yrj4ES1YrbNb1Wb7/PWYr2bpaCXUGRt0uafN0ISyG8=
320320
github.com/go-enry/go-oniguruma v1.2.1 h1:k8aAMuJfMrqm/56SG2lV9Cfti6tC4x8673aHCcBk+eo=
321321
github.com/go-enry/go-oniguruma v1.2.1/go.mod h1:bWDhYP+S6xZQgiRL7wlTScFYBe023B6ilRZbCAD5Hf4=
322322
github.com/go-faster/city v1.0.1 h1:4WAxSZ3V2Ws4QRDrscLEDcibJY8uf41H6AhXDrNDcGw=

models/actions/artifact.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func CreateArtifact(ctx context.Context, t *ActionTask, artifactName, artifactPa
6969
OwnerID: t.OwnerID,
7070
CommitSHA: t.CommitSHA,
7171
Status: int64(ArtifactStatusUploadPending),
72-
ExpiredUnix: timeutil.TimeStamp(time.Now().Unix() + 3600*24*expiredDays),
72+
ExpiredUnix: timeutil.TimeStamp(time.Now().Unix() + timeutil.Day*expiredDays),
7373
}
7474
if _, err := db.GetEngine(ctx).Insert(artifact); err != nil {
7575
return nil, err
@@ -78,6 +78,13 @@ func CreateArtifact(ctx context.Context, t *ActionTask, artifactName, artifactPa
7878
} else if err != nil {
7979
return nil, err
8080
}
81+
82+
if _, err := db.GetEngine(ctx).ID(artifact.ID).Cols("expired_unix").Update(&ActionArtifact{
83+
ExpiredUnix: timeutil.TimeStamp(time.Now().Unix() + timeutil.Day*expiredDays),
84+
}); err != nil {
85+
return nil, err
86+
}
87+
8188
return artifact, nil
8289
}
8390

models/admin/task.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -179,27 +179,6 @@ func GetMigratingTask(ctx context.Context, repoID int64) (*Task, error) {
179179
return &task, nil
180180
}
181181

182-
// GetMigratingTaskByID returns the migrating task by repo's id
183-
func GetMigratingTaskByID(ctx context.Context, id, doerID int64) (*Task, *migration.MigrateOptions, error) {
184-
task := Task{
185-
ID: id,
186-
DoerID: doerID,
187-
Type: structs.TaskTypeMigrateRepo,
188-
}
189-
has, err := db.GetEngine(ctx).Get(&task)
190-
if err != nil {
191-
return nil, nil, err
192-
} else if !has {
193-
return nil, nil, ErrTaskDoesNotExist{id, 0, task.Type}
194-
}
195-
196-
var opts migration.MigrateOptions
197-
if err := json.Unmarshal([]byte(task.PayloadContent), &opts); err != nil {
198-
return nil, nil, err
199-
}
200-
return &task, &opts, nil
201-
}
202-
203182
// CreateTask creates a task on database
204183
func CreateTask(ctx context.Context, task *Task) error {
205184
return db.Insert(ctx, task)

models/fixtures/repo_unit.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,3 +712,24 @@
712712
type: 3
713713
config: "{\"IgnoreWhitespaceConflicts\":false,\"AllowMerge\":true,\"AllowRebase\":true,\"AllowRebaseMerge\":true,\"AllowSquash\":true}"
714714
created_unix: 946684810
715+
716+
-
717+
id: 108
718+
repo_id: 62
719+
type: 1
720+
config: "{}"
721+
created_unix: 946684810
722+
723+
-
724+
id: 109
725+
repo_id: 62
726+
type: 2
727+
config: "{\"EnableTimetracker\":true,\"AllowOnlyContributorsToTrackTime\":true}"
728+
created_unix: 946684810
729+
730+
-
731+
id: 110
732+
repo_id: 62
733+
type: 3
734+
config: "{\"IgnoreWhitespaceConflicts\":false,\"AllowMerge\":true,\"AllowRebase\":true,\"AllowRebaseMerge\":true,\"AllowSquash\":true}"
735+
created_unix: 946684810

0 commit comments

Comments
 (0)