Skip to content

Commit 8f5873d

Browse files
committed
Merge branch 'master' into feature/dismissing_reviews
* master: [skip ci] Updated translations via Crowdin Fix bug because of duplicated join (go-gitea#14454) Cron job to cleanup hook_task table (go-gitea#13080) Fix panic 500 page rendering (go-gitea#14474) [skip ci] Updated translations via Crowdin Move macaron to chi (go-gitea#14293) [skip ci] Updated translations via Crowdin Fix incorrect key name so registerManualConfirm setting works as expected. (go-gitea#14455)
2 parents 0feea44 + 5845c87 commit 8f5873d

File tree

363 files changed

+5752
-20752
lines changed

Some content is hidden

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

363 files changed

+5752
-20752
lines changed

.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ issues:
7070
- path: modules/log/
7171
linters:
7272
- errcheck
73-
- path: routers/routes/macaron.go
73+
- path: routers/routes/web.go
7474
linters:
7575
- dupl
7676
- path: routers/api/v1/repo/issue_subscription.go

cmd/dump.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"code.gitea.io/gitea/modules/storage"
2222
"code.gitea.io/gitea/modules/util"
2323

24-
"gitea.com/macaron/session"
24+
"gitea.com/go-chi/session"
2525
archiver "github.com/mholt/archiver/v3"
2626
"github.com/urfave/cli"
2727
)

cmd/web.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ func runWeb(ctx *cli.Context) error {
102102
return err
103103
}
104104
}
105-
c := routes.NewChi()
106-
routes.RegisterInstallRoute(c)
105+
c := routes.InstallRoutes()
107106
err := listen(c, false)
108107
select {
109108
case <-graceful.GetManager().IsShutdown():
@@ -134,11 +133,9 @@ func runWeb(ctx *cli.Context) error {
134133
return err
135134
}
136135
}
137-
// Set up Chi routes
138-
c := routes.NewChi()
139-
c.Mount("/", routes.NormalRoutes())
140-
routes.DelegateToMacaron(c)
141136

137+
// Set up Chi routes
138+
c := routes.NormalRoutes()
142139
err := listen(c, true)
143140
<-graceful.GetManager().Done()
144141
log.Info("PID: %d Gitea Web Finished", os.Getpid())

