Skip to content

Commit 346547b

Browse files
committed
Merge remote-tracking branch 'giteaoffical/main'
* giteaoffical/main: (89 commits) Move some files under repo/setting (go-gitea#25585) Following-up improvments for various PRs (go-gitea#25620) Set SSH_AUTHORIZED_KEYS_BACKUP to false (go-gitea#25412) Fix bug of branches API with tests (go-gitea#25578) [skip ci] Updated translations via Crowdin Application as a maintainer (go-gitea#25614) Adding branch-name copy to clipboard branches screen. (go-gitea#25596) Use AfterCommitId to get commit for Viewed functionality (go-gitea#25529) Fix branch commit message too long problem (go-gitea#25588) Restrict `[actions].DEFAULT_ACTIONS_URL` to only `github` or `self` (go-gitea#25581) Add API for changing Avatars (go-gitea#25369) read-only checkboxes don't appear and don't entirely act the way one might expect (go-gitea#25573) Redirect to package after version deletion (go-gitea#25594) Update emoji set to Unicode 15 (go-gitea#25595) Fix `lint-swagger` action (go-gitea#25593) Replace fomantic divider module with our own (go-gitea#25539) Add documentation about supported workflow trigger events (go-gitea#25582) Sync branches into databases (go-gitea#22743) Fix milestones deletion (go-gitea#25583) Reduce table padding globally (go-gitea#25568) ... # Conflicts: # templates/repo/wiki/revision.tmpl
2 parents 3e8a29d + aab7cb6 commit 346547b

File tree

414 files changed

+7072
-4213
lines changed

Some content is hidden

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

414 files changed

+7072
-4213
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"ghcr.io/devcontainers/features/node:1": {
77
"version":"20"
88
},
9-
"ghcr.io/devcontainers/features/git-lfs:1.1.0": {}
9+
"ghcr.io/devcontainers/features/git-lfs:1.1.0": {},
10+
"ghcr.io/devcontainers-contrib/features/poetry:2": {},
11+
"ghcr.io/devcontainers/features/python:1": {}
1012
},
1113
"customizations": {
1214
"vscode": {

.eslintrc.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ env:
2525
es2022: true
2626
node: true
2727

28-
globals:
29-
__webpack_public_path__: true
30-
3128
overrides:
29+
- files: ["web_src/**/*"]
30+
globals:
31+
__webpack_public_path__: true
32+
process: false # https://github.com/webpack/webpack/issues/15833
3233
- files: ["web_src/**/*", "docs/**/*"]
3334
env:
3435
browser: true

.github/workflows/files-changed.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,21 @@ on:
1515
value: ${{ jobs.detect.outputs.templates }}
1616
docker:
1717
value: ${{ jobs.detect.outputs.docker }}
18+
swagger:
19+
value: ${{ jobs.detect.outputs.swagger }}
1820

1921
jobs:
2022
detect:
2123
runs-on: ubuntu-latest
2224
timeout-minutes: 3
23-
# Map a step output to a job output
2425
outputs:
2526
backend: ${{ steps.changes.outputs.backend }}
2627
frontend: ${{ steps.changes.outputs.frontend }}
2728
docs: ${{ steps.changes.outputs.docs }}
2829
actions: ${{ steps.changes.outputs.actions }}
2930
templates: ${{ steps.changes.outputs.templates }}
3031
docker: ${{ steps.changes.outputs.docker }}
32+
swagger: ${{ steps.changes.outputs.swagger }}
3133
steps:
3234
- uses: actions/checkout@v3
3335
- uses: dorny/paths-filter@v2
@@ -37,14 +39,18 @@ jobs:
3739
backend:
3840
- "**/*.go"
3941
- "templates/**/*.tmpl"
42+
- "assets/emoji.json"
4043
- "go.mod"
4144
- "go.sum"
45+
- "Makefile"
4246
4347
frontend:
4448
- "**/*.js"
4549
- "web_src/**"
50+
- "assets/emoji.json"
4651
- "package.json"
4752
- "package-lock.json"
53+
- "Makefile"
4854
4955
docs:
5056
- "**/*.md"
@@ -56,7 +62,12 @@ jobs:
5662
templates:
5763
- "templates/**/*.tmpl"
5864
- "poetry.lock"
65+
5966
docker:
6067
- "Dockerfile"
6168
- "Dockerfile.rootless"
6269
- "docker/**"
70+
- "Makefile"
71+
72+
swagger:
73+
- "templates/swagger/v1_json.tmpl"

.github/workflows/pull-compliance.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ jobs:
3939
- run: make deps-py
4040
- run: make lint-templates
4141

42+
lint-swagger:
43+
if: needs.files-changed.outputs.swagger == 'true'
44+
needs: files-changed
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v3
48+
- uses: actions/setup-node@v3
49+
with:
50+
node-version: 20
51+
- run: make deps-frontend
52+
- run: make lint-swagger
53+
4254
lint-go-windows:
4355
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
4456
needs: files-changed
@@ -96,6 +108,7 @@ jobs:
96108
- run: make deps-frontend
97109
- run: make lint-frontend
98110
- run: make checks-frontend
111+
- run: make test-frontend
99112
- run: make frontend
100113

101114
backend:
@@ -110,7 +123,7 @@ jobs:
110123
check-latest: true
111124
# no frontend build here as backend should be able to build
112125
# even without any frontend files
113-
- run: make deps-backend deps-tools
126+
- run: make deps-backend
114127
- run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
115128
- name: build-backend-arm64
116129
run: make backend # test cross compile

.stylelintrc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ rules:
5050
declaration-no-important: null
5151
declaration-property-max-values: null
5252
declaration-property-unit-allowed-list: null
53-
declaration-property-unit-disallowed-list: null
53+
declaration-property-unit-disallowed-list: {line-height: [em]}
5454
declaration-property-value-allowed-list: null
5555
declaration-property-value-disallowed-list: null
5656
declaration-property-value-no-unknown: true

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ Xinyi Gong <[email protected]> (@HesterG)
5252
wxiaoguang <[email protected]> (@wxiaoguang)
5353
Gary Moon <[email protected]> (@garymoon)
5454
Philip Peterson <[email protected]> (@philip-peterson)
55+
Denys Konovalov <[email protected]> (@denyskon)

Makefile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
8484

8585
ifneq ($(GITHUB_REF_TYPE),branch)
8686
VERSION ?= $(subst v,,$(GITHUB_REF_NAME))
87-
GITEA_VERSION ?= $(GITHUB_REF_NAME)
87+
GITEA_VERSION ?= $(VERSION)
8888
else
8989
ifneq ($(GITHUB_REF_NAME),)
9090
VERSION ?= $(subst release/v,,$(GITHUB_REF_NAME))
@@ -226,6 +226,8 @@ help:
226226
@echo " - test-frontend test frontend files"
227227
@echo " - test-backend test backend files"
228228
@echo " - test-e2e[\#TestSpecificName] test end to end using playwright"
229+
@echo " - update-js update js dependencies"
230+
@echo " - update-py update py dependencies"
229231
@echo " - webpack build webpack files"
230232
@echo " - svg build svg files"
231233
@echo " - fomantic build fomantic files"
@@ -358,10 +360,10 @@ lint: lint-frontend lint-backend
358360
lint-fix: lint-frontend-fix lint-backend-fix
359361

360362
.PHONY: lint-frontend
361-
lint-frontend: lint-js lint-css lint-md lint-swagger
363+
lint-frontend: lint-js lint-css
362364

363365
.PHONY: lint-frontend-fix
364-
lint-frontend-fix: lint-js-fix lint-css-fix lint-md lint-swagger
366+
lint-frontend-fix: lint-js-fix lint-css-fix
365367

366368
.PHONY: lint-backend
367369
lint-backend: lint-go lint-go-vet lint-editorconfig
@@ -924,13 +926,20 @@ node_modules: package-lock.json
924926
poetry install
925927
@touch .venv
926928

927-
.PHONY: npm-update
928-
npm-update: node-check | node_modules
929-
npx updates -cu
929+
.PHONY: update-js
930+
update-js: node-check | node_modules
931+
npx updates -u -f package.json
930932
rm -rf node_modules package-lock.json
931933
npm install --package-lock
932934
@touch node_modules
933935

936+
.PHONY: update-py
937+
update-py: node-check | node_modules
938+
npx updates -u -f pyproject.toml
939+
rm -rf .venv poetry.lock
940+
poetry install
941+
@touch .venv
942+
934943
.PHONY: fomantic
935944
fomantic:
936945
rm -rf $(FOMANTIC_WORK_DIR)/build

assets/emoji.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/generate-emoji.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525

2626
const (
2727
gemojiURL = "https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json"
28-
maxUnicodeVersion = 14
28+
maxUnicodeVersion = 15
2929
)
3030

3131
var flagOut = flag.String("o", "modules/emoji/emoji_data.go", "out")

cmd/cmd.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,21 @@ func setupConsoleLogger(level log.Level, colorize bool, out io.Writer) {
106106
WriterOption: log.WriterConsoleOption{Stderr: out == os.Stderr},
107107
}
108108
writer := log.NewEventWriterConsole("console-default", writeMode)
109-
log.GetManager().GetLogger(log.DEFAULT).RemoveAllWriters().AddWriters(writer)
109+
log.GetManager().GetLogger(log.DEFAULT).ReplaceAllWriters(writer)
110+
}
111+
112+
// PrepareConsoleLoggerLevel by default, use INFO level for console logger, but some sub-commands (for git/ssh protocol) shouldn't output any log to stdout.
113+
// Any log appears in git stdout pipe will break the git protocol, eg: client can't push and hangs forever.
114+
func PrepareConsoleLoggerLevel(defaultLevel log.Level) func(*cli.Context) error {
115+
return func(c *cli.Context) error {
116+
level := defaultLevel
117+
if c.Bool("quiet") || c.GlobalBoolT("quiet") {
118+
level = log.FATAL
119+
}
120+
if c.Bool("debug") || c.GlobalBool("debug") || c.Bool("verbose") || c.GlobalBool("verbose") {
121+
level = log.TRACE
122+
}
123+
log.SetConsoleLogger(log.DEFAULT, "console-default", level)
124+
return nil
125+
}
110126
}

cmd/doctor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func setupDoctorDefaultLogger(ctx *cli.Context, colorize bool) {
151151
log.FallbackErrorf("unable to create file log writer: %v", err)
152152
return
153153
}
154-
log.GetManager().GetLogger(log.DEFAULT).RemoveAllWriters().AddWriters(writer)
154+
log.GetManager().GetLogger(log.DEFAULT).ReplaceAllWriters(writer)
155155
}
156156
}
157157

