Compare commits
2 Commits
452a109204
...
6623db9574
Author | SHA1 | Date | |
---|---|---|---|
6623db9574 | |||
cff9082aac |
@ -55,3 +55,8 @@ func New(filename string) (config Config, err error) {
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (config *Config) ParseApplicationConfig(v any) {
|
||||||
|
yStr, _ := yaml.Marshal(config.Application)
|
||||||
|
yaml.Unmarshal(yStr, &v)
|
||||||
|
}
|
||||||
|
3
pkg.go
3
pkg.go
@ -300,6 +300,9 @@ func (service *Service) StaticHandler(w http.ResponseWriter, r *http.Request, se
|
|||||||
|
|
||||||
rxp := regexp.MustCompile("^/(css|images|js|fonts)/v[0-9]+/(.*)$")
|
rxp := regexp.MustCompile("^/(css|images|js|fonts)/v[0-9]+/(.*)$")
|
||||||
if comp := rxp.FindStringSubmatch(r.URL.Path); comp != nil {
|
if comp := rxp.FindStringSubmatch(r.URL.Path); comp != nil {
|
||||||
|
w.Header().Add("Pragma", "public")
|
||||||
|
w.Header().Add("Cache-Control", "max-age=604800")
|
||||||
|
|
||||||
r.URL.Path = fmt.Sprintf("/%s/%s", comp[1], comp[2])
|
r.URL.Path = fmt.Sprintf("/%s/%s", comp[1], comp[2])
|
||||||
p := fmt.Sprintf(service.staticDirectory+"/%s/%s", comp[1], comp[2])
|
p := fmt.Sprintf(service.staticDirectory+"/%s/%s", comp[1], comp[2])
|
||||||
_, err = os.Stat(p)
|
_, err = os.Stat(p)
|
||||||
|
Loading…
Reference in New Issue
Block a user