Skip to content

Commit 6a81a97

Browse files
committed
Merge remote-tracking branch 'upstream/master' into feature/choose_pullreq_target
2 parents 1dcf6b6 + 484e3dc commit 6a81a97

File tree

133 files changed

+3849
-1590
lines changed

Some content is hidden

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

133 files changed

+3849
-1590
lines changed

.drone.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ steps:
8989
commands:
9090
- curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs
9191
- make clean
92-
- make generate
9392
- make golangci-lint
9493
- make revive
9594
- make swagger-check
@@ -389,12 +388,18 @@ steps:
389388
commands:
390389
- git fetch --tags --force
391390

391+
- name: build
392+
pull: always
393+
image: node:10 # this step is kept at the lowest version of node that we support
394+
commands:
395+
- make css
396+
- make js
397+
392398
- name: static
393399
pull: always
394400
image: techknowlogick/xgo:latest
395401
commands:
396402
- export PATH=$PATH:$GOPATH/bin
397-
- make generate
398403
- make release
399404
environment:
400405
GOPROXY: off
@@ -491,12 +496,18 @@ steps:
491496
commands:
492497
- git fetch --tags --force
493498

499+
- name: build
500+
pull: always
501+
image: node:10 # this step is kept at the lowest version of node that we support
502+
commands:
503+
- make css
504+
- make js
505+
494506
- name: static
495507
pull: always
496508
image: techknowlogick/xgo:latest
497509
commands:
498510
- export PATH=$PATH:$GOPATH/bin
499-
- make generate
500511
- make release
501512
environment:
502513
GOPROXY: off
@@ -650,8 +661,6 @@ steps:
650661
exclude:
651662
- pull_request
652663

653-
654-
655664
---
656665
kind: pipeline
657666
name: docker-linux-arm64
@@ -757,6 +766,9 @@ workspace:
757766
base: /go
758767
path: src/code.gitea.io/gitea
759768

769+
clone:
770+
disable: true
771+
760772
when:
761773
status:
762774
- success