cmd/embedded.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import (
2222
"github.com/urfave/cli"
2323
)
2424

25-
// Cmdembedded represents the available extract sub-command.
25+
// CmdEmbedded represents the available extract sub-command.
2626
var (
27-
Cmdembedded = cli.Command{
27+
CmdEmbedded = cli.Command{
2828
Name: "embedded",
2929
Usage: "Extract embedded resources",
3030
Description: "A command for extracting embedded resources, like templates and images",

cmd/hook.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"time"
1616

1717
"code.gitea.io/gitea/modules/git"
18+
"code.gitea.io/gitea/modules/log"
1819
"code.gitea.io/gitea/modules/private"
1920
repo_module "code.gitea.io/gitea/modules/repository"
2021
"code.gitea.io/gitea/modules/setting"
@@ -32,6 +33,7 @@ var (
3233
Name: "hook",
3334
Usage: "Delegate commands to corresponding Git hooks",
3435
Description: "This should only be called by Git",
36+
Before: PrepareConsoleLoggerLevel(log.FATAL),
3537
Subcommands: []cli.Command{
3638
subcmdHookPreReceive,
3739
subcmdHookUpdate,

cmd/keys.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"fmt"
99
"strings"
1010

11+
"code.gitea.io/gitea/modules/log"
1112
"code.gitea.io/gitea/modules/private"
1213

1314
"github.com/urfave/cli"
@@ -17,6 +18,7 @@ import (
1718
var CmdKeys = cli.Command{
1819
Name: "keys",
1920
Usage: "This command queries the Gitea database to get the authorized command for a given ssh key fingerprint",
21+
Before: PrepareConsoleLoggerLevel(log.FATAL),
2022
Action: runKeys,
2123
Flags: []cli.Flag{
2224
cli.StringFlag{

cmd/serv.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ var CmdServ = cli.Command{
4444
Name: "serv",
4545
Usage: "This command should only be called by SSH shell",
4646
Description: "Serv provides access auth for repositories",
47+
Before: PrepareConsoleLoggerLevel(log.FATAL),
4748
Action: runServ,
4849
Flags: []cli.Flag{
4950
cli.BoolFlag{

cmd/web.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var CmdWeb = cli.Command{
3535
Usage: "Start Gitea web server",
3636
Description: `Gitea web server is the only thing you need to run,
3737
and it takes care of all the other things for you`,
38+
Before: PrepareConsoleLoggerLevel(log.INFO),
3839
Action: runWeb,
3940
Flags: []cli.Flag{
4041
cli.StringFlag{
@@ -206,11 +207,6 @@ func servePprof() {
206207
}
207208

208209
func runWeb(ctx *cli.Context) error {
209-
if ctx.Bool("verbose") {
210-
setupConsoleLogger(log.TRACE, log.CanColorStdout, os.Stdout)
211-
} else if ctx.Bool("quiet") {
212-
setupConsoleLogger(log.FATAL, log.CanColorStdout, os.Stdout)
213-
}
214210
defer func() {
215211
if panicked := recover(); panicked != nil {
216212
log.Fatal("PANIC: %v\n%s", panicked, log.Stack(2))

contrib/environment-to-ini/environment-to-ini.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func main() {
8888
}
8989

9090
func runEnvironmentToIni(c *cli.Context) error {
91-
setting.InitWorkPathAndCommonConfig(os.Getenv, setting.ArgWorkPathAndCustomConf{
91+
setting.InitWorkPathAndCfgProvider(os.Getenv, setting.ArgWorkPathAndCustomConf{
9292
WorkPath: c.String("work-path"),
9393
CustomPath: c.String("custom-path"),
9494
CustomConf: c.String("config"),

custom/conf/app.example.ini

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,13 @@ RUN_USER = ; git
119119
;; Permission for unix socket
120120
;UNIX_SOCKET_PERMISSION = 666
121121
;;
122-
;; Local (DMZ) URL for Gitea workers (such as SSH update) accessing web service.
123-
;; In most cases you do not need to change the default value.
124-
;; Alter it only if your SSH server node is not the same as HTTP node.
125-
;; Do not set this variable if PROTOCOL is set to 'unix'.
122+
;; Local (DMZ) URL for Gitea workers (such as SSH update) accessing web service. In
123+
;; most cases you do not need to change the default value. Alter it only if
124+
;; your SSH server node is not the same as HTTP node. For different protocol, the default
125+
;; values are different. If `PROTOCOL` is `http+unix`, the default value is `http://unix/`.
126+
;; If `PROTOCOL` is `fcgi` or `fcgi+unix`, the default value is `%(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/`.
127+
;; If listen on `0.0.0.0`, the default value is `%(PROTOCOL)s://localhost:%(HTTP_PORT)s/`, Otherwise the default
128+
;; value is `%(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/`.
126129
;LOCAL_ROOT_URL = %(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/
127130
;;
128131
;; When making local connections pass the PROXY protocol header.
@@ -190,8 +193,8 @@ RUN_USER = ; git
190193
;; Use `ssh-keygen` to parse public SSH keys. The value is passed to the shell. By default, Gitea does the parsing itself.
191194
;SSH_KEYGEN_PATH =
192195
;;
193-
;; Enable SSH Authorized Key Backup when rewriting all keys, default is true
194-
;SSH_AUTHORIZED_KEYS_BACKUP = true
196+
;; Enable SSH Authorized Key Backup when rewriting all keys, default is false
197+
;SSH_AUTHORIZED_KEYS_BACKUP = false
195198
;;
196199
;; Determines which principals to allow
197200
;; - empty: if SSH_TRUSTED_USER_CA_KEYS is empty this will default to off, otherwise will default to email, username.
@@ -300,7 +303,10 @@ RUN_USER = ; git
300303
;;
301304
;;
302305
;; LFS authentication secret, change this yourself
303-
LFS_JWT_SECRET =
306+
;LFS_JWT_SECRET =
307+
;;
308+
;; Alternative location to specify LFS authentication secret. You cannot specify both this and LFS_JWT_SECRET, and must pick one
309+
;LFS_JWT_SECRET_URI = file:/etc/gitea/lfs_jwt_secret
304310
;;
305311
;; LFS authentication validity period (in time.Duration), pushes taking longer than this may fail.
306312
;LFS_HTTP_AUTH_EXPIRY = 24h
@@ -344,9 +350,6 @@ NAME = gitea
344350
USER = root
345351
;PASSWD = ;Use PASSWD = `your password` for quoting if you use special characters in the password.
346352
;SSL_MODE = false ; either "false" (default), "true", or "skip-verify"
347-
;CHARSET = utf8mb4 ;either "utf8" or "utf8mb4", default is "utf8mb4".
348-
;;
349-
;; NOTICE: for "utf8mb4" you must use MySQL InnoDB > 5.6. Gitea is unable to check this.
350353
;;
351354
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
352355
;;
@@ -527,6 +530,9 @@ ENABLE = true
527530
;; This setting is only needed if JWT_SIGNING_ALGORITHM is set to HS256, HS384 or HS512.
528531
;JWT_SECRET =
529532
;;
533+
;; Alternative location to specify OAuth2 authentication secret. You cannot specify both this and JWT_SECRET, and must pick one
534+
;JWT_SECRET_URI = file:/etc/gitea/oauth2_jwt_secret
535+
;;
530536
;; Lifetime of an OAuth2 access token in seconds
531537
;ACCESS_TOKEN_EXPIRATION_TIME = 3600
532538
;;
@@ -1337,10 +1343,10 @@ LEVEL = Info
13371343
;; Issue indexer storage path, available when ISSUE_INDEXER_TYPE is bleve
13381344
;ISSUE_INDEXER_PATH = indexers/issues.bleve ; Relative paths will be made absolute against _`AppWorkPath`_.
13391345
;;
1340-
;; Issue indexer connection string, available when ISSUE_INDEXER_TYPE is elasticsearch or meilisearch
1341-
;ISSUE_INDEXER_CONN_STR = http://elastic:changeme@localhost:9200
1346+
;; Issue indexer connection string, available when ISSUE_INDEXER_TYPE is elasticsearch (e.g. http://elastic:password@localhost:9200) or meilisearch (e.g. http://:apikey@localhost:7700)
1347+
;ISSUE_INDEXER_CONN_STR =
13421348
;;
1343-
;; Issue indexer name, available when ISSUE_INDEXER_TYPE is elasticsearch
1349+
;; Issue indexer name, available when ISSUE_INDEXER_TYPE is elasticsearch or meilisearch.
13441350
;ISSUE_INDEXER_NAME = gitea_issues
13451351
;;
13461352
;; Timeout the indexer if it takes longer than this to start.
@@ -2541,8 +2547,8 @@ LEVEL = Info
25412547
;; Enable/Disable actions capabilities
25422548
;ENABLED = false
25432549
;;
2544-
;; Default address to get action plugins, e.g. the default value means downloading from "https://gitea.com/actions/checkout" for "uses: actions/checkout@v3"
2545-
;DEFAULT_ACTIONS_URL = https://gitea.com
2550+
;; Default platform to get action plugins, `github` for `https://github.com`, `self` for the current Gitea instance.
2551+
;DEFAULT_ACTIONS_URL = github
25462552

25472553
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
25482554
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

0 commit comments

Comments
 (0)