contrib/pr/checkout.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ func runPR() {
116116
//routers.GlobalInit()
117117
external.RegisterParsers()
118118
markup.Init()
119-
c := routes.NewChi()
120-
c.Mount("/", routes.NormalRoutes())
121-
routes.DelegateToMacaron(c)
119+
c := routes.NormalRoutes()
122120

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

custom/conf/app.example.ini

+15
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,21 @@ SCHEDULE = @every 24h
10231023
; deleted branches than OLDER_THAN ago are subject to deletion
10241024
OLDER_THAN = 24h
10251025

1026+
; Cleanup hook_task table
1027+
[cron.cleanup_hook_task_table]
1028+
; Whether to enable the job
1029+
ENABLED = true
1030+
; Whether to always run at start up time (if ENABLED)
1031+
RUN_AT_START = false
1032+
; Time interval for job to run
1033+
SCHEDULE = @every 24h
1034+
; OlderThan or PerWebhook. How the records are removed, either by age (i.e. how long ago hook_task record was delivered) or by the number to keep per webhook (i.e. keep most recent x deliveries per webhook).
1035+
CLEANUP_TYPE = OlderThan
1036+
; If CLEANUP_TYPE is set to OlderThan, then any delivered hook_task records older than this expression will be deleted.
1037+
OLDER_THAN = 168h
1038+
; If CLEANUP_TYPE is set to PerWebhook, this is number of hook_task records to keep for a webhook (i.e. keep the most recent x deliveries).
1039+
NUMBER_TO_KEEP = 10
1040+
10261041
; Extended cron task - not enabled by default
10271042

10281043
; Delete all unactivated accounts

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

+11-4
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ Define allowed algorithms and their minimum key length (use -1 to disable a type
549549

550550
## Session (`session`)
551551

552-
- `PROVIDER`: **memory**: Session engine provider \[memory, file, redis, mysql, couchbase, memcache, nodb, postgres\].
552+
- `PROVIDER`: **memory**: Session engine provider \[memory, file, redis, mysql, couchbase, memcache, postgres\].
553553
- `PROVIDER_CONFIG`: **data/sessions**: For file, the root path; for others, the connection string.
554554
- `COOKIE_SECURE`: **false**: Enable this to force using HTTPS for all session access.
555555
- `COOKIE_NAME`: **i\_like\_gitea**: The name of the cookie used for the session ID.
@@ -609,16 +609,14 @@ Default templates for project boards:
609609
- `MODE`: **console**: Logging mode. For multiple modes, use a comma to separate values. You can configure each mode in per mode log subsections `\[log.modename\]`. By default the file mode will log to `$ROOT_PATH/gitea.log`.
610610
- `LEVEL`: **Info**: General log level. \[Trace, Debug, Info, Warn, Error, Critical, Fatal, None\]
611611
- `STACKTRACE_LEVEL`: **None**: Default log level at which to log create stack traces. \[Trace, Debug, Info, Warn, Error, Critical, Fatal, None\]
612-
- `REDIRECT_MACARON_LOG`: **false**: Redirects the Macaron log to its own logger or the default logger.
613-
- `MACARON`: **file**: Logging mode for the macaron logger, use a comma to separate values. Configure each mode in per mode log subsections `\[log.modename.macaron\]`. By default the file mode will log to `$ROOT_PATH/macaron.log`. (If you set this to `,` it will log to default gitea logger.)
614612
- `ROUTER_LOG_LEVEL`: **Info**: The log level that the router should log at. (If you are setting the access log, its recommended to place this at Debug.)
615613
- `ROUTER`: **console**: The mode or name of the log the router should log to. (If you set this to `,` it will log to default gitea logger.)
616614
NB: You must `REDIRECT_MACARON_LOG` and have `DISABLE_ROUTER_LOG` set to `false` for this option to take effect. Configure each mode in per mode log subsections `\[log.modename.router\]`.
617615
- `ENABLE_ACCESS_LOG`: **false**: Creates an access.log in NCSA common log format, or as per the following template
618616
- `ACCESS`: **file**: Logging mode for the access logger, use a comma to separate values. Configure each mode in per mode log subsections `\[log.modename.access\]`. By default the file mode will log to `$ROOT_PATH/access.log`. (If you set this to `,` it will log to the default gitea logger.)
619617
- `ACCESS_LOG_TEMPLATE`: **`{{.Ctx.RemoteAddr}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.URL.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}\" \"{{.Ctx.Req.UserAgent}}"`**: Sets the template used to create the access log.
620618
- The following variables are available:
621-
- `Ctx`: the `macaron.Context` of the request.
619+
- `Ctx`: the `context.Context` of the request.
622620
- `Identity`: the SignedUserName or `"-"` if not logged in.
623621
- `Start`: the start time of the request.
624622
- `ResponseWriter`: the responseWriter from the request.
@@ -696,6 +694,15 @@ NB: You must `REDIRECT_MACARON_LOG` and have `DISABLE_ROUTER_LOG` set to `false`
696694
- `RUN_AT_START`: **true**: Run repository statistics check at start time.
697695
- `SCHEDULE`: **@every 24h**: Cron syntax for scheduling repository statistics check.
698696

697+
### Cron - Cleanup hook_task Table (`cron.cleanup_hook_task_table`)
698+
699+
- `ENABLED`: **true**: Enable cleanup hook_task job.
700+
- `RUN_AT_START`: **false**: Run cleanup hook_task at start time (if ENABLED).
701+
- `SCHEDULE`: **@every 24h**: Cron syntax for cleaning hook_task table.
702+
- `CLEANUP_TYPE` **OlderThan** OlderThan or PerWebhook Method to cleanup hook_task, either by age (i.e. how long ago hook_task record was delivered) or by the number to keep per webhook (i.e. keep most recent x deliveries per webhook).
703+
- `OLDER_THAN`: **168h**: If CLEANUP_TYPE is set to OlderThan, then any delivered hook_task records older than this expression will be deleted.
704+
- `NUMBER_TO_KEEP`: **10**: If CLEANUP_TYPE is set to PerWebhook, this is number of hook_task records to keep for a webhook (i.e. keep the most recent x deliveries).
705+
699706
#### Cron - Update Migration Poster ID (`cron.update_migration_poster_id`)
700707

701708
- `SCHEDULE`: **@every 24h** : Interval as a duration between each synchronization, it will always attempt synchronization when the instance starts.

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

+4-33
Original file line numberDiff line numberDiff line change
@@ -67,40 +67,11 @@ The provider type of the sublogger can be set using the `MODE` value in
6767
its subsection, but will default to the name. This allows you to have
6868
multiple subloggers that will log to files.
6969

70-
### The "Macaron" logger
71-
72-
By default Macaron will log to its own go `log` instance. This writes
73-
to `os.Stdout`. You can redirect this log to a Gitea configurable logger
74-
through setting the `REDIRECT_MACARON_LOG` setting in the `[log]`
75-
section which you can configure the outputs of by setting the `MACARON`
76-
value in the `[log]` section of the configuration. `MACARON` defaults
77-
to `file` if unset.
78-
79-
Please note, the macaron logger will log at `INFO` level, setting the
80-
`LEVEL` of this logger to `WARN` or above will result in no macaron logs.
81-
82-
Each output sublogger for this logger is configured in
83-
`[log.sublogger.macaron]` sections. There are certain default values
84-
which will not be inherited from the `[log]` or relevant
85-
`[log.sublogger]` sections:
86-
87-
- `FLAGS` is `stdflags` (Equal to
88-
`date,time,medfile,shortfuncname,levelinitial`)
89-
- `FILE_NAME` will default to `%(ROOT_PATH)/macaron.log`
90-
- `EXPRESSION` will default to `""`
91-
- `PREFIX` will default to `""`
92-
93-
NB: You can redirect the macaron logger to send its events to the gitea
94-
log using the value: `MACARON = ,`
95-
9670
### The "Router" logger
9771

98-
There are two types of Router log. By default Macaron send its own
99-
router log which will be directed to Macaron's go `log`, however if you
100-
`REDIRECT_MACARON_LOG` you will enable Gitea's router log. You can
101-
disable both types of Router log by setting `DISABLE_ROUTER_LOG`.
72+
You can disable Router log by setting `DISABLE_ROUTER_LOG`.
10273

103-
If you enable the redirect, you can configure the outputs of this
74+
You can configure the outputs of this
10475
router log by setting the `ROUTER` value in the `[log]` section of the
10576
configuration. `ROUTER` will default to `console` if unset. The Gitea
10677
Router logs the same data as the Macaron log but has slightly different
@@ -162,11 +133,11 @@ This value represent a go template. It's default value is:
162133

163134
The template is passed following options:
164135

165-
- `Ctx` is the `macaron.Context`
136+
- `Ctx` is the `context.Context`
166137
- `Identity` is the `SignedUserName` or `"-"` if the user is not logged
167138
in
168139
- `Start` is the start time of the request
169-
- `ResponseWriter` is the `macaron.ResponseWriter`
140+
- `ResponseWriter` is the `http.ResponseWriter`
170141

171142
Caution must be taken when changing this template as it runs outside of
172143
the standard panic recovery trap. The template should also be as simple

docs/content/page/index.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others.
267267

268268
## Components
269269

270-
* Web framework: [Macaron](http://go-macaron.com/)
270+
* Web framework: [Chi](http://github.com/go-chi/chi)
271271
* ORM: [XORM](https://xorm.io)
272272
* UI components:
273273
* [Semantic UI](http://semantic-ui.com/)

docs/content/page/index.fr-fr.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ Le but de ce projet est de fournir de la manière la plus simple, la plus rapide
254254

255255
## Composants
256256

257-
* Framework web : [Macaron](http://go-macaron.com/)
257+
* Framework web : [Chi](http://github.com/go-chi/chi)
258258
* ORM: [XORM](https://xorm.io)
259259
* Interface graphique :
260260
* [Semantic UI](http://semantic-ui.com/)

docs/content/page/index.zh-cn.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Gitea的首要目标是创建一个极易安装,运行非常快速,安装和
4747

4848
## 组件
4949

50-
* Web框架: [Macaron](http://go-macaron.com/)
50+
* Web框架: [Chi](http://github.com/go-chi/chi)
5151
* ORM: [XORM](https://xorm.io)
5252
* UI组件:
5353
* [Semantic UI](http://semantic-ui.com/)

docs/content/page/index.zh-tw.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Gitea 的首要目標是建立一個容易安裝,運行快速,安装和使
4747

4848
## 元件
4949

50-
* Web 框架: [Macaron](http://go-macaron.com/)
50+
* Web 框架: [Chi](http://github.com/go-chi/chi)
5151
* ORM: [XORM](https://xorm.io)
5252
* UI 元件:
5353
* [Semantic UI](http://semantic-ui.com/)

go.mod

+5-11
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,12 @@ go 1.14
55
require (
66
code.gitea.io/gitea-vet v0.2.1
77
code.gitea.io/sdk/gitea v0.13.1
8+
gitea.com/go-chi/binding v0.0.0-20210113025129-03f1d313373c
9+
gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e
10+
gitea.com/go-chi/captcha v0.0.0-20210110083842-e7696c336a1e
811
gitea.com/go-chi/session v0.0.0-20210108030337-0cb48c5ba8ee
912
gitea.com/lunny/levelqueue v0.3.0
10-
gitea.com/macaron/binding v0.0.0-20190822013154-a5f53841ed2b
11-
gitea.com/macaron/cache v0.0.0-20200924044943-905232fba10b
12-
gitea.com/macaron/captcha v0.0.0-20200825161008-e8597820aaca
13-
gitea.com/macaron/cors v0.0.0-20190826180238-95aec09ea8b4
14-
gitea.com/macaron/csrf v0.0.0-20190822024205-3dc5a4474439
15-
gitea.com/macaron/gzip v0.0.0-20200827120000-efa5e8477cf5
16-
gitea.com/macaron/i18n v0.0.0-20200911004404-4ca3dd0cbd60
17-
gitea.com/macaron/inject v0.0.0-20190805023432-d4c86e31027a
18-
gitea.com/macaron/macaron v1.5.1-0.20201027213641-0db5d4584804
19-
gitea.com/macaron/session v0.0.0-20201103015045-a177a2701dee
20-
gitea.com/macaron/toolbox v0.0.0-20190822013122-05ff0fc766b7
13+
github.com/NYTimes/gziphandler v1.1.1
2114
github.com/PuerkitoBio/goquery v1.5.1
2215
github.com/RoaringBitmap/roaring v0.5.5 // indirect
2316
github.com/alecthomas/chroma v0.8.2
@@ -36,6 +29,7 @@ require (
3629
github.com/gliderlabs/ssh v0.3.1
3730
github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a // indirect
3831
github.com/go-chi/chi v1.5.1
32+
github.com/go-chi/cors v1.1.1
3933
github.com/go-enry/go-enry/v2 v2.6.0
4034
github.com/go-git/go-billy/v5 v5.0.0
4135
github.com/go-git/go-git/v5 v5.2.0

0 commit comments

Comments
 (0)