Skip to content

Commit 200dad8

Browse files
authored
Merge branch 'main' into avatarapi
2 parents 252b0a2 + 9538842 commit 200dad8

File tree

336 files changed

+5303
-3297
lines changed

Some content is hidden

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

336 files changed

+5303
-3297
lines changed

.devcontainer/devcontainer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
// installs nodejs into container
66
"ghcr.io/devcontainers/features/node:1": {
77
"version":"20"
8-
}
8+
},
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": {}
912
},
1013
"customizations": {
1114
"vscode": {
@@ -20,7 +23,7 @@
2023
"Vue.volar",
2124
"ms-azuretools.vscode-docker",
2225
"zixuanchen.vitest-explorer",
23-
"alexcvzz.vscode-sqlite"
26+
"qwtel.sqlite-viewer"
2427
]
2528
}
2629
},

.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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
detect:
2121
runs-on: ubuntu-latest
2222
timeout-minutes: 3
23-
# Map a step output to a job output
2423
outputs:
2524
backend: ${{ steps.changes.outputs.backend }}
2625
frontend: ${{ steps.changes.outputs.frontend }}
@@ -39,12 +38,14 @@ jobs:
3938
- "templates/**/*.tmpl"
4039
- "go.mod"
4140
- "go.sum"
41+
- "Makefile"
4242
4343
frontend:
4444
- "**/*.js"
4545
- "web_src/**"
4646
- "package.json"
4747
- "package-lock.json"
48+
- "Makefile"
4849
4950
docs:
5051
- "**/*.md"
@@ -56,7 +57,9 @@ jobs:
5657
templates:
5758
- "templates/**/*.tmpl"
5859
- "poetry.lock"
60+
5961
docker:
6062
- "Dockerfile"
6163
- "Dockerfile.rootless"
6264
- "docker/**"
65+
- "Makefile"

.github/workflows/pull-compliance.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ jobs:
9696
- run: make deps-frontend
9797
- run: make lint-frontend
9898
- run: make checks-frontend
99+
- run: make test-frontend
99100
- run: make frontend
100101

101102
backend:
@@ -110,7 +111,7 @@ jobs:
110111
check-latest: true
111112
# no frontend build here as backend should be able to build
112113
# even without any frontend files
113-
- run: make deps-backend deps-tools
114+
- run: make deps-backend
114115
- run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
115116
- name: build-backend-arm64
116117
run: make backend # test cross compile

