No Cache Fix

This commit is contained in:
ssyyhhrr
2023-03-20 11:40:12 +00:00
parent 12be776ee6
commit b344106c19
2 changed files with 9 additions and 2 deletions

9
app.js
View File

@@ -226,7 +226,14 @@ function server() {
app.enable("trust proxy") app.enable("trust proxy")
app.use(express.urlencoded({ extended: true })) app.use(express.urlencoded({ extended: true }))
app.use(express.static("assets")) app.use(express.static("assets", {
setHeaders: function(res, path, stat) {
// Set cache control headers
res.set('Cache-Control', 'no-cache, no-store, must-revalidate');
res.set('Pragma', 'no-cache');
res.set('Expires', '0');
}
}))
app.use(favicon('assets/favicon.ico')) app.use(favicon('assets/favicon.ico'))
app.use(morgan("combined")) app.use(morgan("combined"))

View File

@@ -526,7 +526,7 @@ document.addEventListener('DOMContentLoaded', () => {
} }
let scores = JSON.parse(localStorage.scores) let scores = JSON.parse(localStorage.scores)
fillStats(stats, scores) fillStats(stats, scores)
fetch(`${window.location.href}/drivers.json?nocache=${new Date().getTime()}`).then(res => { fetch(`${window.location.href}/drivers.json`).then(res => {
res.json().then(result => { res.json().then(result => {
driversObj = result driversObj = result
Object.entries(result).forEach(driver => { Object.entries(result).forEach(driver => {