This repository has been archived on 2024-01-04. You can view files and clone it, but cannot push or open issues or pull requests.
forgejo/modules/context
zeripath bb0ff77e46
Share HTML template renderers and create a watcher framework (#20218)
The recovery, API, Web and package frameworks all create their own HTML
Renderers. This increases the memory requirements of Gitea
unnecessarily with duplicate templates being kept in memory.

Further the reloading framework in dev mode for these involves locking
and recompiling all of the templates on each load. This will potentially
hide concurrency issues and it is inefficient.

This PR stores the templates renderer in the context and stores this
context in the NormalRoutes, it then creates a fsnotify.Watcher
framework to watch files.

The watching framework is then extended to the mailer templates which
were previously not being reloaded in dev.

Then the locales are simplified to a similar structure.

Fix #20210 
Fix #20211
Fix #20217

Signed-off-by: Andrew Thornton <art27@cantab.net>
2022-08-28 10:43:25 +01:00
..
access_log.go Pass down SignedUserName down to AccessLogger context (#16605) 2021-08-04 13:26:30 -04:00
api.go Add Cache-Control header to html and api responses, add no-transform (#20432) 2022-07-23 14:38:03 +08:00
api_org.go Move organization related structs into sub package (#18518) 2022-03-29 14:29:02 +08:00
api_test.go format with gofumpt (#18184) 2022-01-20 18:46:10 +01:00
auth.go Respond with a 401 on git push when password isn't changed yet (#20026) 2022-06-19 20:23:00 +01:00
captcha.go format with gofumpt (#18184) 2022-01-20 18:46:10 +01:00
context.go Share HTML template renderers and create a watcher framework (#20218) 2022-08-28 10:43:25 +01:00
csrf.go Refactor CSRF protection modules, make sure CSRF tokens can be up-to-date. (#19337) 2022-04-08 13:21:05 +08:00
form.go Add config options to hide issue events (#17414) 2022-01-21 18:59:26 +01:00
org.go Allow access to the Public Organization Member lists with minimal permissions (#20330) 2022-07-15 15:21:54 +01:00
package.go Share HTML template renderers and create a watcher framework (#20218) 2022-08-28 10:43:25 +01:00
pagination.go Remove tab/TabName usage where it's not needed (#19973) 2022-06-15 23:05:32 +08:00
permission.go Move access and repo permission to models/perm/access (#19350) 2022-05-11 12:09:36 +02:00
private.go Add more linters to improve code readability (#19989) 2022-06-20 12:02:49 +02:00
repo.go Fix download archiver of a commit (#20962) 2022-08-26 15:07:06 +02:00
response.go format with gofumpt (#18184) 2022-01-20 18:46:10 +01:00
utils.go Add more linters to improve code readability (#19989) 2022-06-20 12:02:49 +02:00
xsrf.go Refactor CSRF protection modules, make sure CSRF tokens can be up-to-date. (#19337) 2022-04-08 13:21:05 +08:00
xsrf_test.go Refactor CSRF protection modules, make sure CSRF tokens can be up-to-date. (#19337) 2022-04-08 13:21:05 +08:00