diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-01-29 23:35:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-29 16:35:30 +0100 |
commit | 0cd87d64ff8bb40520877d3a217363de299f4531 (patch) | |
tree | d2ec167aea8f5b2ff673b13ba8be98a275d942ab /modules | |
parent | 25b6255b924c30a2bab066c0465d146a34021245 (diff) | |
download | gitea-0cd87d64ff8bb40520877d3a217363de299f4531.tar.gz gitea-0cd87d64ff8bb40520877d3a217363de299f4531.zip |
Update docs and comments to remove macaron (#14491)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/context/api.go | 4 | ||||
-rw-r--r-- | modules/context/org.go | 2 | ||||
-rw-r--r-- | modules/context/permission.go | 10 | ||||
-rw-r--r-- | modules/context/private.go | 2 | ||||
-rw-r--r-- | modules/context/repo.go | 6 | ||||
-rw-r--r-- | modules/log/log.go | 2 | ||||
-rw-r--r-- | modules/public/dynamic.go | 2 | ||||
-rw-r--r-- | modules/public/public.go | 4 | ||||
-rw-r--r-- | modules/public/static.go | 2 | ||||
-rw-r--r-- | modules/setting/log.go | 2 | ||||
-rw-r--r-- | modules/setting/setting.go | 2 | ||||
-rw-r--r-- | modules/translation/translation.go | 1 |
12 files changed, 18 insertions, 21 deletions
diff --git a/modules/context/api.go b/modules/context/api.go index cf6dc265cd..aab6905fd1 100644 --- a/modules/context/api.go +++ b/modules/context/api.go @@ -23,7 +23,7 @@ import ( "gitea.com/go-chi/session" ) -// APIContext is a specific macaron context for API service +// APIContext is a specific context for API service type APIContext struct { *Context Org *APIOrganization @@ -217,7 +217,7 @@ func (ctx *APIContext) CheckForOTP() { } } -// APIContexter returns apicontext as macaron middleware +// APIContexter returns apicontext as middleware func APIContexter() func(http.Handler) http.Handler { var csrfOpts = getCsrfOpts() diff --git a/modules/context/org.go b/modules/context/org.go index 83d385a1e9..5148cc4a6c 100644 --- a/modules/context/org.go +++ b/modules/context/org.go @@ -170,7 +170,7 @@ func HandleOrgAssignment(ctx *Context, args ...bool) { } } -// OrgAssignment returns a macaron middleware to handle organization assignment +// OrgAssignment returns a middleware to handle organization assignment func OrgAssignment(args ...bool) func(ctx *Context) { return func(ctx *Context) { HandleOrgAssignment(ctx, args...) diff --git a/modules/context/permission.go b/modules/context/permission.go index 6fb8237e22..b9cdf93de2 100644 --- a/modules/context/permission.go +++ b/modules/context/permission.go @@ -9,7 +9,7 @@ import ( "code.gitea.io/gitea/modules/log" ) -// RequireRepoAdmin returns a macaron middleware for requiring repository admin permission +// RequireRepoAdmin returns a middleware for requiring repository admin permission func RequireRepoAdmin() func(ctx *Context) { return func(ctx *Context) { if !ctx.IsSigned || !ctx.Repo.IsAdmin() { @@ -19,7 +19,7 @@ func RequireRepoAdmin() func(ctx *Context) { } } -// RequireRepoWriter returns a macaron middleware for requiring repository write to the specify unitType +// RequireRepoWriter returns a middleware for requiring repository write to the specify unitType func RequireRepoWriter(unitType models.UnitType) func(ctx *Context) { return func(ctx *Context) { if !ctx.Repo.CanWrite(unitType) { @@ -29,7 +29,7 @@ func RequireRepoWriter(unitType models.UnitType) func(ctx *Context) { } } -// RequireRepoWriterOr returns a macaron middleware for requiring repository write to one of the unit permission +// RequireRepoWriterOr returns a middleware for requiring repository write to one of the unit permission func RequireRepoWriterOr(unitTypes ...models.UnitType) func(ctx *Context) { return func(ctx *Context) { for _, unitType := range unitTypes { @@ -41,7 +41,7 @@ func RequireRepoWriterOr(unitTypes ...models.UnitType) func(ctx *Context) { } } -// RequireRepoReader returns a macaron middleware for requiring repository read to the specify unitType +// RequireRepoReader returns a middleware for requiring repository read to the specify unitType func RequireRepoReader(unitType models.UnitType) func(ctx *Context) { return func(ctx *Context) { if !ctx.Repo.CanRead(unitType) { @@ -67,7 +67,7 @@ func RequireRepoReader(unitType models.UnitType) func(ctx *Context) { } } -// RequireRepoReaderOr returns a macaron middleware for requiring repository write to one of the unit permission +// RequireRepoReaderOr returns a middleware for requiring repository write to one of the unit permission func RequireRepoReaderOr(unitTypes ...models.UnitType) func(ctx *Context) { return func(ctx *Context) { for _, unitType := range unitTypes { diff --git a/modules/context/private.go b/modules/context/private.go index a246100050..dfefa1d2f0 100644 --- a/modules/context/private.go +++ b/modules/context/private.go @@ -28,7 +28,7 @@ func GetPrivateContext(req *http.Request) *PrivateContext { return req.Context().Value(privateContextKey).(*PrivateContext) } -// PrivateContexter returns apicontext as macaron middleware +// PrivateContexter returns apicontext as middleware func PrivateContexter() func(http.Handler) http.Handler { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { diff --git a/modules/context/repo.go b/modules/context/repo.go index 79192267fb..13037f4625 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -373,7 +373,7 @@ func repoAssignment(ctx *Context, repo *models.Repository) { ctx.Data["IsEmptyRepo"] = ctx.Repo.Repository.IsEmpty } -// RepoIDAssignment returns a macaron handler which assigns the repo to the context. +// RepoIDAssignment returns a handler which assigns the repo to the context. func RepoIDAssignment() func(ctx *Context) { return func(ctx *Context) { repoID := ctx.ParamsInt64(":repoid") @@ -393,7 +393,7 @@ func RepoIDAssignment() func(ctx *Context) { } } -// RepoAssignment returns a macaron to handle repository assignment +// RepoAssignment returns a middleware to handle repository assignment func RepoAssignment() func(http.Handler) http.Handler { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { @@ -849,7 +849,7 @@ func GitHookService() func(ctx *Context) { } } -// UnitTypes returns a macaron middleware to set unit types to context variables. +// UnitTypes returns a middleware to set unit types to context variables. func UnitTypes() func(ctx *Context) { return func(ctx *Context) { ctx.Data["UnitTypeCode"] = models.UnitTypeCode diff --git a/modules/log/log.go b/modules/log/log.go index 16a6efb75b..cae24f53d8 100644 --- a/modules/log/log.go +++ b/modules/log/log.go @@ -267,7 +267,7 @@ func NewLoggerAsWriter(level string, ourLoggers ...*MultiChannelledLogger) *Logg return l } -// Write implements the io.Writer interface to allow spoofing of macaron +// Write implements the io.Writer interface to allow spoofing of chi func (l *LoggerAsWriter) Write(p []byte) (int, error) { for _, logger := range l.ourLoggers { // Skip = 3 because this presumes that we have been called by log.Println() diff --git a/modules/public/dynamic.go b/modules/public/dynamic.go index f634c598a3..a57b636369 100644 --- a/modules/public/dynamic.go +++ b/modules/public/dynamic.go @@ -13,7 +13,7 @@ import ( "time" ) -// Static implements the macaron static handler for serving assets. +// Static implements the static handler for serving assets. func Static(opts *Options) func(next http.Handler) http.Handler { return opts.staticHandler(opts.Directory) } diff --git a/modules/public/public.go b/modules/public/public.go index 6417c91f1a..6695944bd6 100644 --- a/modules/public/public.go +++ b/modules/public/public.go @@ -15,7 +15,7 @@ import ( "code.gitea.io/gitea/modules/setting" ) -// Options represents the available options to configure the macaron handler. +// Options represents the available options to configure the handler. type Options struct { Directory string IndexFile string @@ -34,7 +34,7 @@ var KnownPublicEntries = []string{ "favicon.ico", } -// Custom implements the macaron static handler for serving custom assets. +// Custom implements the static handler for serving custom assets. func Custom(opts *Options) func(next http.Handler) http.Handler { return opts.staticHandler(path.Join(setting.CustomPath, "public")) } diff --git a/modules/public/static.go b/modules/public/static.go index c4dd7a1eca..36cfdbe44f 100644 --- a/modules/public/static.go +++ b/modules/public/static.go @@ -20,7 +20,7 @@ import ( "code.gitea.io/gitea/modules/log" ) -// Static implements the macaron static handler for serving assets. +// Static implements the static handler for serving assets. func Static(opts *Options) func(next http.Handler) http.Handler { opts.FileSystem = Assets // we don't need to pass the directory, because the directory var is only diff --git a/modules/setting/log.go b/modules/setting/log.go index daa449a5ca..9fe2d5bda3 100644 --- a/modules/setting/log.go +++ b/modules/setting/log.go @@ -273,7 +273,7 @@ func newRouterLogService() { // Allow [log] DISABLE_ROUTER_LOG to override [server] DISABLE_ROUTER_LOG DisableRouterLog = Cfg.Section("log").Key("DISABLE_ROUTER_LOG").MustBool(DisableRouterLog) - if !DisableRouterLog && RedirectMacaronLog { + if !DisableRouterLog { options := newDefaultLogOptions() options.filename = filepath.Join(LogRootPath, "router.log") options.flags = "date,time" // For the router we don't want any prefixed flags diff --git a/modules/setting/setting.go b/modules/setting/setting.go index f69dd11ceb..dd38f5be45 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -288,7 +288,6 @@ var ( LogLevel string StacktraceLogLevel string LogRootPath string - RedirectMacaronLog bool DisableRouterLog bool RouterLogLevel log.Level RouterLogMode string @@ -539,7 +538,6 @@ func NewContext() { StacktraceLogLevel = getStacktraceLogLevel(Cfg.Section("log"), "STACKTRACE_LEVEL", "None") LogRootPath = Cfg.Section("log").Key("ROOT_PATH").MustString(path.Join(AppWorkPath, "log")) forcePathSeparator(LogRootPath) - RedirectMacaronLog = Cfg.Section("log").Key("REDIRECT_MACARON_LOG").MustBool(false) RouterLogLevel = log.FromString(Cfg.Section("log").Key("ROUTER_LOG_LEVEL").MustString("Info")) sec := Cfg.Section("server") diff --git a/modules/translation/translation.go b/modules/translation/translation.go index 94a93a40ae..28ff6a5db1 100644 --- a/modules/translation/translation.go +++ b/modules/translation/translation.go @@ -49,7 +49,6 @@ func InitLocales() { } } - // These codes will be used once macaron removed tags := make([]language.Tag, len(setting.Langs)) for i, lang := range setting.Langs { tags[i] = language.Raw.Make(lang) |