.github/workflows/release-nightly.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ jobs:
5555
runs-on: ubuntu-latest
5656
steps:
5757
- uses: actions/checkout@v3
58+
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
59+
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
60+
- run: git fetch --unshallow --quiet --tags --force
5861
- uses: docker/setup-qemu-action@v2
5962
- uses: docker/setup-buildx-action@v2
6063
- name: Get cleaned branch name
@@ -75,12 +78,14 @@ jobs:
7578
- name: build rootful docker image
7679
uses: docker/build-push-action@v4
7780
with:
81+
context: .
7882
platforms: linux/amd64,linux/arm64
7983
push: true
8084
tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}
8185
- name: build rootless docker image
8286
uses: docker/build-push-action@v4
8387
with:
88+
context: .
8489
platforms: linux/amd64,linux/arm64
8590
push: true
8691
file: Dockerfile.rootless

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ cpu.out
5353
/bin
5454
/dist
5555
/custom/*
56-
!/custom/conf
57-
/custom/conf/*
5856
!/custom/conf/app.example.ini
5957
/data
6058
/indexers

.gitpod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ vscode:
3434
- Vue.volar
3535
- ms-azuretools.vscode-docker
3636
- zixuanchen.vitest-explorer
37-
- alexcvzz.vscode-sqlite
37+
- qwtel.sqlite-viewer
3838

3939
ports:
4040
- name: Gitea

.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

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ be reviewed by two maintainers and must pass the automatic tests.
557557
- And then push the tag as `git push origin v$vmaj.$vmin.$`. Drone CI will automatically create a release and upload all the compiled binary. (But currently it doesn't add the release notes automatically. Maybe we should fix that.)
558558
- If needed send a frontport PR for the changelog to branch `main` and update the version in `docs/config.yaml` to refer to the new version.
559559
- Send PR to [blog repository](https://gitea.com/gitea/blog) announcing the release.
560-
- Verify all release assets were correctly published through CI on dl.gitea.io and GitHub releases. Once ACKed:
561-
- bump the version of https://dl.gitea.io/gitea/version.json
560+
- Verify all release assets were correctly published through CI on dl.gitea.com and GitHub releases. Once ACKed:
561+
- bump the version of https://dl.gitea.com/gitea/version.json
562562
- merge the blog post PR
563563
- announce the release in discord `#announcements`

Makefile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,12 @@ endif
7979
STORED_VERSION_FILE := VERSION
8080
HUGO_VERSION ?= 0.111.3
8181

82+
GITHUB_REF_TYPE ?= branch
83+
GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
84+
8285
ifneq ($(GITHUB_REF_TYPE),branch)
8386
VERSION ?= $(subst v,,$(GITHUB_REF_NAME))
84-
GITEA_VERSION ?= $(GITHUB_REF_NAME)
87+
GITEA_VERSION ?= $(VERSION)
8588
else
8689
ifneq ($(GITHUB_REF_NAME),)
8790
VERSION ?= $(subst release/v,,$(GITHUB_REF_NAME))
@@ -223,6 +226,8 @@ help:
223226
@echo " - test-frontend test frontend files"
224227
@echo " - test-backend test backend files"
225228
@echo " - test-e2e[\#TestSpecificName] test end to end using playwright"
229+
@echo " - update-js update js dependencies"
230+
@echo " - update-py update py dependencies"
226231
@echo " - webpack build webpack files"
227232
@echo " - svg build svg files"
228233
@echo " - fomantic build fomantic files"
@@ -921,13 +926,20 @@ node_modules: package-lock.json
921926
poetry install
922927
@touch .venv
923928

924-
.PHONY: npm-update
925-
npm-update: node-check | node_modules
926-
npx updates -cu
929+
.PHONY: update-js
930+
update-js: node-check | node_modules
931+
npx updates -u -f package.json
927932
rm -rf node_modules package-lock.json
928933
npm install --package-lock
929934
@touch node_modules
930935

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+
931943
.PHONY: fomantic
932944
fomantic:
933945
rm -rf $(FOMANTIC_WORK_DIR)/build
@@ -1011,9 +1023,5 @@ docker:
10111023
docker build --disable-content-trust=false -t $(DOCKER_REF) .
10121024
# support also build args docker build --build-arg GITEA_VERSION=v1.2.3 --build-arg TAGS="bindata sqlite sqlite_unlock_notify" .
10131025

1014-
.PHONY: docker-build
1015-
docker-build:
1016-
docker run -ti --rm -v "$(CURDIR):/srv/app/src/code.gitea.io/gitea" -w /srv/app/src/code.gitea.io/gitea -e TAGS="bindata $(TAGS)" LDFLAGS="$(LDFLAGS)" CGO_EXTRA_CFLAGS="$(CGO_EXTRA_CFLAGS)" webhippie/golang:edge make clean build
1017-
10181026
# This endif closes the if at the top of the file
10191027
endif

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ for the full license text.
173173

174174
Looking for an overview of the interface? Check it out!
175175

176-
|![Dashboard](https://dl.gitea.io/screenshots/home_timeline.png)|![User Profile](https://dl.gitea.io/screenshots/user_profile.png)|![Global Issues](https://dl.gitea.io/screenshots/global_issues.png)|
176+
|![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)|
177177
|:---:|:---:|:---:|
178-
|![Branches](https://dl.gitea.io/screenshots/branches.png)|![Web Editor](https://dl.gitea.io/screenshots/web_editor.png)|![Activity](https://dl.gitea.io/screenshots/activity.png)|
179-
|![New Migration](https://dl.gitea.io/screenshots/migration.png)|![Migrating](https://dl.gitea.io/screenshots/migration.gif)|![Pull Request View](https://image.ibb.co/e02dSb/6.png)
180-
![Pull Request Dark](https://dl.gitea.io/screenshots/pull_requests_dark.png)|![Diff Review Dark](https://dl.gitea.io/screenshots/review_dark.png)|![Diff Dark](https://dl.gitea.io/screenshots/diff_dark.png)|
178+
|![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)|
179+
|![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)
180+
![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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ Fork -> Patch -> Push -> Pull Request
9191

9292
## 截图
9393

94-
|![Dashboard](https://dl.gitea.io/screenshots/home_timeline.png)|![User Profile](https://dl.gitea.io/screenshots/user_profile.png)|![Global Issues](https://dl.gitea.io/screenshots/global_issues.png)|
94+
|![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)|
9595
|:---:|:---:|:---:|
96-
|![Branches](https://dl.gitea.io/screenshots/branches.png)|![Web Editor](https://dl.gitea.io/screenshots/web_editor.png)|![Activity](https://dl.gitea.io/screenshots/activity.png)|
97-
|![New Migration](https://dl.gitea.io/screenshots/migration.png)|![Migrating](https://dl.gitea.io/screenshots/migration.gif)|![Pull Request View](https://image.ibb.co/e02dSb/6.png)
98-
![Pull Request Dark](https://dl.gitea.io/screenshots/pull_requests_dark.png)|![Diff Review Dark](https://dl.gitea.io/screenshots/review_dark.png)|![Diff Dark](https://dl.gitea.io/screenshots/diff_dark.png)|
96+
|![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)|
97+
|![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)
98+
![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/actions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func runGenerateActionsRunnerToken(c *cli.Context) error {
4242
ctx, cancel := installSignals()
4343
defer cancel()
4444

45-
setting.Init(&setting.Options{})
45+
setting.MustInstalled()
4646

4747
scope := c.String("scope")
4848

cmd/cmd.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func confirm() (bool, error) {
5858
}
5959

6060
func initDB(ctx context.Context) error {
61-
setting.Init(&setting.Options{})
61+
setting.MustInstalled()
6262
setting.LoadDBSetting()
6363
setting.InitSQLLoggersForCli(log.INFO)
6464

@@ -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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func runRecreateTable(ctx *cli.Context) error {
9191
golog.SetOutput(log.LoggerToWriter(log.GetLogger(log.DEFAULT).Info))
9292

9393
debug := ctx.Bool("debug")
94-
setting.Init(&setting.Options{})
94+
setting.MustInstalled()
9595
setting.LoadDBSetting()
9696

9797
if debug {
@@ -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/dump.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func runDump(ctx *cli.Context) error {
182182
}
183183
fileName += "." + outType
184184
}
185-
setting.Init(&setting.Options{})
185+
setting.MustInstalled()
186186

187187
// make sure we are logging to the console no matter what the configuration tells us do to
188188
// FIXME: don't use CfgProvider directly

cmd/embedded.go

Lines changed: 2 additions & 7 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",
@@ -99,11 +99,6 @@ type assetFile struct {
9999
func initEmbeddedExtractor(c *cli.Context) error {
100100
setupConsoleLogger(log.ERROR, log.CanColorStderr, os.Stderr)
101101

102-
// Read configuration file
103-
setting.Init(&setting.Options{
104-
AllowEmpty: true,
105-
})
106-
107102
patterns, err := compileCollectPatterns(c.Args())
108103
if err != nil {
109104
return err

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/mailer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func runSendMail(c *cli.Context) error {
1616
ctx, cancel := installSignals()
1717
defer cancel()
1818

19-
setting.Init(&setting.Options{})
19+
setting.MustInstalled()
2020

2121
if err := argsSet(c, "title"); err != nil {
2222
return err

cmd/restore_repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func runRestoreRepository(c *cli.Context) error {
5151
ctx, cancel := installSignals()
5252
defer cancel()
5353

54-
setting.Init(&setting.Options{})
54+
setting.MustInstalled()
5555
var units []string
5656
if s := c.String("units"); s != "" {
5757
units = strings.Split(s, ",")

cmd/serv.go

Lines changed: 2 additions & 1 deletion
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{
@@ -61,7 +62,7 @@ func setup(ctx context.Context, debug bool) {
6162
} else {
6263
setupConsoleLogger(log.FATAL, false, os.Stderr)
6364
}
64-
setting.Init(&setting.Options{})
65+
setting.MustInstalled()
6566
if debug {
6667
setting.RunMode = "dev"
6768
}

0 commit comments

Comments
 (0)