Skip to content

Commit 994c094

Browse files
Merge branch 'main' into disable-basic-authentication-2
2 parents b272dc8 + 9f19c2b commit 994c094

File tree

97 files changed

+2882
-1311
lines changed

Some content is hidden

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

97 files changed

+2882
-1311
lines changed

.drone.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ trigger:
1515
steps:
1616
- name: deps-frontend
1717
pull: always
18-
image: node:14
18+
image: node:16
1919
commands:
2020
- make node_modules
2121

2222
- name: lint-frontend
23-
image: node:14
23+
image: node:16
2424
commands:
2525
- make lint-frontend
2626
depends_on: [deps-frontend]
@@ -58,7 +58,7 @@ steps:
5858
TAGS: bindata gogit sqlite sqlite_unlock_notify
5959

6060
- name: checks-frontend
61-
image: node:14
61+
image: node:16
6262
commands:
6363
- make checks-frontend
6464
depends_on: [deps-frontend]
@@ -71,13 +71,13 @@ steps:
7171
depends_on: [lint-backend]
7272

7373
- name: test-frontend
74-
image: node:14
74+
image: node:16
7575
commands:
7676
- make test-frontend
7777
depends_on: [lint-frontend]
7878

7979
- name: build-frontend
80-
image: node:14
80+
image: node:16
8181
commands:
8282
- make frontend
8383
depends_on: [test-frontend]
@@ -530,7 +530,7 @@ steps:
530530
image: plugins/s3:1
531531
settings:
532532
acl: public-read
533-
bucket: releases
533+
bucket: gitea-artifacts
534534
endpoint: https://storage.gitea.io
535535
path_style: true
536536
source: "dist/release/*"
@@ -551,7 +551,7 @@ steps:
551551
image: plugins/s3:1
552552
settings:
553553
acl: public-read
554-
bucket: releases
554+
bucket: gitea-artifacts
555555
endpoint: https://storage.gitea.io
556556
path_style: true
557557
source: "dist/release/*"
@@ -626,7 +626,7 @@ steps:
626626
image: plugins/s3:1
627627
settings:
628628
acl: public-read
629-
bucket: releases
629+
bucket: gitea-artifacts
630630
endpoint: https://storage.gitea.io
631631
path_style: true
632632
source: "dist/release/*"

.eslintrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ rules:
366366
unicorn/no-array-instanceof: [0]
367367
unicorn/no-array-push-push: [2]
368368
unicorn/no-console-spaces: [0]
369+
unicorn/no-document-cookie: [2]
369370
unicorn/no-fn-reference-in-iterator: [0]
370371
unicorn/no-for-loop: [0]
371372
unicorn/no-hex-escape: [0]
@@ -389,6 +390,7 @@ rules:
389390
unicorn/numeric-separators-style: [0]
390391
unicorn/prefer-add-event-listener: [2]
391392
unicorn/prefer-array-find: [2]
393+
unicorn/prefer-array-flat-map: [2]
392394
unicorn/prefer-array-flat: [2]
393395
unicorn/prefer-array-index-of: [2]
394396
unicorn/prefer-array-some: [2]
@@ -399,8 +401,10 @@ rules:
399401
unicorn/prefer-includes: [2]
400402
unicorn/prefer-math-trunc: [2]
401403
unicorn/prefer-modern-dom-apis: [0]
404+
unicorn/prefer-module: [2]
402405
unicorn/prefer-negative-index: [2]
403406
unicorn/prefer-node-append: [0]
407+
unicorn/prefer-node-protocol: [0]
404408
unicorn/prefer-node-remove: [0]
405409
unicorn/prefer-number-properties: [0]
406410
unicorn/prefer-optional-catch-binding: [2]

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ cpu.out
7676
/integrations/mssql.ini
7777
/node_modules
7878
/yarn.lock
79+
/yarn-error.log
80+
/npm-debug.log*
7981
/public/js
8082
/public/serviceworker.js
8183
/public/css

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ test-backend:
359359
@$(GO) test $(GOTESTFLAGS) -mod=vendor -tags='$(TEST_TAGS)' $(GO_PACKAGES)
360360

361361
.PHONY: test-frontend
362-
test-frontend:
362+
test-frontend: node_modules
363363
@NODE_OPTIONS="--experimental-vm-modules --no-warnings" npx jest --color
364364

365365
.PHONY: test-check

cmd/web.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func setPort(port string) error {
175175

176176
cfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)
177177
if err := cfg.SaveTo(setting.CustomConf); err != nil {
178-
return fmt.Errorf("Error saving generated JWT Secret to custom config: %v", err)
178+
return fmt.Errorf("Error saving generated LOCAL_ROOT_URL to custom config: %v", err)
179179
}
180180
}
181181
return nil

cmd/web_letsencrypt.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package cmd
66

