Skip to content

Commit 6ebcf69

Browse files
authored
Merge branch 'master' into fix-15075-fix-reference-link-relative-paths
2 parents 8c31365 + 84f5a0b commit 6ebcf69

File tree

462 files changed

+18357
-14578
lines changed

Some content is hidden

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

462 files changed

+18357
-14578
lines changed

.drone.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,17 @@ steps:
7070
- make checks-backend
7171
depends_on: [lint-backend]
7272

73+
- name: test-frontend
74+
image: node:14
75+
commands:
76+
- make test-frontend
77+
depends_on: [lint-frontend]
78+
7379
- name: build-frontend
7480
image: node:14
7581
commands:
7682
- make frontend
77-
depends_on: [lint-frontend]
83+
depends_on: [test-frontend]
7884

7985
- name: build-backend-no-gcc
8086
pull: always
@@ -495,7 +501,7 @@ steps:
495501
pull: always
496502
image: techknowlogick/xgo:go-1.16.x
497503
commands:
498-
- curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt -y install nodejs
504+
- curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs
499505
- export PATH=$PATH:$GOPATH/bin
500506
- make release
501507
environment:
@@ -591,7 +597,7 @@ steps:
591597
pull: always
592598
image: techknowlogick/xgo:go-1.16.x
593599
commands:
594-
- curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt -y install nodejs
600+
- curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs
595601
- export PATH=$PATH:$GOPATH/bin
596602
- make release
597603
environment:

.eslintrc

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ root: true
22
reportUnusedDisableDirectives: true
33

44
ignorePatterns:
5-
- /web_src/js/vendor
65
- /templates/base/head.tmpl
76
- /templates/repo/activity.tmpl
87
- /templates/repo/view_file.tmpl
@@ -53,6 +52,12 @@ overrides:
5352
rules:
5453
import/no-unresolved: [0]
5554
import/no-extraneous-dependencies: [0]
55+
- files: ["*.test.js"]
56+
env:
57+
jest: true
58+
- files: ["*.config.js"]
59+
rules:
60+
import/no-unused-modules: [0]
5661

