Add a NoCache setting
Added this to the settings so it can be configured at runtime. If set to true, a Cache-Control header will be sent with the wasm file as well as the index html.
This commit is contained in:
parent
237619f57e
commit
0a817eff87
@ -63,7 +63,9 @@ func wsStaticFiles(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func wsWasmFile(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Cache-Control", "no-cache, must-revalidate")
|
||||
if settings.NoCache {
|
||||
w.Header().Set("Cache-Control", "no-cache, must-revalidate")
|
||||
}
|
||||
http.ServeFile(w, r, "./static/main.wasm")
|
||||
}
|
||||
|
||||
@ -215,7 +217,9 @@ func handleIndexTemplate(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// Force browser to replace cache since file was not changed
|
||||
w.Header().Set("Cache-Control", "no-cache, must-revalidate")
|
||||
if settings.NoCache {
|
||||
w.Header().Set("Cache-Control", "no-cache, must-revalidate")
|
||||
}
|
||||
|
||||
err = t.Execute(w, data)
|
||||
if err != nil {
|
||||
|
@ -32,6 +32,9 @@ type Settings struct {
|
||||
Bans []BanInfo
|
||||
LogLevel common.LogLevel
|
||||
LogFile string
|
||||
|
||||
// Send the NoCache header?
|
||||
NoCache bool
|
||||
}
|
||||
|
||||
type BanInfo struct {
|
||||
|
Loading…
Reference in New Issue
Block a user