Skip to content

Commit a5d3887

Browse files
committed
Merge remote-tracking branch 'origin/main' into oidc-claims
2 parents 125747a + 04c55e9 commit a5d3887

File tree

478 files changed

+7763
-5852
lines changed

Some content is hidden

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

478 files changed

+7763
-5852
lines changed

.air.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ bin = "gitea"
77
include_ext = ["go", "tmpl"]
88
exclude_dir = ["modules/git/tests", "services/gitdiff/testdata", "modules/avatar/testdata"]
99
include_dir = ["cmd", "models", "modules", "options", "routers", "services", "templates"]
10+
exclude_regex = ["_test.go$"]

.eslintrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ plugins:
1313
- eslint-plugin-import
1414
- eslint-plugin-vue
1515
- eslint-plugin-html
16+
- eslint-plugin-github
1617

1718
extends:
1819
- plugin:vue/recommended
@@ -96,6 +97,23 @@ rules:
9697
function-paren-newline: [0]
9798
generator-star-spacing: [0]
9899
getter-return: [2]
100+
github/array-foreach: [2]
101+
github/async-currenttarget: [2]
102+
github/async-preventdefault: [2]
103+
github/authenticity-token: [0]
104+
github/get-attribute: [2]
105+
github/js-class-name: [0]
106+
github/no-blur: [0]
107+
github/no-d-none: [0]
108+
github/no-dataset: [2]
109+
github/no-implicit-buggy-globals: [0]
110+
github/no-inner-html: [0]
111+
github/no-innerText: [2]
112+
github/no-then: [2]
113+
github/no-useless-passive: [2]
114+
github/prefer-observers: [0]
115+
github/require-passive-events: [2]
116+
github/unescaped-html-literal: [0]
99117
grouped-accessor-pairs: [2]
100118
guard-for-in: [0]
101119
id-blacklist: [0]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ lint: lint-frontend lint-backend
328328

329329
.PHONY: lint-frontend
330330
lint-frontend: node_modules
331-
npx eslint --color --max-warnings=0 web_src/js build templates *.config.js
331+
npx eslint --color --max-warnings=0 web_src/js build templates *.config.js docs/assets/js
332332
npx stylelint --color --max-warnings=0 web_src/less
333333
npx editorconfig-checker templates
334334

build/code-batch-process.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ func main() {
267267
logVerbose("batch cmd: %s %v", subCmd, substArgs)
268268
switch subCmd {
269269
case "gitea-fmt":
270-
cmdErrors = append(cmdErrors, passThroughCmd("gofmt", substArgs))
271270
if containsString(subArgs, "-w") {
272271
cmdErrors = append(cmdErrors, giteaFormatGoImports(files))
273272
}
273+
cmdErrors = append(cmdErrors, passThroughCmd("gofmt", substArgs))
274274
case "misspell":
275275
cmdErrors = append(cmdErrors, passThroughCmd("misspell", substArgs))
276276
default:

build/generate-images.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,5 @@ async function main() {
8080
]);
8181
}
8282

83-
main().then(exit).catch(exit);
83+
main().then(exit).catch(exit); // eslint-disable-line github/no-then
8484

build/generate-svg.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ async function main() {
5454
]);
5555
}
5656

57-
main().then(exit).catch(exit);
57+
main().then(exit).catch(exit); // eslint-disable-line github/no-then
5858

cmd/admin.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"code.gitea.io/gitea/models"
1717
"code.gitea.io/gitea/models/db"
1818
"code.gitea.io/gitea/models/login"
19+
user_model "code.gitea.io/gitea/models/user"
1920
"code.gitea.io/gitea/modules/git"
2021
"code.gitea.io/gitea/modules/graceful"
2122
"code.gitea.io/gitea/modules/log"
@@ -388,15 +389,15 @@ func runChangePassword(c *cli.Context) error {
388389
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")
389390
}
390391
uname := c.String("username")
391-
user, err := models.GetUserByName(uname)
392+
user, err := user_model.GetUserByName(uname)
392393
if err != nil {
393394
return err
394395
}
395396
if err = user.SetPassword(c.String("password")); err != nil {
396397
return err
397398
}
398399

