Skip to content

Commit 8adf230

Browse files
committed
* 'main' of https://github.com/go-gitea/gitea: (87 commits) Fix template bug of LFS lock (go-gitea#18784) Various Mermaid improvements (go-gitea#18776) [skip ci] Updated translations via Crowdin Fix display time of milestones (go-gitea#18753) [skip ci] Updated translations via Crowdin Prevent dangling GetAttribute calls (go-gitea#18754) Add example to render html files (go-gitea#18736) Fix a broken link in `commits_list_small.tmpl` (go-gitea#18763) Fix broken cancel button link on patch page (go-gitea#18718) Ignore the migrate if u2f_registration is not exist (go-gitea#18760) [skip ci] Updated translations via Crowdin Increase the size of the webauthn_credential credential_id field (go-gitea#18739) Fix isempty detection of git repository (go-gitea#18746) [skip ci] Updated translations via Crowdin Send mail to issue/pr assignee/reviewer also when OnMention is set (go-gitea#18707) Reduce CI go module downloads, add make targets (go-gitea#18708) Add number in queue status to monitor page (go-gitea#18712) Fix source code line highlighting (go-gitea#18729) Fix forked repositories missed tags (go-gitea#18719) [skip ci] Updated translations via Crowdin ...
2 parents 182d358 + f48771a commit 8adf230

File tree

292 files changed

+6124
-2599
lines changed

Some content is hidden

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

292 files changed

+6124
-2599
lines changed

.drone.yml

+320-59
Large diffs are not rendered by default.