77
import (
88
"net/http"
9+
"strconv"
910
"strings"
1011

1112
"code.gitea.io/gitea/modules/log"
@@ -22,6 +23,15 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
2223
// TODO: these are placeholders until we add options for each in settings with appropriate warning
2324
enableHTTPChallenge := true
2425
enableTLSALPNChallenge := true
26+
altHTTPPort := 0
27+
altTLSALPNPort := 0
28+
29+
if p, err := strconv.Atoi(setting.PortToRedirect); err == nil {
30+
altHTTPPort = p
31+
}
32+
if p, err := strconv.Atoi(setting.HTTPPort); err == nil {
33+
altTLSALPNPort = p
34+
}
2535

2636
magic := certmagic.NewDefault()
2737
magic.Storage = &certmagic.FileStorage{Path: directory}
@@ -30,6 +40,9 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
3040
Agreed: setting.LetsEncryptTOS,
3141
DisableHTTPChallenge: !enableHTTPChallenge,
3242
DisableTLSALPNChallenge: !enableTLSALPNChallenge,
43+
ListenHost: setting.HTTPAddr,
44+
AltTLSALPNPort: altTLSALPNPort,
45+
AltHTTPPort: altHTTPPort,
3346
})
3447

3548
magic.Issuers = []certmagic.Issuer{myACME}

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ func runEnvironmentToIni(c *cli.Context) error {
110110
}
111111
cfg.NameMapper = ini.SnackCase
112112

113+
changed := false
114+
113115
prefix := c.String("prefix") + "__"
114116