CONTRIBUTING.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,12 @@ they served:
278278
* 2019-01-01 ~ 2019-12-31
279279
* [Lunny Xiao](https://github.com/lunny) <[email protected]>
280280
* [Lauris Bukšis-Haberkorns](https://github.com/lafriks) <[email protected]>
281-
* [Matti Ranta](https://github.com/techknowlogick) <[email protected]>
281+
* [Matti Ranta](https://github.com/techknowlogick) <[email protected]>
282+
283+
* 2020-01-01 ~ 2020-12-31
284+
* [Lunny Xiao](https://gitea.com/lunny) <[email protected]>
285+
* [Lauris Bukšis-Haberkorns](https://gitea.com/lafriks) <[email protected]>
286+
* [Matti Ranta](https://gitea.com/techknowlogick) <[email protected]>
282287

283288
## Versions
284289

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Lauris Bukšis-Haberkorns <[email protected]> (@lafriks)
1919
Jonas Östanbäck <[email protected]> (@cez81)
2020
David Schneiderbauer <[email protected]> (@daviian)
2121
Peter Žeby <[email protected]> (@morlinest)
22-
Matti Ranta <[email protected]> (@techknowlogick)
22+
Matti Ranta <[email protected]> (@techknowlogick)
2323
Jonas Franz <[email protected]> (@jonasfranz)
2424
Alexey Terentyev <[email protected]> (@axifive)
2525
Lanre Adelowo <[email protected]> (@adelowo)

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ $(EXECUTABLE): $(GO_SOURCES)
397397
GO111MODULE=on $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
398398

399399
.PHONY: release
400-
release: release-dirs release-windows release-linux release-darwin release-copy release-compress release-check
400+
release: generate release-dirs release-windows release-linux release-darwin release-copy release-compress release-check
401401

402402
.PHONY: release-dirs
403403
release-dirs:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This project has been
3131

3232
From the root of the source tree, run:
3333

34-
TAGS="bindata" make generate all
34+
TAGS="bindata" make build
3535

3636
More info: https://docs.gitea.io/en-us/install-from-source/
3737

cmd/web.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ func runWeb(ctx *cli.Context) error {
122122
switch setting.Protocol {
123123
case setting.UnixSocket:
124124
case setting.FCGI:
125+
case setting.FCGIUnix:
125126
default:
126127
// Save LOCAL_ROOT_URL if port changed
127128
cfg := ini.Empty()
@@ -149,7 +150,7 @@ func runWeb(ctx *cli.Context) error {
149150
}
150151

151152
listenAddr := setting.HTTPAddr
152-
if setting.Protocol != setting.UnixSocket {
153+
if setting.Protocol != setting.UnixSocket && setting.Protocol != setting.FCGIUnix {
153154
listenAddr += ":" + setting.HTTPPort
154155
}
155156
log.Info("Listen: %v://%s%s", setting.Protocol, listenAddr, setting.AppSubURL)
@@ -183,10 +184,13 @@ func runWeb(ctx *cli.Context) error {
183184
err = runHTTPS("tcp", listenAddr, setting.CertFile, setting.KeyFile, context2.ClearHandler(m))
184185
case setting.FCGI:
185186
NoHTTPRedirector()
186-
err = runFCGI(listenAddr, context2.ClearHandler(m))
187+
err = runFCGI("tcp", listenAddr, context2.ClearHandler(m))
187188
case setting.UnixSocket:
188189
NoHTTPRedirector()
189190
err = runHTTP("unix", listenAddr, context2.ClearHandler(m))
191+
case setting.FCGIUnix:
192+
NoHTTPRedirector()
193+
err = runFCGI("unix", listenAddr, context2.ClearHandler(m))
190194
default:
191195
log.Fatal("Invalid protocol: %s", setting.Protocol)
192196
}

cmd/web_graceful.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ func NoMainListener() {
3737
graceful.Manager.InformCleanup()
3838
}
3939

40-
func runFCGI(listenAddr string, m http.Handler) error {
40+
func runFCGI(network, listenAddr string, m http.Handler) error {
4141
// This needs to handle stdin as fcgi point
42-
fcgiServer := graceful.NewServer("tcp", listenAddr)
42+
fcgiServer := graceful.NewServer(network, listenAddr)
4343

4444
err := fcgiServer.ListenAndServe(func(listener net.Listener) error {
4545
return fcgi.Serve(listener, m)

custom/conf/app.ini.sample

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ DEFAULT_ALLOW_ONLY_CONTRIBUTORS_TO_TRACK_TIME = true
504504
; Default value for the domain part of the user's email address in the git log
505505
; if he has set KeepEmailPrivate to true. The user's email will be replaced with a
506506
; concatenation of the user name in lower case, "@" and NO_REPLY_ADDRESS.
507-
NO_REPLY_ADDRESS = noreply.example.org
507+
NO_REPLY_ADDRESS = noreply.%(DOMAIN)s
508508
; Show Registration button
509509
SHOW_REGISTRATION_BUTTON = true
510510
; Default value for AutoWatchNewRepos
@@ -877,6 +877,12 @@ SHOW_FOOTER_VERSION = true
877877
; Show template execution time in the footer
878878
SHOW_FOOTER_TEMPLATE_LOAD_TIME = true
879879

880+
[markup.sanitizer]
881+
; The following keys can be used multiple times to define sanitation policy rules.
882+
;ELEMENT = span
883+
;ALLOW_ATTR = class
884+
;REGEXP = ^(info|warning|error)$
885+
880886
[markup.asciidoc]
881887
ENABLED = false
882888
; List of file extensions that should be rendered by an external command

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

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
140140

141141
## Server (`server`)
142142

143-
- `PROTOCOL`: **http**: \[http, https, fcgi, unix\]
143+
- `PROTOCOL`: **http**: \[http, https, fcgi, unix, fcgi+unix\]
144144
- `DOMAIN`: **localhost**: Domain name of this server.
145145
- `ROOT_URL`: **%(PROTOCOL)s://%(DOMAIN)s:%(HTTP\_PORT)s/**:
146146
Overwrite the automatically generated public URL.
@@ -155,7 +155,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
155155
- `HTTP_ADDR`: **0.0.0.0**: HTTP listen address.
156156
- If `PROTOCOL` is set to `fcgi`, Gitea will listen for FastCGI requests on TCP socket
157157
defined by `HTTP_ADDR` and `HTTP_PORT` configuration settings.
158-
- If `PROTOCOL` is set to `unix`, this should be the name of the Unix socket file to use.
158+
- If `PROTOCOL` is set to `unix` or `fcgi+unix`, this should be the name of the Unix socket file to use.
159159
- `HTTP_PORT`: **3000**: HTTP listen port.
160160
- If `PROTOCOL` is set to `fcgi`, Gitea will listen for FastCGI requests on TCP socket
161161
defined by `HTTP_ADDR` and `HTTP_PORT` configuration settings.
@@ -312,6 +312,8 @@ relation to port exhaustion.
312312
- `DEFAULT_ORG_VISIBILITY`: **public**: Set default visibility mode for organisations, either "public", "limited" or "private".
313313
- `DEFAULT_ORG_MEMBER_VISIBLE`: **false** True will make the membership of the users visible when added to the organisation.
314314
- `ALLOW_ONLY_EXTERNAL_REGISTRATION`: **false** Set to true to force registration only using third-party services.
315+
- `NO_REPLY_ADDRESS`: **DOMAIN** Default value for the domain part of the user's email address in the git log if he has set KeepEmailPrivate to true.
316+
The user's email will be replaced with a concatenation of the user name in lower case, "@" and NO_REPLY_ADDRESS.
315317

316318
## Webhook (`webhook`)
317319

@@ -578,6 +580,24 @@ Two special environment variables are passed to the render command:
578580
- `GITEA_PREFIX_SRC`, which contains the current URL prefix in the `src` path tree. To be used as prefix for links.
579581
- `GITEA_PREFIX_RAW`, which contains the current URL prefix in the `raw` path tree. To be used as prefix for image paths.
580582

583+
584+
Gitea supports customizing the sanitization policy for rendered HTML. The example below will support KaTeX output from pandoc.
585+
586+
```ini
587+
[markup.sanitizer]
588+
; Pandoc renders TeX segments as <span>s with the "math" class, optionally
589+
; with "inline" or "display" classes depending on context.
590+
ELEMENT = span
591+
ALLOW_ATTR = class
592+
REGEXP = ^\s*((math(\s+|$)|inline(\s+|$)|display(\s+|$)))+
593+
```
594+
595+
- `ELEMENT`: The element this policy applies to. Must be non-empty.
596+
- `ALLOW_ATTR`: The attribute this policy allows. Must be non-empty.
597+
- `REGEXP`: A regex to match the contents of the attribute against. Must be present but may be empty for unconditional whitelisting of this attribute.
598+
599+
You may redefine `ELEMENT`, `ALLOW_ATTR`, and `REGEXP` multiple times; each time all three are defined is a single policy entry.
600+
581601
## Time (`time`)
582602

583603
- `FORMAT`: Time format to diplay on UI. i.e. RFC1123 or 2006-01-02 15:04:05

docs/content/doc/advanced/external-renderers.en-us.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,22 @@ RENDER_COMMAND = rst2html.py
6868
IS_INPUT_FILE = false
6969
```
7070

71+
If your external markup relies on additional classes and attributes on the generated HTML elements, you might need to enable custom sanitizer policies. Gitea uses the [`bluemonday`](https://godoc.org/github.com/microcosm-cc/bluemonday) package as our HTML sanitizier. The example below will support [KaTeX](https://katex.org/) output from [`pandoc`](https://pandoc.org/).
72+
73+
```ini
74+
[markup.sanitizer]
75+
; Pandoc renders TeX segments as <span>s with the "math" class, optionally
76+
; with "inline" or "display" classes depending on context.
77+
ELEMENT = span
78+
ALLOW_ATTR = class
79+
REGEXP = ^\s*((math(\s+|$)|inline(\s+|$)|display(\s+|$)))+
80+
81+
[markup.markdown]
82+
ENABLED = true
83+
FILE_EXTENSIONS = .md,.markdown
84+
RENDER_COMMAND = pandoc -f markdown -t html --katex
85+
```
86+
87+
You may redefine `ELEMENT`, `ALLOW_ATTR`, and `REGEXP` multiple times; each time all three are defined is a single policy entry. All three must be defined, but `REGEXP` may be blank to allow unconditional whitelisting of that attribute.
88+
7189
Once your configuration changes have been made, restart Gitea to have changes take effect.

0 commit comments

Comments
 (0)