.gitattributes

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
* text=auto eol=lf
2-
/vendor/** -text -eol linguist-vendored
3-
/public/vendor/** -text -eol linguist-vendored
4-
/web_src/js/vendor/** -text -eol linguist-vendored
5-
/templates/**/*.tmpl linguist-language=Handlebars
2+
*.tmpl linguist-language=Handlebars
63
/.eslintrc linguist-language=YAML
74
/.stylelintrc linguist-language=YAML
5+
/public/vendor/** -text -eol linguist-vendored
6+
/vendor/** -text -eol linguist-vendored
87
/web_src/fomantic/build/** linguist-generated
8+
/web_src/js/vendor/** -text -eol linguist-vendored
99
Dockerfile.* linguist-language=Dockerfile

.github/ISSUE_TEMPLATE/bug-report.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ body:
1616
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq)
1717
5. Please give all relevant information below for bug reports, because
1818
incomplete details will be handled as an invalid report.
19+
6. In particular it's really important to provide pertinent logs. You must give us DEBUG level logs.
20+
Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems
21+
In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini
1922
- type: input
2023
id: gitea-ver
2124
attributes:

.github/ISSUE_TEMPLATE/ui.bug-report.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ body:
1515
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq)
1616
5. Please give all relevant information below for bug reports, because
1717
incomplete details will be handled as an invalid report.
18+
6. In particular it's really important to provide pertinent logs. If you are certain that this is a javascript
19+
error, show us the javascript console. If the error appears to relate to Gitea the server you must also give us
20+
DEBUG level logs. (See https://docs.gitea.io/en-us/logging-configuration/#debugging-problems)
1821
- type: input
1922
id: gitea-ver
2023
attributes:

.golangci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ linters:
2424

2525
run:
2626
timeout: 3m
27+
skip-dirs:
28+
- node_modules
29+
- public
30+
- web_src
2731

2832
linters-settings:
2933
gocritic:

CHANGELOG.md

+29
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,35 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.16.1](https://github.com/go-gitea/gitea/releases/tag/v1.16.1) - 2022-02-06
8+
9+
* SECURITY
10+
* Update JS dependencies, fix lint (#18389) (#18540)
11+
* ENHANCEMENTS
12+
* Add dropdown icon to label set template dropdown (#18564) (#18571)
13+
* BUGFIXES
14+
* comments on migrated issues/prs must link to the comment ID (#18630) (#18637)
15+
* Stop logging an error when notes are not found (#18626) (#18635)
16+
* Ensure that blob-excerpt links work for wiki (#18587) (#18624)
17+
* Only attempt to flush queue if the underlying worker pool is not finished (#18593) (#18620)
18+
* Ensure commit-statuses box is sized correctly in headers (#18538) (#18606)
19+
* Prevent merge messages from being sorted to the top of email chains (#18566) (#18588)
20+
* Prevent panic on prohibited user login with oauth2 (#18562) (#18563)
21+
* Collaborator trust model should trust collaborators (#18539) (#18557)
22+
* Detect conflicts with 3way merge (#18536) (#18537)
23+
* In docker rootless use $GITEA_APP_INI if provided (#18524) (#18535)
24+
* Add `GetUserTeams` (#18499) (#18531)
25+
* Fix review excerpt (#18502) (#18530)
26+
* Fix for AvatarURL database type (#18487) (#18529)
27+
* Use `ImagedProvider` for gplus oauth2 provider (#18504) (#18505)
28+
* Fix OAuth Source Edit Page (#18495) (#18503)
29+
* Use "read" value for General Access (#18496) (#18500)
30+
* Prevent NPE on partial match of compare URL and allow short SHA1 compare URLs (#18472) (#18473)
31+
* BUILD
32+
* Make docker gitea/gitea:v1.16-dev etc refer to the latest build on that branch (#18551) (#18569)
33+
* DOCS
34+
* Update 1.16.0 changelog to set #17846 as breaking (#18533) (#18534)
35+
736
## [1.16.0](https://github.com/go-gitea/gitea/releases/tag/v1.16.0) - 2022-01-30
837

938
* BREAKING

Makefile

+25-6
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ endif
6060

6161
EXTRA_GOFLAGS ?=
6262

63-
MAKE_VERSION := $(shell $(MAKE) -v | head -n 1)
63+
MAKE_VERSION := $(shell "$(MAKE)" -v | head -n 1)
6464
MAKE_EVIDENCE_DIR := .make_evidence
6565

6666
ifeq ($(RACE_ENABLED),true)
@@ -166,6 +166,9 @@ help:
166166
@echo " - watch-backend watch backend files and continuously rebuild"
167167
@echo " - clean delete backend and integration files"
168168
@echo " - clean-all delete backend, frontend and integration files"
169+
@echo " - deps install dependencies"
170+
@echo " - deps-frontend install frontend dependencies"
171+
@echo " - deps-backend install backend dependencies"
169172
@echo " - lint lint everything"
170173
@echo " - lint-frontend lint frontend files"
171174
@echo " - lint-backend lint backend files"
@@ -231,13 +234,11 @@ clean:
231234

232235
.PHONY: fmt
233236
fmt:
234-
@echo "Running gitea-fmt(with gofmt)..."
235-
@$(GO) run build/code-batch-process.go gitea-fmt -s -w '{file-list}'
236-
@echo "Running gofumpt"
237237
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
238238
$(GO) install mvdan.cc/gofumpt@latest; \
239239
fi
240-
@gofumpt -w -l -extra -lang 1.16 .
240+
@echo "Running gitea-fmt (with gofumpt)..."
241+
@$(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}'
241242

242243
.PHONY: vet
243244
vet:
@@ -285,8 +286,11 @@ errcheck:
285286

286287
.PHONY: fmt-check
287288
fmt-check:
289+
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
290+
$(GO) install mvdan.cc/gofumpt@latest; \
291+
fi
288292
# get all go files and run gitea-fmt (with gofmt) on them
289-
@diff=$$($(GO) run build/code-batch-process.go gitea-fmt -s -d '{file-list}'); \
293+
@diff=$$($(GO) run build/code-batch-process.go gitea-fmt -l '{file-list}'); \
290294
if [ -n "$$diff" ]; then \
291295
echo "Please run 'make fmt' and commit the result:"; \
292296
echo "$${diff}"; \
@@ -401,6 +405,11 @@ test-sqlite-migration: migrations.sqlite.test migrations.individual.sqlite.test
401405
GITEA_ROOT="$(CURDIR)" GITEA_CONF=integrations/sqlite.ini ./migrations.sqlite.test
402406
GITEA_ROOT="$(CURDIR)" GITEA_CONF=integrations/sqlite.ini ./migrations.individual.sqlite.test
403407

408+
.PHONY: test-sqlite-migration\#%
409+
test-sqlite-migration\#%: migrations.sqlite.test migrations.individual.sqlite.test generate-ini-sqlite
410+
GITEA_ROOT="$(CURDIR)" GITEA_CONF=integrations/sqlite.ini ./migrations.individual.sqlite.test -test.run $(subst .,/,$*)
411+
412+
404413
generate-ini-mysql:
405414
sed -e 's|{{TEST_MYSQL_HOST}}|${TEST_MYSQL_HOST}|g' \
406415
-e 's|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \
@@ -661,6 +670,16 @@ docs:
661670
fi
662671
cd docs; make trans-copy clean build-offline;
663672

673+
.PHONY: deps
674+
deps: deps-frontend deps-backend
675+
676+
.PHONY: deps-frontend
677+
deps-frontend: node_modules
678+
679+
.PHONY: deps-backend
680+
deps-backend:
681+
$(GO) mod download
682+
664683
node_modules: package-lock.json
665684
npm install --no-save
666685
@touch node_modules

build/code-batch-process.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ func containsString(a []string, s string) bool {
229229
return false
230230
}
231231

232-
func giteaFormatGoImports(files []string) error {
232+
func giteaFormatGoImports(files []string, hasChangedFiles, doWriteFile bool) error {
233233
for _, file := range files {
234-
if err := codeformat.FormatGoImports(file); err != nil {
234+
if err := codeformat.FormatGoImports(file, hasChangedFiles, doWriteFile); err != nil {
235235
log.Printf("failed to format go imports: %s, err=%v", file, err)
236236
return err
237237
}
@@ -267,10 +267,11 @@ func main() {
267267
logVerbose("batch cmd: %s %v", subCmd, substArgs)
268268
switch subCmd {
269269
case "gitea-fmt":
270-
if containsString(subArgs, "-w") {
271-
cmdErrors = append(cmdErrors, giteaFormatGoImports(files))
270+
if containsString(subArgs, "-d") {
271+
log.Print("the -d option is not supported by gitea-fmt")
272272
}
273-
cmdErrors = append(cmdErrors, passThroughCmd("gofmt", substArgs))
273+
cmdErrors = append(cmdErrors, giteaFormatGoImports(files, containsString(subArgs, "-l"), containsString(subArgs, "-w")))
274+
cmdErrors = append(cmdErrors, passThroughCmd("gofumpt", append([]string{"-extra", "-lang", "1.16"}, substArgs...)))
274275
case "misspell":
275276
cmdErrors = append(cmdErrors, passThroughCmd("misspell", substArgs))
276277
default:

build/codeformat/formatimports.go

+15-5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package codeformat
77
import (
88
"bytes"
99
"errors"
10+
"fmt"
1011
"io"
1112
"os"
1213
"sort"
@@ -158,7 +159,7 @@ func formatGoImports(contentBytes []byte) ([]byte, error) {
158159
}
159160

160161
// FormatGoImports format the imports by our rules (see unit tests)
161-
func FormatGoImports(file string) error {
162+
func FormatGoImports(file string, doChangedFiles, doWriteFile bool) error {
162163
f, err := os.Open(file)
163164
if err != nil {
164165
return err
@@ -181,11 +182,20 @@ func FormatGoImports(file string) error {
181182
if bytes.Equal(contentBytes, formattedBytes) {
182183
return nil
183184
}
184-
f, err = os.OpenFile(file, os.O_TRUNC|os.O_WRONLY, 0o644)
185-
if err != nil {
185+
186+
if doChangedFiles {
187+
fmt.Println(file)
188+
}
189+
190+
if doWriteFile {
191+
f, err = os.OpenFile(file, os.O_TRUNC|os.O_WRONLY, 0o644)
192+
if err != nil {
193+
return err
194+
}
195+
defer f.Close()
196+
_, err = f.Write(formattedBytes)
186197
return err
187198
}
188-
defer f.Close()
189-
_, err = f.Write(formattedBytes)
199+
190200
return err
191201
}

cmd/admin_auth_ldap.go

-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ func parseLdapConfig(c *cli.Context, config *ldap.Source) error {
260260
if c.IsSet("skip-local-2fa") {
261261
config.SkipLocalTwoFA = c.Bool("skip-local-2fa")
262262
}
263-
264263
return nil
265264
}
266265

cmd/hook.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ func runHookPostReceive(c *cli.Context) error {
309309
defer cancel()
310310

311311
// First of all run update-server-info no matter what
312-
if _, err := git.NewCommandContext(ctx, "update-server-info").Run(); err != nil {
312+
if _, err := git.NewCommand(ctx, "update-server-info").Run(); err != nil {
313313
return fmt.Errorf("Failed to call 'git update-server-info': %v", err)
314314
}
315315

cmd/web.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -222,18 +222,19 @@ func listen(m http.Handler, handleRedirector bool) error {
222222
}
223223
err = runHTTP("tcp", listenAddr, "Web", m)
224224
case setting.HTTPS:
225-
if setting.EnableLetsEncrypt {
226-
err = runLetsEncrypt(listenAddr, setting.Domain, setting.LetsEncryptDirectory, setting.LetsEncryptEmail, m)
225+
if setting.EnableAcme {
226+
err = runACME(listenAddr, m)
227227
break
228-
}
229-
if handleRedirector {
230-
if setting.RedirectOtherPort {
231-
go runHTTPRedirector()
232-
} else {
233-
NoHTTPRedirector()
228+
} else {
229+
if handleRedirector {
230+
if setting.RedirectOtherPort {
231+
go runHTTPRedirector()
232+
} else {
233+
NoHTTPRedirector()
234+
}
234235
}
236+
err = runHTTPS("tcp", listenAddr, "Web", setting.CertFile, setting.KeyFile, m)
235237
}
236-
err = runHTTPS("tcp", listenAddr, "Web", setting.CertFile, setting.KeyFile, m)
237238
case setting.FCGI:
238239
if handleRedirector {
239240
NoHTTPRedirector()

cmd/web_letsencrypt.go cmd/web_acme.go

+38-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
package cmd
66

77
import (
8+
"crypto/x509"
9+
"encoding/pem"
10+
"fmt"
811
"net/http"
12+
"os"
913
"strconv"
1014
"strings"
1115

@@ -16,7 +20,25 @@ import (
1620
"github.com/caddyserver/certmagic"
1721
)
1822

19-
func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler) error {
23+
func getCARoot(path string) (*x509.CertPool, error) {
24+
r, err := os.ReadFile(path)
25+
if err != nil {
26+
return nil, err
27+
}
28+
block, _ := pem.Decode(r)
29+
if block == nil {
30+
return nil, fmt.Errorf("no PEM found in the file %s", path)
31+
}
32+
caRoot, err := x509.ParseCertificate(block.Bytes)
33+
if err != nil {
34+
return nil, err
35+
}
36+
certPool := x509.NewCertPool()
37+
certPool.AddCert(caRoot)
38+
return certPool, nil
39+
}
40+
41+
func runACME(listenAddr string, m http.Handler) error {
2042
// If HTTP Challenge enabled, needs to be serving on port 80. For TLSALPN needs 443.
2143
// Due to docker port mapping this can't be checked programmatically
2244
// TODO: these are placeholders until we add options for each in settings with appropriate warning
@@ -33,10 +55,21 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
3355
}
3456

3557
magic := certmagic.NewDefault()
36-
magic.Storage = &certmagic.FileStorage{Path: directory}
58+
magic.Storage = &certmagic.FileStorage{Path: setting.AcmeLiveDirectory}
59+
// Try to use private CA root if provided, otherwise defaults to system's trust
60+
var certPool *x509.CertPool
61+
if setting.AcmeCARoot != "" {
62+
var err error
63+
certPool, err = getCARoot(setting.AcmeCARoot)
64+
if err != nil {
65+
log.Warn("Failed to parse CA Root certificate, using default CA trust: %v", err)
66+
}
67+
}
3768
myACME := certmagic.NewACMEManager(magic, certmagic.ACMEManager{
38-
Email: email,
39-
Agreed: setting.LetsEncryptTOS,
69+
CA: setting.AcmeURL,
70+
TrustedRoots: certPool,
71+
Email: setting.AcmeEmail,
72+
Agreed: setting.AcmeTOS,
4073
DisableHTTPChallenge: !enableHTTPChallenge,
4174
DisableTLSALPNChallenge: !enableTLSALPNChallenge,
4275
ListenHost: setting.HTTPAddr,
@@ -47,7 +80,7 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
4780
magic.Issuers = []certmagic.Issuer{myACME}
4881

4982
// this obtains certificates or renews them if necessary
50-
err := magic.ManageSync(graceful.GetManager().HammerContext(), []string{domain})
83+
err := magic.ManageSync(graceful.GetManager().HammerContext(), []string{setting.Domain})
5184
if err != nil {
5285
return err
5386
}

contrib/fhs-compliant-script/gitea

+2-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ for i in "$@"; do
3333
done
3434

3535
if [ -z "$APP_INI_SET" ]; then
36-
CONF_ARG="-c \"$APP_INI\""
36+
CONF_ARG=("-c" "${GITEA_APP_INI:-$APP_INI}")
3737
fi
3838

3939
# Provide FHS compliant defaults
40-
GITEA_WORK_DIR="${GITEA_WORK_DIR:-$WORK_DIR}" exec -a "$0" "$GITEA" $CONF_ARG "$@"
41-
42-
40+
GITEA_WORK_DIR="${GITEA_WORK_DIR:-$WORK_DIR}" exec -a "$0" "$GITEA" "${CONF_ARG[@]}" "$@"

0 commit comments

Comments
 (0)