mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-18 07:53:04 +00:00
Enable caching on assets and avatars (#3376)
* Enable caching on assets and avatars Fixes #3323 * Only set avatar in user BeforeUpdate when there is no avatar set * add error checking after stat * gofmt * Change cache time for avatars to an hour
This commit is contained in:
parent
77f8bad2fb
commit
17655cdf1b
5 changed files with 155 additions and 34 deletions
|
@ -13,17 +13,14 @@ import (
|
|||
|
||||
// Static implements the macaron static handler for serving assets.
|
||||
func Static(opts *Options) macaron.Handler {
|
||||
return macaron.Static(
|
||||
opts.Directory,
|
||||
macaron.StaticOptions{
|
||||
SkipLogging: opts.SkipLogging,
|
||||
FileSystem: bindata.Static(bindata.Options{
|
||||
Asset: Asset,
|
||||
AssetDir: AssetDir,
|
||||
AssetInfo: AssetInfo,
|
||||
AssetNames: AssetNames,
|
||||
Prefix: "",
|
||||
}),
|
||||
},
|
||||
)
|
||||
opts.FileSystem = bindata.Static(bindata.Options{
|
||||
Asset: Asset,
|
||||
AssetDir: AssetDir,
|
||||
AssetInfo: AssetInfo,
|
||||
AssetNames: AssetNames,
|
||||
Prefix: "",
|
||||
})
|
||||
// we don't need to pass the directory, because the directory var is only
|
||||
// used when in the options there is no FileSystem.
|
||||
return opts.staticHandler("")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue