Skip to content

Commit a2a01df

Browse files
authored
Merge branch 'main' into feat/api-projects
2 parents 23d9697 + 6992ef9 commit a2a01df

File tree

452 files changed

+4619
-3872
lines changed

Some content is hidden

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

452 files changed

+4619
-3872
lines changed

.eslintrc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ rules:
723723
unicorn/no-this-assignment: [2]
724724
unicorn/no-typeof-undefined: [2]
725725
unicorn/no-unnecessary-await: [2]
726+
unicorn/no-unnecessary-polyfills: [2]
726727
unicorn/no-unreadable-array-destructuring: [0]
727728
unicorn/no-unreadable-iife: [2]
728729
unicorn/no-unused-properties: [2]

.github/workflows/files-changed.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
yaml: ${{ steps.changes.outputs.yaml }}
3636
steps:
3737
- uses: actions/checkout@v4
38-
- uses: dorny/paths-filter@v2
38+
- uses: dorny/paths-filter@v3
3939
id: changes
4040
with:
4141
filters: |

.stylelintrc.yaml

Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins:
22
- stylelint-declaration-strict-value
33
- stylelint-declaration-block-no-ignored-properties
4-
- stylelint-stylistic
4+
- "@stylistic/stylelint-plugin"
55

66
ignoreFiles:
77
- "**/*.go"
@@ -17,6 +17,82 @@ overrides:
1717
customSyntax: postcss-html
1818

1919
rules:
20+
"@stylistic/at-rule-name-case": null
21+
"@stylistic/at-rule-name-newline-after": null
22+
"@stylistic/at-rule-name-space-after": null
23+
"@stylistic/at-rule-semicolon-newline-after": null
24+
"@stylistic/at-rule-semicolon-space-before": null
25+
"@stylistic/block-closing-brace-empty-line-before": null
26+
"@stylistic/block-closing-brace-newline-after": null
27+
"@stylistic/block-closing-brace-newline-before": null
28+
"@stylistic/block-closing-brace-space-after": null
29+
"@stylistic/block-closing-brace-space-before": null
30+
"@stylistic/block-opening-brace-newline-after": null
31+
"@stylistic/block-opening-brace-newline-before": null
32+
"@stylistic/block-opening-brace-space-after": null
33+
"@stylistic/block-opening-brace-space-before": null
34+
"@stylistic/color-hex-case": lower
35+
"@stylistic/declaration-bang-space-after": never
36+
"@stylistic/declaration-bang-space-before": null
37+
"@stylistic/declaration-block-semicolon-newline-after": null
38+
"@stylistic/declaration-block-semicolon-newline-before": null
39+
"@stylistic/declaration-block-semicolon-space-after": null
40+
"@stylistic/declaration-block-semicolon-space-before": never
41+
"@stylistic/declaration-block-trailing-semicolon": null
42+
"@stylistic/declaration-colon-newline-after": null
43+
"@stylistic/declaration-colon-space-after": null
44+
"@stylistic/declaration-colon-space-before": never
45+
"@stylistic/function-comma-newline-after": null
46+
"@stylistic/function-comma-newline-before": null
47+
"@stylistic/function-comma-space-after": null
48+
"@stylistic/function-comma-space-before": null
49+
"@stylistic/function-max-empty-lines": 0
50+
"@stylistic/function-parentheses-newline-inside": never-multi-line
51+
"@stylistic/function-parentheses-space-inside": null
52+
"@stylistic/function-whitespace-after": null
53+
"@stylistic/indentation": 2
54+
"@stylistic/linebreaks": null
55+
"@stylistic/max-empty-lines": 1
56+
"@stylistic/max-line-length": null
57+
"@stylistic/media-feature-colon-space-after": null
58+
"@stylistic/media-feature-colon-space-before": never
59+
"@stylistic/media-feature-name-case": null
60+
"@stylistic/media-feature-parentheses-space-inside": null
61+
"@stylistic/media-feature-range-operator-space-after": always
62+
"@stylistic/media-feature-range-operator-space-before": always
63+
"@stylistic/media-query-list-comma-newline-after": null
64+
"@stylistic/media-query-list-comma-newline-before": null
65+
"@stylistic/media-query-list-comma-space-after": null
66+
"@stylistic/media-query-list-comma-space-before": null
67+
"@stylistic/no-empty-first-line": null
68+
"@stylistic/no-eol-whitespace": true
69+
"@stylistic/no-extra-semicolons": true
70+
"@stylistic/no-missing-end-of-source-newline": null
71+
"@stylistic/number-leading-zero": null
72+
"@stylistic/number-no-trailing-zeros": null
73+
"@stylistic/property-case": lower
74+
"@stylistic/selector-attribute-brackets-space-inside": null
75+
"@stylistic/selector-attribute-operator-space-after": null
76+
"@stylistic/selector-attribute-operator-space-before": null
77+
"@stylistic/selector-combinator-space-after": null
78+
"@stylistic/selector-combinator-space-before": null
79+
"@stylistic/selector-descendant-combinator-no-non-space": null
80+
"@stylistic/selector-list-comma-newline-after": null
81+
"@stylistic/selector-list-comma-newline-before": null
82+
"@stylistic/selector-list-comma-space-after": always-single-line
83+
"@stylistic/selector-list-comma-space-before": never-single-line
84+
"@stylistic/selector-max-empty-lines": 0
85+
"@stylistic/selector-pseudo-class-case": lower
86+
"@stylistic/selector-pseudo-class-parentheses-space-inside": never
87+
"@stylistic/selector-pseudo-element-case": lower
88+
"@stylistic/string-quotes": double
89+
"@stylistic/unicode-bom": null
90+
"@stylistic/unit-case": lower
91+
"@stylistic/value-list-comma-newline-after": null
92+
"@stylistic/value-list-comma-newline-before": null
93+
"@stylistic/value-list-comma-space-after": null
94+
"@stylistic/value-list-comma-space-before": null
95+
"@stylistic/value-list-max-empty-lines": 0
2096
alpha-value-notation: null
2197
annotation-no-unknown: true
2298
at-rule-allowed-list: null
@@ -137,82 +213,6 @@ rules:
137213
selector-type-no-unknown: [true, {ignore: [custom-elements]}]
138214
shorthand-property-no-redundant-values: true
139215
string-no-newline: true
140-
stylistic/at-rule-name-case: null
141-
stylistic/at-rule-name-newline-after: null
142-
stylistic/at-rule-name-space-after: null
143-
stylistic/at-rule-semicolon-newline-after: null
144-
stylistic/at-rule-semicolon-space-before: null
145-
stylistic/block-closing-brace-empty-line-before: null
146-
stylistic/block-closing-brace-newline-after: null
147-
stylistic/block-closing-brace-newline-before: null
148-
stylistic/block-closing-brace-space-after: null
149-
stylistic/block-closing-brace-space-before: null
150-
stylistic/block-opening-brace-newline-after: null
151-
stylistic/block-opening-brace-newline-before: null
152-
stylistic/block-opening-brace-space-after: null
153-
stylistic/block-opening-brace-space-before: null
154-
stylistic/color-hex-case: lower
155-
stylistic/declaration-bang-space-after: never
156-
stylistic/declaration-bang-space-before: null
157-
stylistic/declaration-block-semicolon-newline-after: null
158-
stylistic/declaration-block-semicolon-newline-before: null
159-
stylistic/declaration-block-semicolon-space-after: null
160-
stylistic/declaration-block-semicolon-space-before: never
161-
stylistic/declaration-block-trailing-semicolon: null
162-
stylistic/declaration-colon-newline-after: null
163-
stylistic/declaration-colon-space-after: null
164-
stylistic/declaration-colon-space-before: never
165-
stylistic/function-comma-newline-after: null
166-
stylistic/function-comma-newline-before: null
167-
stylistic/function-comma-space-after: null
168-
stylistic/function-comma-space-before: null
169-
stylistic/function-max-empty-lines: 0
170-
stylistic/function-parentheses-newline-inside: never-multi-line
171-
stylistic/function-parentheses-space-inside: null
172-
stylistic/function-whitespace-after: null
173-
stylistic/indentation: 2
174-
stylistic/linebreaks: null
175-
stylistic/max-empty-lines: 1
176-
stylistic/max-line-length: null
177-
stylistic/media-feature-colon-space-after: null
178-
stylistic/media-feature-colon-space-before: never
179-
stylistic/media-feature-name-case: null
180-
stylistic/media-feature-parentheses-space-inside: null
181-
stylistic/media-feature-range-operator-space-after: always
182-
stylistic/media-feature-range-operator-space-before: always
183-
stylistic/media-query-list-comma-newline-after: null
184-
stylistic/media-query-list-comma-newline-before: null
185-
stylistic/media-query-list-comma-space-after: null
186-
stylistic/media-query-list-comma-space-before: null
187-
stylistic/no-empty-first-line: null
188-
stylistic/no-eol-whitespace: true
189-
stylistic/no-extra-semicolons: true
190-
stylistic/no-missing-end-of-source-newline: null
191-
stylistic/number-leading-zero: null
192-
stylistic/number-no-trailing-zeros: null
193-
stylistic/property-case: lower
194-
stylistic/selector-attribute-brackets-space-inside: null
195-
stylistic/selector-attribute-operator-space-after: null
196-
stylistic/selector-attribute-operator-space-before: null
197-
stylistic/selector-combinator-space-after: null
198-
stylistic/selector-combinator-space-before: null
199-
stylistic/selector-descendant-combinator-no-non-space: null
200-
stylistic/selector-list-comma-newline-after: null
201-
stylistic/selector-list-comma-newline-before: null
202-
stylistic/selector-list-comma-space-after: always-single-line
203-
stylistic/selector-list-comma-space-before: never-single-line
204-
stylistic/selector-max-empty-lines: 0
205-
stylistic/selector-pseudo-class-case: lower
206-
stylistic/selector-pseudo-class-parentheses-space-inside: never
207-
stylistic/selector-pseudo-element-case: lower
208-
stylistic/string-quotes: double
209-
stylistic/unicode-bom: null
210-
stylistic/unit-case: lower
211-
stylistic/value-list-comma-newline-after: null
212-
stylistic/value-list-comma-newline-before: null
213-
stylistic/value-list-comma-space-after: null
214-
stylistic/value-list-comma-space-before: null
215-
stylistic/value-list-max-empty-lines: 0
216216
time-min-milliseconds: null
217217
unit-allowed-list: null
218218
unit-disallowed-list: null

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ See the [development setup instructions](https://docs.gitea.com/development/hack
110110

111111
### Backend
112112

113-
Go dependencies are managed using [Go Modules](https://golang.org/cmd/go/#hdr-Module_maintenance). \
113+
Go dependencies are managed using [Go Modules](https://go.dev/cmd/go/#hdr-Module_maintenance). \
114114
You can find more details in the [go mod documentation](https://go.dev/ref/mod) and the [Go Modules Wiki](https://github.com/golang/go/wiki/Modules).
115115

116116
Pull requests should only modify `go.mod` and `go.sum` where it is related to your change, be it a bugfix or a new feature. \
@@ -167,7 +167,7 @@ Here's how to run the test suite:
167167

168168
| Command | Action | |
169169
| :------------------------------------- | :----------------------------------------------- | ------------ |
170-
|``make test[\#SpecificTestName]`` | run unit test(s) |
170+
|``make test[\#SpecificTestName]`` | run unit test(s) | |
171171
|``make test-sqlite[\#SpecificTestName]``| run [integration](tests/integration) test(s) for SQLite |[More details](tests/integration/README.md) |
172172
|``make test-e2e-sqlite[\#SpecificTestName]``| run [end-to-end](tests/e2e) test(s) for SQLite |[More details](tests/e2e/README.md) |
173173

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ COMMA := ,
2525

2626
XGO_VERSION := go-1.21.x
2727

28-
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.44.0
28+
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.49.0
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/[email protected]
30-
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.5.0
31-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected].0
30+
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.6.0
31+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected].2
3232
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
3333
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/[email protected]
3434
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected]
3535
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3636
GO_LICENSES_PACKAGE ?= github.com/google/[email protected]
37-
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/[email protected].1
38-
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/[email protected].25
37+
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/[email protected].3
38+
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/[email protected].26
3939

4040
DOCKER_IMAGE ?= gitea/gitea
4141
DOCKER_TAG ?= latest

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,5 +178,5 @@ Looking for an overview of the interface? Check it out!
178178
|![Dashboard](https://dl.gitea.com/screenshots/home_timeline.png)|![User Profile](https://dl.gitea.com/screenshots/user_profile.png)|![Global Issues](https://dl.gitea.com/screenshots/global_issues.png)|
179179
|:---:|:---:|:---:|
180180
|![Branches](https://dl.gitea.com/screenshots/branches.png)|![Web Editor](https://dl.gitea.com/screenshots/web_editor.png)|![Activity](https://dl.gitea.com/screenshots/activity.png)|
181-
|![New Migration](https://dl.gitea.com/screenshots/migration.png)|![Migrating](https://dl.gitea.com/screenshots/migration.gif)|![Pull Request View](https://image.ibb.co/e02dSb/6.png)
182-
![Pull Request Dark](https://dl.gitea.com/screenshots/pull_requests_dark.png)|![Diff Review Dark](https://dl.gitea.com/screenshots/review_dark.png)|![Diff Dark](https://dl.gitea.com/screenshots/diff_dark.png)|
181+
|![New Migration](https://dl.gitea.com/screenshots/migration.png)|![Migrating](https://dl.gitea.com/screenshots/migration.gif)|![Pull Request View](https://image.ibb.co/e02dSb/6.png)|
182+
|![Pull Request Dark](https://dl.gitea.com/screenshots/pull_requests_dark.png)|![Diff Review Dark](https://dl.gitea.com/screenshots/review_dark.png)|![Diff Dark](https://dl.gitea.com/screenshots/diff_dark.png)|

README_ZH.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,5 @@ Fork -> Patch -> Push -> Pull Request
9898
|![Dashboard](https://dl.gitea.com/screenshots/home_timeline.png)|![User Profile](https://dl.gitea.com/screenshots/user_profile.png)|![Global Issues](https://dl.gitea.com/screenshots/global_issues.png)|
9999
|:---:|:---:|:---:|
100100
|![Branches](https://dl.gitea.com/screenshots/branches.png)|![Web Editor](https://dl.gitea.com/screenshots/web_editor.png)|![Activity](https://dl.gitea.com/screenshots/activity.png)|
101-
|![New Migration](https://dl.gitea.com/screenshots/migration.png)|![Migrating](https://dl.gitea.com/screenshots/migration.gif)|![Pull Request View](https://image.ibb.co/e02dSb/6.png)
102-
![Pull Request Dark](https://dl.gitea.com/screenshots/pull_requests_dark.png)|![Diff Review Dark](https://dl.gitea.com/screenshots/review_dark.png)|![Diff Dark](https://dl.gitea.com/screenshots/diff_dark.png)|
101+
|![New Migration](https://dl.gitea.com/screenshots/migration.png)|![Migrating](https://dl.gitea.com/screenshots/migration.gif)|![Pull Request View](https://image.ibb.co/e02dSb/6.png)|
102+
|![Pull Request Dark](https://dl.gitea.com/screenshots/pull_requests_dark.png)|![Diff Review Dark](https://dl.gitea.com/screenshots/review_dark.png)|![Diff Dark](https://dl.gitea.com/screenshots/diff_dark.png)|

cmd/admin.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"code.gitea.io/gitea/models/db"
1212
repo_model "code.gitea.io/gitea/models/repo"
1313
"code.gitea.io/gitea/modules/git"
14+
"code.gitea.io/gitea/modules/gitrepo"
1415
"code.gitea.io/gitea/modules/log"
1516
repo_module "code.gitea.io/gitea/modules/repository"
1617

@@ -122,7 +123,7 @@ func runRepoSyncReleases(_ *cli.Context) error {
122123
log.Trace("Processing next %d repos of %d", len(repos), count)
123124
for _, repo := range repos {
124125
log.Trace("Synchronizing repo %s with path %s", repo.FullName(), repo.RepoPath())
125-
gitRepo, err := git.OpenRepository(ctx, repo.RepoPath())
126+
gitRepo, err := gitrepo.OpenRepository(ctx, repo)
126127
if err != nil {
127128
log.Warn("OpenRepository: %v", err)
128129
continue

cmd/admin_user_change_password.go

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
package cmd
55

66
import (
7-
"context"
87
"errors"
98
"fmt"
109

1110
user_model "code.gitea.io/gitea/models/user"
12-
pwd "code.gitea.io/gitea/modules/auth/password"
11+
"code.gitea.io/gitea/modules/auth/password"
12+
"code.gitea.io/gitea/modules/optional"
1313
"code.gitea.io/gitea/modules/setting"
14+
user_service "code.gitea.io/gitea/services/user"
1415

1516
"github.com/urfave/cli/v2"
1617
)
@@ -32,6 +33,10 @@ var microcmdUserChangePassword = &cli.Command{
3233
Value: "",
3334
Usage: "New password to set for user",
3435
},
36+
&cli.BoolFlag{
37+
Name: "must-change-password",
38+
Usage: "User must change password",
39+
},
3540
},
3641
}
3742

@@ -46,31 +51,32 @@ func runChangePassword(c *cli.Context) error {
4651
if err := initDB(ctx); err != nil {
4752
return err
4853
}
49-
if len(c.String("password")) < setting.MinPasswordLength {
50-
return fmt.Errorf("Password is not long enough. Needs to be at least %d", setting.MinPasswordLength)
51-
}
5254

53-
if !pwd.IsComplexEnough(c.String("password")) {
54-
return errors.New("Password does not meet complexity requirements")
55-
}
56-
pwned, err := pwd.IsPwned(context.Background(), c.String("password"))
55+
user, err := user_model.GetUserByName(ctx, c.String("username"))
5756
if err != nil {
5857
return err
5958
}
60-
if pwned {
61-
return errors.New("The password you chose is on a list of stolen passwords previously exposed in public data breaches. Please try again with a different password.\nFor more details, see https://haveibeenpwned.com/Passwords")
62-
}
63-
uname := c.String("username")
64-
user, err := user_model.GetUserByName(ctx, uname)
65-
if err != nil {
66-
return err
67-
}
68-
if err = user.SetPassword(c.String("password")); err != nil {
69-
return err
59+
60+
var mustChangePassword optional.Option[bool]
61+
if c.IsSet("must-change-password") {
62+
mustChangePassword = optional.Some(c.Bool("must-change-password"))
7063
}
7164

72-
if err = user_model.UpdateUserCols(ctx, user, "passwd", "passwd_hash_algo", "salt"); err != nil {
73-
return err
65+
opts := &user_service.UpdateAuthOptions{
66+
Password: optional.Some(c.String("password")),
67+
MustChangePassword: mustChangePassword,
68+
}
69+
if err := user_service.UpdateAuth(ctx, user, opts); err != nil {
70+
switch {
71+
case errors.Is(err, password.ErrMinLength):
72+
return fmt.Errorf("Password is not long enough. Needs to be at least %d", setting.MinPasswordLength)
73+
case errors.Is(err, password.ErrComplexity):
74+
return errors.New("Password does not meet complexity requirements")
75+
case errors.Is(err, password.ErrIsPwned):
76+
return errors.New("The password you chose is on a list of stolen passwords previously exposed in public data breaches. Please try again with a different password.\nFor more details, see https://haveibeenpwned.com/Passwords")
77+
default:
78+
return err
79+
}
7480
}
7581

7682
fmt.Printf("%s's password has been successfully updated!\n", user.Name)

custom/conf/app.example.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ SECRET_KEY =
431431
;SECRET_KEY_URI = file:/etc/gitea/secret_key
432432
;;
433433
;; Secret used to validate communication within Gitea binary.
434-
INTERNAL_TOKEN=
434+
INTERNAL_TOKEN =
435435
;;
436436
;; Alternative location to specify internal token, instead of this file; you cannot specify both this and INTERNAL_TOKEN, and must pick one
437437
;INTERNAL_TOKEN_URI = file:/etc/gitea/internal_token
@@ -524,7 +524,7 @@ INTERNAL_TOKEN=
524524
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
525525
;;
526526
;; Enables OAuth2 provider
527-
ENABLE = true
527+
ENABLED = true
528528
;;
529529
;; Algorithm used to sign OAuth2 tokens. Valid values: HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384, ES512, EdDSA
530530
;JWT_SIGNING_ALGORITHM = RS256

0 commit comments

Comments
 (0)