399-
if err = models.UpdateUserCols(user, "passwd", "passwd_hash_algo", "salt"); err != nil {
400+
if err = user_model.UpdateUserCols(db.DefaultContext, user, "passwd", "passwd_hash_algo", "salt"); err != nil {
400401
return err
401402
}
402403

@@ -454,15 +455,15 @@ func runCreateUser(c *cli.Context) error {
454455

455456
// If this is the first user being created.
456457
// Take it as the admin and don't force a password update.
457-
if n := models.CountUsers(); n == 0 {
458+
if n := user_model.CountUsers(); n == 0 {
458459
changePassword = false
459460
}
460461

461462
if c.IsSet("must-change-password") {
462463
changePassword = c.Bool("must-change-password")
463464
}
464465

465-
u := &models.User{
466+
u := &user_model.User{
466467
Name: username,
467468
Email: c.String("email"),
468469
Passwd: password,
@@ -472,7 +473,7 @@ func runCreateUser(c *cli.Context) error {
472473
Theme: setting.UI.DefaultTheme,
473474
}
474475

475-
if err := models.CreateUser(u); err != nil {
476+
if err := user_model.CreateUser(u); err != nil {
476477
return fmt.Errorf("CreateUser: %v", err)
477478
}
478479

@@ -501,7 +502,7 @@ func runListUsers(c *cli.Context) error {
501502
return err
502503
}
503504

504-
users, err := models.GetAllUsers()
505+
users, err := user_model.GetAllUsers()
505506

506507
if err != nil {
507508
return err
@@ -546,13 +547,13 @@ func runDeleteUser(c *cli.Context) error {
546547
}
547548

548549
var err error
549-
var user *models.User
550+
var user *user_model.User
550551
if c.IsSet("email") {
551-
user, err = models.GetUserByEmail(c.String("email"))
552+
user, err = user_model.GetUserByEmail(c.String("email"))
552553
} else if c.IsSet("username") {
553-
user, err = models.GetUserByName(c.String("username"))
554+
user, err = user_model.GetUserByName(c.String("username"))
554555
} else {
555-
user, err = models.GetUserByID(c.Int64("id"))
556+
user, err = user_model.GetUserByID(c.Int64("id"))
556557
}
557558
if err != nil {
558559
return err

cmd/migrate_storage.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"code.gitea.io/gitea/models/db"
1414
"code.gitea.io/gitea/models/migrations"
1515
repo_model "code.gitea.io/gitea/models/repo"
16+
user_model "code.gitea.io/gitea/models/user"
1617
"code.gitea.io/gitea/modules/log"
1718
"code.gitea.io/gitea/modules/setting"
1819
"code.gitea.io/gitea/modules/storage"
@@ -94,7 +95,7 @@ func migrateLFS(dstStorage storage.ObjectStorage) error {
9495
}
9596

9697
func migrateAvatars(dstStorage storage.ObjectStorage) error {
97-
return models.IterateUser(func(user *models.User) error {
98+
return user_model.IterateUser(func(user *user_model.User) error {
9899
_, err := storage.Copy(dstStorage, user.CustomAvatarRelativePath(), storage.Avatars, user.CustomAvatarRelativePath())
99100
return err
100101
})

cmd/web_https.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"code.gitea.io/gitea/modules/graceful"
1414
"code.gitea.io/gitea/modules/log"
1515
"code.gitea.io/gitea/modules/setting"
16+
1617
"github.com/klauspost/cpuid/v2"
1718
)
1819

custom/conf/app.example.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,12 @@ PATH =
17191719
;RUN_AT_START = false
17201720
;; Notice if not success
17211721
;NO_SUCCESS_NOTICE = true
1722+
;; Limit the number of mirrors added to the queue to this number
1723+
;; (negative values mean no limit, 0 will result in no result in no mirrors being queued effectively disabling pull mirror updating.)
1724+
;PULL_LIMIT=50
1725+
;; Limit the number of mirrors added to the queue to this number
1726+
;; (negative values mean no limit, 0 will result in no mirrors being queued effectively disabling push mirror updating)
1727+
;PUSH_LIMIT=50
17221728

17231729
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17241730
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docs/assets/js/search.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const fuseOptions = {
1515
shouldSort: true,
1616
includeMatches: true,
1717
matchAllTokens: true,
18-
threshold: 0.0, // for parsing diacritics
18+
threshold: 0, // for parsing diacritics
1919
tokenize: true,
2020
location: 0,
2121
distance: 100,
@@ -52,25 +52,25 @@ function doSearch() {
5252
executeSearch(searchQuery);
5353
} else {
5454
const para = document.createElement('P');
55-
para.innerText = 'Please enter a word or phrase above';
55+
para.textContent = 'Please enter a word or phrase above';
5656
document.getElementById('search-results').appendChild(para);
5757
}
5858
}
5959

6060
function getJSON(url, fn) {
6161
const request = new XMLHttpRequest();
6262
request.open('GET', url, true);
63-
request.onload = function () {
63+
request.addEventListener('load', () => {
6464
if (request.status >= 200 && request.status < 400) {
6565
const data = JSON.parse(request.responseText);
6666
fn(data);
6767
} else {
6868
console.error(`Target reached on ${url} with error ${request.status}`);
6969
}
70-
};
71-
request.onerror = function () {
70+
});
71+
request.addEventListener('error', () => {
7272
console.error(`Connection error ${request.status}`);
73-
};
73+
});
7474
request.send();
7575
}
7676

@@ -84,20 +84,20 @@ function executeSearch(searchQuery) {
8484
populateResults(result);
8585
} else {
8686
const para = document.createElement('P');
87-
para.innerText = 'No matches found';
87+
para.textContent = 'No matches found';
8888
document.getElementById('search-results').appendChild(para);
8989
}
9090
});
9191
}
9292

9393
function populateResults(result) {
94-
result.forEach((value, key) => {
94+
for (const [key, value] of result.entries()) {
9595
const content = value.item.contents;
9696
let snippet = '';
9797
const snippetHighlights = [];
9898
if (fuseOptions.tokenize) {
9999
snippetHighlights.push(searchQuery);
100-
value.matches.forEach((mvalue) => {
100+
for (const mvalue of value.matches) {
101101
if (mvalue.key === 'tags' || mvalue.key === 'categories') {
102102
snippetHighlights.push(mvalue.value);
103103
} else if (mvalue.key === 'contents') {
@@ -111,7 +111,7 @@ function populateResults(result) {
111111
snippetHighlights.push(mvalue.value.substring(mvalue.indices[0][0], mvalue.indices[0][1] - mvalue.indices[0][0] + 1));
112112
}
113113
}
114-
});
114+
}
115115
}
116116

117117
if (snippet.length < 1) {
@@ -130,10 +130,10 @@ function populateResults(result) {
130130
});
131131
document.getElementById('search-results').appendChild(htmlToElement(output));
132132

133-
snippetHighlights.forEach((snipvalue) => {
133+
for (const snipvalue of snippetHighlights) {
134134
new Mark(document.getElementById(`summary-${key}`)).mark(snipvalue);
135-
});
136-
});
135+
}
136+
}
137137
}
138138

139139
function render(templateString, data) {

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,8 @@ NB: You must have `DISABLE_ROUTER_LOG` set to `false` for this option to take ef
828828

829829
- `SCHEDULE`: **@every 10m**: Cron syntax for scheduling update mirrors, e.g. `@every 3h`.
830830
- `NO_SUCCESS_NOTICE`: **true**: The cron task for update mirrors success report is not very useful - as it just means that the mirrors have been queued. Therefore this is turned off by default.
831+
- `PULL_LIMIT`: **50**: Limit the number of mirrors added to the queue to this number (negative values mean no limit, 0 will result in no mirrors being queued effectively disabling pull mirror updating).
832+
- `PUSH_LIMIT`: **50**: Limit the number of mirrors added to the queue to this number (negative values mean no limit, 0 will result in no mirrors being queued effectively disabling push mirror updating).
831833

832834
#### Cron - Repository Health Check (`cron.repo_health_check`)
833835

docs/content/doc/advanced/customizing-gitea.en-us.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ Community themes are listed in [gitea/awesome-gitea#themes](https://gitea.com/gi
337337

338338
The `arc-green` theme source can be found [here](https://github.com/go-gitea/gitea/blob/main/web_src/less/themes/theme-arc-green.less).
339339

340+
If your custom theme is considered a dark theme, set the global css variable `--is-dark-theme` to `true`.
341+
This allows gitea to adjust the Monaco code editor's theme accordingly.
342+
340343
## Customizing fonts
341344

342345
Fonts can be customized using CSS variables:

docs/content/doc/developers.zh-cn.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
date: "2016-12-01T16:00:00+02:00"
3+
title: "开发者"
4+
slug: "developers"
5+
weight: 40
6+
toc: false
7+
draft: false
8+
menu:
9+
sidebar:
10+
name: "开发者"
11+
weight: 50
12+
identifier: "developers"
13+
---

0 commit comments

Comments
 (0)