Skip to content

Commit e449b53

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix-15894-run-settings-for-install-page
2 parents 7866341 + 5d113bd commit e449b53

File tree

986 files changed

+40648
-36413
lines changed

Some content is hidden

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

986 files changed

+40648
-36413
lines changed

.golangci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ issues:
7070
- path: modules/log/
7171
linters:
7272
- errcheck
73-
- path: routers/routes/web.go
74-
linters:
75-
- dupl
7673
- path: routers/api/v1/repo/issue_subscription.go
7774
linters:
7875
- dupl
@@ -114,3 +111,4 @@ issues:
114111
linters:
115112
- staticcheck
116113
text: "svc.IsAnInteractiveSession is deprecated: Use IsWindowsService instead."
114+

cmd/web.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"code.gitea.io/gitea/modules/log"
1818
"code.gitea.io/gitea/modules/setting"
1919
"code.gitea.io/gitea/routers"
20-
"code.gitea.io/gitea/routers/routes"
20+
"code.gitea.io/gitea/routers/install"
2121

2222
context2 "github.com/gorilla/context"
2323
"github.com/urfave/cli"
@@ -88,7 +88,7 @@ func runWeb(ctx *cli.Context) error {
8888
}
8989

9090
// Perform pre-initialization
91-
needsInstall := routers.PreInstallInit(graceful.GetManager().HammerContext())
91+
needsInstall := install.PreloadSettings(graceful.GetManager().HammerContext())
9292
if needsInstall {
9393
// Flag for port number in case first time run conflict
9494
if ctx.IsSet("port") {
@@ -101,7 +101,7 @@ func runWeb(ctx *cli.Context) error {
101101
return err
102102
}
103103
}
104-
c := routes.InstallRoutes()
104+
c := install.Routes()
105105
err := listen(c, false)
106106
select {
107107
case <-graceful.GetManager().IsShutdown():
@@ -134,7 +134,7 @@ func runWeb(ctx *cli.Context) error {
134134
}
135135

136136
// Set up Chi routes
137-
c := routes.NormalRoutes()
137+
c := routers.NormalRoutes()
138138
err := listen(c, true)
139139
<-graceful.GetManager().Done()
140140
log.Info("PID: %d Gitea Web Finished", os.Getpid())

contrib/pr/checkout.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
"code.gitea.io/gitea/modules/setting"
3232
"code.gitea.io/gitea/modules/util"
3333
"code.gitea.io/gitea/routers"
34-
"code.gitea.io/gitea/routers/routes"
3534

3635
"github.com/go-git/go-git/v5"
3736
"github.com/go-git/go-git/v5/config"
@@ -116,7 +115,7 @@ func runPR() {
116115
//routers.GlobalInit()
117116
external.RegisterRenderers()
118117
markup.Init()
119-
c := routes.NormalRoutes()
118+
c := routers.NormalRoutes()
120119

121120
log.Printf("[PR] Ready for testing !\n")
122121
log.Printf("[PR] Login with user1, user2, user3, ... with pass: password\n")

custom/conf/app.example.ini

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ RUN_MODE = ; prod
5151
;REDIRECT_OTHER_PORT = false
5252
;PORT_TO_REDIRECT = 80
5353
;;
54+
;; Timeout for any write to the connection. (Set to 0 to disable all timeouts.)
55+
;PER_WRITE_TIMEOUT = 30s
56+
;;
57+
;; Timeout per Kb written to connections.
58+
;PER_WRITE_PER_KB_TIMEOUT = 30s
59+
;;
5460
;; Permission for unix socket
5561
;UNIX_SOCKET_PERMISSION = 666
5662
;;
@@ -144,6 +150,14 @@ RUN_MODE = ; prod
144150
;; Enable exposure of SSH clone URL to anonymous visitors, default is false
145151
;SSH_EXPOSE_ANONYMOUS = false
146152
;;
153+
;; Timeout for any write to ssh connections. (Set to 0 to disable all timeouts.)
154+
;; Will default to the PER_WRITE_TIMEOUT.
155+
;SSH_PER_WRITE_TIMEOUT = 30s
156+
;;
157+
;; Timeout per Kb written to ssh connections.
158+
;; Will default to the PER_WRITE_PER_KB_TIMEOUT.
159+
;SSH_PER_WRITE_PER_KB_TIMEOUT = 30s
160+
;;
147161
;; Indicate whether to check minimum key size with corresponding type
148162
;MINIMUM_KEY_SIZE_CHECK = false
149163
;;
@@ -1145,8 +1159,8 @@ PATH =
11451159
;;
11461160
;; When ISSUE_INDEXER_QUEUE_TYPE is levelqueue, this will be the path where the queue will be saved.
11471161
;; This can be overridden by `ISSUE_INDEXER_QUEUE_CONN_STR`.
1148-
;; default is queues/common
1149-
;ISSUE_INDEXER_QUEUE_DIR = queues/common
1162+
;; default is queues/common
1163+
;ISSUE_INDEXER_QUEUE_DIR = queues/common
11501164
;;
11511165
;; When `ISSUE_INDEXER_QUEUE_TYPE` is `redis`, this will store the redis connection string.
11521166
;; When `ISSUE_INDEXER_QUEUE_TYPE` is `levelqueue`, this is a directory or additional options of
@@ -1201,7 +1215,7 @@ PATH =
12011215
;; default to persistable-channel
12021216
;TYPE = persistable-channel
12031217
;;
1204-
;; data-dir for storing persistable queues and level queues, individual queues will default to `queues/common` meaning the queue is shared.
1218+
;; data-dir for storing persistable queues and level queues, individual queues will default to `queues/common` meaning the queue is shared.
12051219
;DATADIR = queues/
12061220
;;
12071221
;; Default queue length before a channel queue will block

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ The following configuration set `Content-Type: application/vnd.android.package-a
251251
most cases you do not need to change the default value. Alter it only if
252252
your SSH server node is not the same as HTTP node. Do not set this variable
253253
if `PROTOCOL` is set to `unix`.
254+
- `PER_WRITE_TIMEOUT`: **30s**: Timeout for any write to the connection. (Set to 0 to
255+
disable all timeouts.)
256+
- `PER_WRITE_PER_KB_TIMEOUT`: **10s**: Timeout per Kb written to connections.
254257

255258
- `DISABLE_SSH`: **false**: Disable SSH feature when it's not available.
256259
- `START_SSH_SERVER`: **false**: When enabled, use the built-in SSH server.
@@ -274,6 +277,9 @@ The following configuration set `Content-Type: application/vnd.android.package-a
274277
- `SSH_KEY_TEST_PATH`: **/tmp**: Directory to create temporary files in when testing public keys using ssh-keygen, default is the system temporary directory.
275278
- `SSH_KEYGEN_PATH`: **ssh-keygen**: Path to ssh-keygen, default is 'ssh-keygen' which means the shell is responsible for finding out which one to call.
276279
- `SSH_EXPOSE_ANONYMOUS`: **false**: Enable exposure of SSH clone URL to anonymous visitors, default is false.
280+
- `SSH_PER_WRITE_TIMEOUT`: **30s**: Timeout for any write to the SSH connections. (Set to
281+
0 to disable all timeouts.)
282+
- `SSH_PER_WRITE_PER_KB_TIMEOUT`: **10s**: Timeout per Kb written to SSH connections.
277283
- `MINIMUM_KEY_SIZE_CHECK`: **true**: Indicate whether to check minimum key size with corresponding type.
278284

279285
- `OFFLINE_MODE`: **false**: Disables use of CDN for static files and Gravatar for profile pictures.
@@ -350,7 +356,7 @@ relation to port exhaustion.
350356
- `ISSUE_INDEXER_PATH`: **indexers/issues.bleve**: Index file used for issue search; available when ISSUE_INDEXER_TYPE is bleve and elasticsearch.
351357
- The next 4 configuration values are deprecated and should be set in `queue.issue_indexer` however are kept for backwards compatibility:
352358
- `ISSUE_INDEXER_QUEUE_TYPE`: **levelqueue**: Issue indexer queue, currently supports:`channel`, `levelqueue`, `redis`.
353-
- `ISSUE_INDEXER_QUEUE_DIR`: **queues/common**: When `ISSUE_INDEXER_QUEUE_TYPE` is `levelqueue`, this will be the path where the queue will be saved. (Previously this was `indexers/issues.queue`.)
359+
- `ISSUE_INDEXER_QUEUE_DIR`: **queues/common**: When `ISSUE_INDEXER_QUEUE_TYPE` is `levelqueue`, this will be the path where the queue will be saved. (Previously this was `indexers/issues.queue`.)
354360
- `ISSUE_INDEXER_QUEUE_CONN_STR`: **addrs=127.0.0.1:6379 db=0**: When `ISSUE_INDEXER_QUEUE_TYPE` is `redis`, this will store the redis connection string. When `ISSUE_INDEXER_QUEUE_TYPE` is `levelqueue`, this is a directory or additional options of the form `leveldb://path/to/db?option=value&....`, and overrides `ISSUE_INDEXER_QUEUE_DIR`.
355361
- `ISSUE_INDEXER_QUEUE_BATCH_NUMBER`: **20**: Batch queue number.
356362

@@ -370,7 +376,7 @@ relation to port exhaustion.
370376
## Queue (`queue` and `queue.*`)
371377

372378
- `TYPE`: **persistable-channel**: General queue type, currently support: `persistable-channel` (uses a LevelDB internally), `channel`, `level`, `redis`, `dummy`
373-
- `DATADIR`: **queues/**: Base DataDir for storing persistent and level queues. `DATADIR` for individual queues can be set in `queue.name` sections but will default to `DATADIR/`**`common`**. (Previously each queue would default to `DATADIR/`**`name`**.)
379+
- `DATADIR`: **queues/**: Base DataDir for storing persistent and level queues. `DATADIR` for individual queues can be set in `queue.name` sections but will default to `DATADIR/`**`common`**. (Previously each queue would default to `DATADIR/`**`name`**.)
374380
- `LENGTH`: **20**: Maximal queue size before channel queues block
375381
- `BATCH_LENGTH`: **20**: Batch data before passing to the handler
376382
- `CONN_STR`: **redis://127.0.0.1:6379/0**: Connection string for the redis queue type. Options can be set using query params. Similarly LevelDB options can also be set using: **leveldb://relative/path?option=value** or **leveldb:///absolute/path?option=value**, and will override `DATADIR`

go.mod

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,25 @@ require (
1111
gitea.com/go-chi/captcha v0.0.0-20210110083842-e7696c336a1e
1212
gitea.com/go-chi/session v0.0.0-20210108030337-0cb48c5ba8ee
1313
gitea.com/lunny/levelqueue v0.3.0
14-
github.com/Microsoft/go-winio v0.4.18 // indirect
14+
github.com/Microsoft/go-winio v0.5.0 // indirect
1515
github.com/NYTimes/gziphandler v1.1.1
16-
github.com/PuerkitoBio/goquery v1.5.1
17-
github.com/RoaringBitmap/roaring v0.6.0 // indirect
18-
github.com/alecthomas/chroma v0.8.2
19-
github.com/andybalholm/brotli v1.0.1 // indirect
16+
github.com/ProtonMail/go-crypto v0.0.0-20210512092938-c05353c2d58c // indirect
17+
github.com/PuerkitoBio/goquery v1.6.1
18+
github.com/RoaringBitmap/roaring v0.7.3 // indirect
19+
github.com/alecthomas/chroma v0.9.1
20+
github.com/andybalholm/brotli v1.0.3 // indirect
21+
github.com/andybalholm/cascadia v1.2.0 // indirect
2022
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
21-
github.com/blevesearch/bleve/v2 v2.0.3
23+
github.com/blevesearch/bleve/v2 v2.0.5
2224
github.com/boombuler/barcode v1.0.1 // indirect
2325
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect
24-
github.com/caddyserver/certmagic v0.13.0
26+
github.com/caddyserver/certmagic v0.13.1
2527
github.com/chi-middleware/proxy v1.1.1
2628
github.com/couchbase/go-couchbase v0.0.0-20210224140812-5740cd35f448 // indirect
2729
github.com/couchbase/gomemcached v0.1.2 // indirect
2830
github.com/couchbase/goutils v0.0.0-20210118111533-e33d3ffb5401 // indirect
2931
github.com/denisenkom/go-mssqldb v0.10.0
3032
github.com/dgrijalva/jwt-go v3.2.0+incompatible
31-
github.com/dlclark/regexp2 v1.4.0 // indirect
3233
github.com/dustin/go-humanize v1.0.0
3334
github.com/editorconfig/editorconfig-core-go/v2 v2.4.2
3435
github.com/emirpasic/gods v1.12.0
@@ -37,14 +38,14 @@ require (
3738
github.com/go-asn1-ber/asn1-ber v1.5.3 // indirect
3839
github.com/go-chi/chi v1.5.4
3940
github.com/go-chi/cors v1.2.0
40-
github.com/go-enry/go-enry/v2 v2.6.1
41-
github.com/go-git/go-billy/v5 v5.1.0
42-
github.com/go-git/go-git/v5 v5.3.0
41+
github.com/go-enry/go-enry/v2 v2.7.0
42+
github.com/go-git/go-billy/v5 v5.3.1
43+
github.com/go-git/go-git/v5 v5.4.2
4344
github.com/go-ldap/ldap/v3 v3.3.0
44-
github.com/go-redis/redis/v8 v8.8.2
45+
github.com/go-redis/redis/v8 v8.10.0
4546
github.com/go-sql-driver/mysql v1.6.0
4647
github.com/go-swagger/go-swagger v0.27.0
47-
github.com/go-testfixtures/testfixtures/v3 v3.6.0
48+
github.com/go-testfixtures/testfixtures/v3 v3.6.1
4849
github.com/gobwas/glob v0.2.3
4950
github.com/gogs/chardet v0.0.0-20191104214054-4b6791f73a28
5051
github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14
@@ -56,26 +57,28 @@ require (
5657
github.com/gorilla/mux v1.8.0 // indirect
5758
github.com/gorilla/sessions v1.2.1 // indirect
5859
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
60+
github.com/hashicorp/go-retryablehttp v0.7.0 // indirect
5961
github.com/hashicorp/go-version v1.3.1
6062
github.com/huandu/xstrings v1.3.2
6163
github.com/issue9/identicon v1.2.0
6264
github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7
63-
github.com/json-iterator/go v1.1.10
65+
github.com/json-iterator/go v1.1.11
6466
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
6567
github.com/kevinburke/ssh_config v1.1.0 // indirect
6668
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4
67-
github.com/klauspost/compress v1.12.1
69+
github.com/klauspost/compress v1.13.0
6870
github.com/klauspost/pgzip v1.2.5 // indirect
6971
github.com/lafriks/xormstore v1.4.0
70-
github.com/lib/pq v1.10.1
72+
github.com/lib/pq v1.10.2
73+
github.com/libdns/libdns v0.2.1 // indirect
7174
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96
7275
github.com/markbates/goth v1.67.1
73-
github.com/mattn/go-isatty v0.0.12
74-
github.com/mattn/go-runewidth v0.0.12 // indirect
76+
github.com/mattn/go-isatty v0.0.13
77+
github.com/mattn/go-runewidth v0.0.13 // indirect
7578
github.com/mattn/go-sqlite3 v1.14.7
7679
github.com/mholt/archiver/v3 v3.5.0
77-
github.com/microcosm-cc/bluemonday v1.0.8
78-
github.com/miekg/dns v1.1.40 // indirect
80+
github.com/microcosm-cc/bluemonday v1.0.9
81+
github.com/miekg/dns v1.1.42 // indirect
7982
github.com/minio/md5-simd v1.1.2 // indirect
8083
github.com/minio/minio-go/v7 v7.0.10
8184
github.com/minio/sha256-simd v1.0.0 // indirect
@@ -87,12 +90,12 @@ require (
8790
github.com/oliamb/cutter v0.2.2
8891
github.com/olivere/elastic/v7 v7.0.24
8992
github.com/pelletier/go-toml v1.9.0 // indirect
90-
github.com/pierrec/lz4/v4 v4.1.3 // indirect
93+
github.com/pierrec/lz4/v4 v4.1.7 // indirect
9194
github.com/pkg/errors v0.9.1
9295
github.com/pquerna/otp v1.3.0
93-
github.com/prometheus/client_golang v1.10.0
96+
github.com/prometheus/client_golang v1.11.0
9497
github.com/quasoft/websspi v1.0.0
95-
github.com/rivo/uniseg v0.2.0 // indirect
98+
github.com/rs/xid v1.3.0 // indirect
9699
github.com/russross/blackfriday/v2 v2.1.0 // indirect
97100
github.com/sergi/go-diff v1.2.0
98101
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect
@@ -105,24 +108,24 @@ require (
105108
github.com/unknwon/com v1.0.1
106109
github.com/unknwon/i18n v0.0.0-20210321134014-0ebbf2df1c44
107110
github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae
108-
github.com/unrolled/render v1.1.1
111+
github.com/unrolled/render v1.4.0
109112
github.com/urfave/cli v1.22.5
110-
github.com/willf/bitset v1.1.11 // indirect
111-
github.com/xanzy/go-gitlab v0.48.0
113+
github.com/xanzy/go-gitlab v0.50.0
112114
github.com/yohcop/openid-go v1.0.0
113-
github.com/yuin/goldmark v1.3.5
114-
github.com/yuin/goldmark-highlighting v0.0.0-20200307114337-60d527fdb691
115+
github.com/yuin/goldmark v1.3.7
116+
github.com/yuin/goldmark-highlighting v0.0.0-20210516132338-9216f9c5aa01
115117
github.com/yuin/goldmark-meta v1.0.0
118+
go.etcd.io/bbolt v1.3.6 // indirect
116119
go.jolheiser.com/hcaptcha v0.0.4
117120
go.jolheiser.com/pwn v0.0.3
118-
go.uber.org/multierr v1.6.0 // indirect
119-
go.uber.org/zap v1.16.0 // indirect
120-
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b
121-
golang.org/x/net v0.0.0-20210421230115-4e50805a0758
122-
golang.org/x/oauth2 v0.0.0-20210413134643-5e61552d6c78
123-
golang.org/x/sys v0.0.0-20210421221651-33663a62ff08
121+
go.uber.org/multierr v1.7.0 // indirect
122+
go.uber.org/zap v1.17.0 // indirect
123+
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
124+
golang.org/x/net v0.0.0-20210525063256-abc453219eb5
125+
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c
126+
golang.org/x/sys v0.0.0-20210608053332-aa57babbf139
124127
golang.org/x/text v0.3.6
125-
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
128+
golang.org/x/time v0.0.0-20210608053304-ed9ce3a009e4 // indirect
126129
golang.org/x/tools v0.1.0
127130
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
128131
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df

0 commit comments

Comments
 (0)