5762
rules:
5863
accessor-pairs: [2]

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ coverage.all
8080
/public/css
8181
/public/fonts
8282
/public/img/webpack
83+
/web_src/fomantic/node_modules
8384
/web_src/fomantic/build/*
8485
!/web_src/fomantic/build/semantic.js
8586
!/web_src/fomantic/build/semantic.css

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
audit=false
22
fund=false
3+
update-notifier=false
34
package-lock=true
45
save-exact=true

CHANGELOG.md

+37
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ 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.14.0-RC2](https://github.com/go-gitea/gitea/releases/tag/v1.14.0-rc2) - 2021-03-22
8+
9+
* SECURITY
10+
* Fix bug on avatar middleware (#15124) (#15125)
11+
* Fix another clusterfuzz identified issue (#15096) (#15113)
12+
* Update to goldmark 1.3.3 (#15059) (#15060)
13+
* BUGFIXES
14+
* Fix the v176 migration (#15110) (#15111)
15+
* Fix double 'push tag' action feed (#15078) (#15083)
16+
* Remove possible resource leak (#15067) (#15082)
17+
* Handle unauthorized user events gracefully (#15071) (#15074)
18+
719
## [1.14.0-RC1](https://github.com/go-gitea/gitea/releases/tag/v1.14.0-rc1) - 2021-03-19
820

921
* SECURITY
@@ -267,6 +279,31 @@ been added to each release, please refer to the [blog](https://blog.gitea.io).
267279
* Reduce make verbosity (#13803)
268280
* Add git command error directory on log (#13194)
269281

282+
## [1.13.7](https://github.com/go-gitea/gitea/releases/tag/v1.13.7) - 2021-04-07
283+
284+
* SECURITY
285+
* Update to bluemonday-1.0.6 (#15294) (#15298)
286+
* Clusterfuzz found another way (#15160) (#15169)
287+
* API
288+
* Fix wrong user returned in API (#15139) (#15150)
289+
* BUGFIXES
290+
* Add 'fonts' into 'KnownPublicEntries' (#15188) (#15317)
291+
* Speed up `enry.IsVendor` (#15213) (#15246)
292+
* Response 404 for diff/patch of a commit that not exist (#15221) (#15238)
293+
* Prevent NPE in CommentMustAsDiff if no hunk header (#15199) (#15201)
294+
* MISC
295+
* Add size to Save function (#15264) (#15271)
296+
297+
## [1.13.6](https://github.com/go-gitea/gitea/releases/tag/v1.13.6) - 2021-03-23
298+
299+
* SECURITY
300+
* Fix bug on avatar middleware (#15124) (#15125)
301+
* Fix another clusterfuzz identified issue (#15096) (#15114)
302+
* API
303+
* Fix nil exeption for get pull reviews API #15104 (#15106)
304+
* BUGFIXES
305+
* Fix markdown rendering in milestone content (#15056) (#15092)
306+
270307
## [1.13.5](https://github.com/go-gitea/gitea/releases/tag/v1.13.5) - 2021-03-21
271308

272309
* SECURITY

MAINTAINERS

+1
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ Karl Heinz Marbaise <[email protected]> (@khmarbaise)
4141
Norwin Roosen <[email protected]> (@noerw)
4242
Kyle Dumont <[email protected]> (@kdumontnu)
4343
Patrick Schratz <[email protected]> (@pat-s)
44+
Janis Estelmann <[email protected]> (@KN4CK3R)

Makefile

+30-22
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ COMMA := ,
2626

2727
XGO_VERSION := go-1.16.x
2828
MIN_GO_VERSION := 001014000
29-
MIN_NODE_VERSION := 010013000
29+
MIN_NODE_VERSION := 012017000
3030

3131
DOCKER_IMAGE ?= gitea/gitea
3232
DOCKER_TAG ?= latest
@@ -91,9 +91,7 @@ LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64
9191

9292
GO_PACKAGES ?= $(filter-out code.gitea.io/gitea/models/migrations code.gitea.io/gitea/integrations/migration-test code.gitea.io/gitea/integrations,$(shell $(GO) list -mod=vendor ./... | grep -v /vendor/))
9393

94-
FOMANTIC_CONFIGS := semantic.json web_src/fomantic/theme.config.less web_src/fomantic/_site/globals/site.variables
95-
FOMANTIC_DEST := web_src/fomantic/build/semantic.js web_src/fomantic/build/semantic.css
96-
FOMANTIC_DEST_DIR := web_src/fomantic/build
94+
FOMANTIC_WORK_DIR := web_src/fomantic
9795

9896
WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f)
9997
WEBPACK_CONFIGS := webpack.config.js
@@ -113,6 +111,8 @@ TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags
113111

114112
TEST_TAGS ?= sqlite sqlite_unlock_notify
115113

114+
TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMANTIC_WORK_DIR)/node_modules $(DIST) $(MAKE_EVIDENCE_DIR) $(AIR_TMP_DIR)
115+
116116
GO_DIRS := cmd integrations models modules routers build services vendor tools
117117

118118
GO_SOURCES := $(wildcard *.go)
@@ -171,6 +171,9 @@ help:
171171
@echo " - checks run various consistency checks"
172172
@echo " - checks-frontend check frontend files"
173173
@echo " - checks-backend check backend files"
174+
@echo " - test test everything"
175+
@echo " - test-frontend test frontend files"
176+
@echo " - test-backend test backend files"
174177
@echo " - webpack build webpack files"
175178
@echo " - svg build svg files"
176179
@echo " - fomantic build fomantic files"
@@ -320,7 +323,7 @@ lint: lint-frontend lint-backend
320323

321324
.PHONY: lint-frontend
322325
lint-frontend: node_modules
323-
npx eslint --color --max-warnings=0 web_src/js build templates webpack.config.js
326+
npx eslint --color --max-warnings=0 web_src/js build templates *.config.js
324327
npx stylelint --color --max-warnings=0 web_src/less
325328

326329
.PHONY: lint-backend
@@ -343,16 +346,23 @@ watch-backend: go-check
343346
air -c .air.conf
344347

345348
.PHONY: test
346-
test:
349+
test: test-frontend test-backend
350+
351+
.PHONY: test-backend
352+
test-backend:
347353
@echo "Running go test with -tags '$(TEST_TAGS)'..."
348354
@$(GO) test $(GOTESTFLAGS) -mod=vendor -tags='$(TEST_TAGS)' $(GO_PACKAGES)
349355

356+
.PHONY: test-frontend
357+
test-frontend:
358+
@NODE_OPTIONS="--experimental-vm-modules --no-warnings" npx jest --color
359+
350360
.PHONY: test-check
351361
test-check:
352362
@echo "Running test-check...";
353363
@diff=$$(git status -s); \
354364
if [ -n "$$diff" ]; then \
355-
echo "make test has changed files in the source tree:"; \
365+
echo "make test-backend has changed files in the source tree:"; \
356366
echo "$${diff}"; \
357367
echo "You should change the tests to create these files in a temporary directory."; \
358368
echo "Do not simply add these files to .gitignore"; \
@@ -577,7 +587,7 @@ install: $(wildcard *.go)
577587
build: frontend backend
578588

579589
.PHONY: frontend
580-
frontend: node-check $(WEBPACK_DEST)
590+
frontend: $(WEBPACK_DEST)
581591

582592
.PHONY: backend
583593
backend: go-check generate $(EXECUTABLE)
@@ -642,9 +652,11 @@ release-compress: | $(DIST_DIRS)
642652
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && gxz -k -9 $${file}; done;
643653

644654
.PHONY: release-sources
645-
release-sources: | $(DIST_DIRS) node_modules
655+
release-sources: | $(DIST_DIRS)
646656
echo $(VERSION) > $(STORED_VERSION_FILE)
647-
tar --exclude=./$(DIST) --exclude=./.git --exclude=./$(MAKE_EVIDENCE_DIR) --exclude=./node_modules/.cache --exclude=./$(AIR_TMP_DIR) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz .
657+
# bsdtar needs a ^ to prevent matching subdirectories
658+
$(eval EXCL := --exclude=$(shell tar --help | grep -q bsdtar && echo "^")./)
659+
tar $(addprefix $(EXCL),$(TAR_EXCLUDES)) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz .
648660
rm -f $(STORED_VERSION_FILE)
649661

650662
.PHONY: release-docs
@@ -670,22 +682,18 @@ npm-update: node-check | node_modules
670682
@touch node_modules
671683

672684
.PHONY: fomantic
673-
fomantic: $(FOMANTIC_DEST)
674-
675-
$(FOMANTIC_DEST): $(FOMANTIC_CONFIGS) | node_modules
676-
@if [ ! -d node_modules/fomantic-ui ]; then \
677-
npm install --no-save --no-package-lock [email protected]; \
678-
fi
679-
rm -rf $(FOMANTIC_DEST_DIR)
680-
cp -f web_src/fomantic/theme.config.less node_modules/fomantic-ui/src/theme.config
681-
cp -rf web_src/fomantic/_site/* node_modules/fomantic-ui/src/_site/
682-
npx gulp -f node_modules/fomantic-ui/gulpfile.js build
683-
@touch $(FOMANTIC_DEST)
685+
fomantic:
686+
rm -rf $(FOMANTIC_WORK_DIR)/build
687+
cd $(FOMANTIC_WORK_DIR) && npm install --no-save
688+
cp -f $(FOMANTIC_WORK_DIR)/theme.config.less $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui/src/theme.config
689+
cp -rf $(FOMANTIC_WORK_DIR)/_site $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui/src/
690+
cd $(FOMANTIC_WORK_DIR) && npx gulp -f node_modules/fomantic-ui/gulpfile.js build
684691

685692
.PHONY: webpack
686693
webpack: $(WEBPACK_DEST)
687694

688-
$(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) package-lock.json | node_modules
695+
$(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) package-lock.json
696+
@$(MAKE) -s node-check node_modules
689697
rm -rf $(WEBPACK_DEST_ENTRIES)
690698
npx webpack
691699
@touch $(WEBPACK_DEST)

README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,11 @@ or if sqlite support is required:
7777
The `build` target is split into two sub-targets:
7878

7979
- `make backend` which requires [Go 1.13](https://golang.org/dl/) or greater.
80-
- `make frontend` which requires [Node.js 10.13](https://nodejs.org/en/download/) or greater.
80+
- `make frontend` which requires [Node.js 12.17](https://nodejs.org/en/download/) or greater and Internet connectivity to download npm dependencies.
8181

82-
If pre-built frontend files are present it is possible to only build the backend:
82+
When building from the official source tarballs which include pre-built frontend files, the `frontend` target will not be triggered, making it possible to build without Node.js and Internet connectivity.
8383

84-
TAGS="bindata" make backend
85-
86-
Parallelism is not supported for these targets, so please don't include `-j <num>`.
84+
Parallelism (`make -j <num>`) is not supported.
8785

8886
More info: https://docs.gitea.io/en-us/install-from-source/
8987

build/generate-images.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
#!/usr/bin/env node
2-
'use strict';
3-
4-
const imageminZopfli = require('imagemin-zopfli');
5-
const {optimize, extendDefaultPlugins} = require('svgo');
6-
const {fabric} = require('fabric');
7-
const {readFile, writeFile} = require('fs').promises;
8-
const {resolve} = require('path');
1+
import imageminZopfli from 'imagemin-zopfli';
2+
import {optimize, extendDefaultPlugins} from 'svgo';
3+
import {fabric} from 'fabric';
4+
import {readFile, writeFile} from 'fs/promises';
5+
import {resolve, dirname} from 'path';
6+
import {fileURLToPath} from 'url';
97

8+
const __dirname = dirname(fileURLToPath(import.meta.url));
109
const logoFile = resolve(__dirname, '../assets/logo.svg');
1110

1211
function exit(err) {

build/generate-svg.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
#!/usr/bin/env node
2-
'use strict';
3-
4-
const fastGlob = require('fast-glob');
5-
const {optimize, extendDefaultPlugins} = require('svgo');
6-
const {resolve, parse} = require('path');
7-
const {readFile, writeFile, mkdir} = require('fs').promises;
1+
import fastGlob from 'fast-glob';
2+
import {optimize, extendDefaultPlugins} from 'svgo';
3+
import {resolve, parse, dirname} from 'path';
4+
import {readFile, writeFile, mkdir} from 'fs/promises';
5+
import {fileURLToPath} from 'url';
86

7+
const __dirname = dirname(fileURLToPath(import.meta.url));
98
const glob = (pattern) => fastGlob.sync(pattern, {cwd: resolve(__dirname), absolute: true});
109
const outputDir = resolve(__dirname, '../public/img/svg');
1110

cmd/admin.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ func runDeleteUser(c *cli.Context) error {
512512
return models.DeleteUser(user)
513513
}
514514

515-
func runRepoSyncReleases(c *cli.Context) error {
515+
func runRepoSyncReleases(_ *cli.Context) error {
516516
if err := initDB(); err != nil {
517517
return err
518518
}
@@ -578,14 +578,14 @@ func getReleaseCount(id int64) (int64, error) {
578578
)
579579
}
580580

581-
func runRegenerateHooks(c *cli.Context) error {
581+
func runRegenerateHooks(_ *cli.Context) error {
582582
if err := initDB(); err != nil {
583583
return err
584584
}
585585
return repo_module.SyncRepositoryHooks(graceful.GetManager().ShutdownContext())
586586
}
587587

588-
func runRegenerateKeys(c *cli.Context) error {
588+
func runRegenerateKeys(_ *cli.Context) error {
589589
if err := initDB(); err != nil {
590590
return err
591591
}

cmd/hook.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Gitea or set your environment appropriately.`, "")
166166
}
167167

168168
// the environment setted on serv command
169-
isWiki := (os.Getenv(models.EnvRepoIsWiki) == "true")
169+
isWiki := os.Getenv(models.EnvRepoIsWiki) == "true"
170170
username := os.Getenv(models.EnvRepoUsername)
171171
reponame := os.Getenv(models.EnvRepoName)
172172
userID, _ := strconv.ParseInt(os.Getenv(models.EnvPusherID), 10, 64)
@@ -322,7 +322,7 @@ Gitea or set your environment appropriately.`, "")
322322

323323
// the environment setted on serv command
324324
repoUser := os.Getenv(models.EnvRepoUsername)
325-
isWiki := (os.Getenv(models.EnvRepoIsWiki) == "true")
325+
isWiki := os.Getenv(models.EnvRepoIsWiki) == "true"
326326
repoName := os.Getenv(models.EnvRepoName)
327327
pusherID, _ := strconv.ParseInt(os.Getenv(models.EnvPusherID), 10, 64)
328328
pusherName := os.Getenv(models.EnvPusherName)

cmd/serv.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import (
1717
"time"
1818

1919
"code.gitea.io/gitea/models"
20-
"code.gitea.io/gitea/modules/lfs"
2120
"code.gitea.io/gitea/modules/log"
2221
"code.gitea.io/gitea/modules/pprof"
2322
"code.gitea.io/gitea/modules/private"
2423
"code.gitea.io/gitea/modules/setting"
24+
"code.gitea.io/gitea/services/lfs"
2525

2626
"github.com/dgrijalva/jwt-go"
2727
jsoniter "github.com/json-iterator/go"

cmd/web_graceful.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ import (
99
"net"
1010
"net/http"
1111
"net/http/fcgi"
12+
"strings"
1213

1314
"code.gitea.io/gitea/modules/graceful"
1415
"code.gitea.io/gitea/modules/log"
16+
"code.gitea.io/gitea/modules/setting"
1517
)
1618

1719
func runHTTP(network, listenAddr, name string, m http.Handler) error {
@@ -48,7 +50,12 @@ func runFCGI(network, listenAddr, name string, m http.Handler) error {
4850
fcgiServer := graceful.NewServer(network, listenAddr, name)
4951

5052
err := fcgiServer.ListenAndServe(func(listener net.Listener) error {
51-
return fcgi.Serve(listener, m)
53+
return fcgi.Serve(listener, http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
54+
if setting.AppSubURL != "" {
55+
req.URL.Path = strings.TrimPrefix(req.URL.Path, setting.AppSubURL)
56+
}
57+
m.ServeHTTP(resp, req)
58+
}))
5259
})
5360
if err != nil {
5461
log.Fatal("Failed to start FCGI main server: %v", err)

0 commit comments

Comments
 (0)