115117
for _, kv := range os.Environ() {
@@ -143,15 +145,21 @@ func runEnvironmentToIni(c *cli.Context) error {
143145
continue
144146
}
145147
}
148+
oldValue := key.Value()
149+
if !changed && oldValue != value {
150+
changed = true
151+
}
146152
key.SetValue(value)
147153
}
148154
destination := c.String("out")
149155
if len(destination) == 0 {
150156
destination = setting.CustomConf
151157
}
152-
err = cfg.SaveTo(destination)
153-
if err != nil {
154-
return err
158+
if destination != setting.CustomConf || changed {
159+
err = cfg.SaveTo(destination)
160+
if err != nil {
161+
return err
162+
}
155163
}
156164
if c.Bool("clear") {
157165
for _, kv := range os.Environ() {

docker/root/etc/s6/openssh/setup

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,29 @@ if [ ! -f /data/ssh/ssh_host_ecdsa_key ]; then
2424
ssh-keygen -t ecdsa -b 256 -f /data/ssh/ssh_host_ecdsa_key -N "" > /dev/null
2525
fi
2626

27+
if [ -e /data/ssh/ssh_host_ed25519_cert ]; then
28+
SSH_ED25519_CERT=${SSH_ED25519_CERT:-"/data/ssh/ssh_host_ed25519_cert"}
29+
fi
30+
31+
if [ -e /data/ssh/ssh_host_rsa_cert ]; then
32+
SSH_RSA_CERT=${SSH_RSA_CERT:-"/data/ssh/ssh_host_rsa_cert"}
33+
fi
34+
35+
if [ -e /data/ssh/ssh_host_ecdsa_cert ]; then
36+
SSH_ECDSA_CERT=${SSH_ECDSA_CERT:-"/data/ssh/ssh_host_ecdsa_cert"}
37+
fi
38+
39+
if [ -e /data/ssh/ssh_host_dsa_cert ]; then
40+
SSH_DSA_CERT=${SSH_DSA_CERT:-"/data/ssh/ssh_host_dsa_cert"}
41+
fi
42+
2743
if [ -d /etc/ssh ]; then
2844
SSH_PORT=${SSH_PORT:-"22"} \
2945
SSH_LISTEN_PORT=${SSH_LISTEN_PORT:-"${SSH_PORT}"} \
46+
SSH_ED25519_CERT="${SSH_ED25519_CERT:+"HostCertificate "}${SSH_ED25519_CERT}" \
47+
SSH_RSA_CERT="${SSH_RSA_CERT:+"HostCertificate "}${SSH_RSA_CERT}" \
48+
SSH_ECDSA_CERT="${SSH_ECDSA_CERT:+"HostCertificate "}${SSH_ECDSA_CERT}" \
49+
SSH_DSA_CERT="${SSH_DSA_CERT:+"HostCertificate "}${SSH_DSA_CERT}" \
3050
envsubst < /etc/templates/sshd_config > /etc/ssh/sshd_config
3151

3252
chmod 0644 /etc/ssh/sshd_config

docker/root/etc/templates/sshd_config

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ ListenAddress ::
88
LogLevel INFO
99

1010
HostKey /data/ssh/ssh_host_ed25519_key
11-
HostCertificate /data/ssh/ssh_host_ed25519_cert
11+
${SSH_ED25519_CERT}
1212
HostKey /data/ssh/ssh_host_rsa_key
13-
HostCertificate /data/ssh/ssh_host_rsa_cert
13+
${SSH_RSA_CERT}
1414
HostKey /data/ssh/ssh_host_ecdsa_key
15-
HostCertificate /data/ssh/ssh_host_ecdsa_cert
15+
${SSH_ECDSA_CERT}
1616
HostKey /data/ssh/ssh_host_dsa_key
17-
HostCertificate /data/ssh/ssh_host_dsa_cert
17+
${SSH_DSA_CERT}
1818

1919
AuthorizedKeysFile .ssh/authorized_keys
2020
AuthorizedPrincipalsFile .ssh/authorized_principals

docs/content/doc/advanced/logging-documentation.en-us.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,8 @@ Gitea includes built-in log rotation, which should be enough for most deployment
437437

438438
- Disable built-in log rotation by setting `LOG_ROTATE` to `false` in your `app.ini`.
439439
- Install `logrotate`.
440-
- Configure `logrotate` to match your deployment requirements, see `man 8 logrotate` for configuration syntax details. In the `postrotate/endscript` block send Gitea a `USR1` signal via `kill -USR1` or `kill -10`, or run `gitea manager logging release-and-reopen` (with the appropriate environment). Ensure that your configurations apply to all files emitted by Gitea loggers as described in the above sections.
441-
- Always do `logrotate /etc/logrotate.conf --debug` to test your configurations.
440+
- Configure `logrotate` to match your deployment requirements, see `man 8 logrotate` for configuration syntax details. In the `postrotate/endscript` block send Gitea a `USR1` signal via `kill -USR1` or `kill -10` to the `gitea` process itself, or run `gitea manager logging release-and-reopen` (with the appropriate environment). Ensure that your configurations apply to all files emitted by Gitea loggers as described in the above sections.
441+
- Always do `logrotate /etc/logrotate.conf --debug` to test your configurations.
442+
- If you are using docker and are running from outside of the container you can use `docker exec -u $OS_USER $CONTAINER_NAME sh -c 'gitea manager logging release-and-reopen'` or `docker exec $CONTAINER_NAME sh -c '/bin/s6-svc -1 /etc/s6/gitea/'` or send `USR1` directly to the gitea process itself.
442443

443444
The next `logrotate` jobs will include your configurations, so no restart is needed. You can also immediately reload `logrotate` with `logrotate /etc/logrotate.conf --force`.

docs/content/doc/usage/reverse-proxies.en-us.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,24 @@ If you wish to run Gitea with IIS. You will need to setup IIS with URL Rewrite a
222222
<?xml version="1.0" encoding="UTF-8"?>
223223
<configuration>
224224
<system.webServer>
225+
<security>
226+
<requestFiltering>
227+
<hiddenSegments>
228+
<clear />
229+
</hiddenSegments>
230+
<denyUrlSequences>
231+
<clear />
232+
</denyUrlSequences>
233+
<fileExtensions allowUnlisted="true">
234+
<clear />
235+
</fileExtensions>
236+
</requestFiltering>
237+
</security>
225238
<rewrite>
226-
<rules>
239+
<rules useOriginalURLEncoding="false">
227240
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
228241
<match url="(.*)" />
229-
<action type="Rewrite" url="http://127.0.0.1:3000/{R:1}" />
242+
<action type="Rewrite" url="http://127.0.0.1:3000{UNENCODED_URL}" />
230243
<serverVariables>
231244
<set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="HTTP_ACCEPT_ENCODING" />
232245
<set name="HTTP_ACCEPT_ENCODING" value="" />
@@ -255,6 +268,16 @@ If you wish to run Gitea with IIS. You will need to setup IIS with URL Rewrite a
255268
</outboundRules>
256269
</rewrite>
257270
<urlCompression doDynamicCompression="true" />
271+
<handlers>
272+
<clear />
273+
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
274+
</handlers>
275+
<!-- Map all extensions to the same MIME type, so all files can be
276+
downloaded. -->
277+
<staticContent>
278+
<clear />
279+
<mimeMap fileExtension="*" mimeType="application/octet-stream" />
280+
</staticContent>
258281
</system.webServer>
259282
</configuration>
260283
```

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ require (
105105
github.com/unknwon/com v1.0.1
106106
github.com/unknwon/i18n v0.0.0-20210321134014-0ebbf2df1c44
107107
github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae
108-
github.com/unrolled/render v1.1.0
108+
github.com/unrolled/render v1.1.1
109109
github.com/urfave/cli v1.22.5
110110
github.com/willf/bitset v1.1.11 // indirect
111111
github.com/xanzy/go-gitlab v0.48.0
@@ -131,7 +131,7 @@ require (
131131
mvdan.cc/xurls/v2 v2.2.0
132132
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
133133
xorm.io/builder v0.3.9
134-
xorm.io/xorm v1.0.7
134+
xorm.io/xorm v1.1.0
135135
)
136136

137137
replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1

0 commit comments

Comments
 (0)