[#9064] Fix CSS and Image caching issue
This commit is contained in:
parent
e5606ef249
commit
9bc3f885bc
|
@ -526,6 +526,7 @@ router.get('(.*)', async ctx => {
|
||||||
if (meta.customSplashIcons.length > 0) {
|
if (meta.customSplashIcons.length > 0) {
|
||||||
splashIconUrl = meta.customSplashIcons[Math.floor(Math.random() * meta.customSplashIcons.length)];
|
splashIconUrl = meta.customSplashIcons[Math.floor(Math.random() * meta.customSplashIcons.length)];
|
||||||
}
|
}
|
||||||
|
const nowDateMs = Date.now();
|
||||||
await ctx.render('base', {
|
await ctx.render('base', {
|
||||||
img: meta.bannerUrl,
|
img: meta.bannerUrl,
|
||||||
title: meta.name || 'Calckey',
|
title: meta.name || 'Calckey',
|
||||||
|
@ -536,6 +537,7 @@ router.get('(.*)', async ctx => {
|
||||||
themeColor: meta.themeColor,
|
themeColor: meta.themeColor,
|
||||||
randomMOTD: motd[Math.floor(Math.random() * motd.length)],
|
randomMOTD: motd[Math.floor(Math.random() * motd.length)],
|
||||||
privateMode: meta.privateMode,
|
privateMode: meta.privateMode,
|
||||||
|
nowDateMs: nowDateMs,
|
||||||
});
|
});
|
||||||
ctx.set('Cache-Control', 'public, max-age=3');
|
ctx.set('Cache-Control', 'public, max-age=3');
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,15 +29,14 @@ html
|
||||||
meta(property='twitter:card' content='summary')
|
meta(property='twitter:card' content='summary')
|
||||||
meta(property='og:site_name' content= instanceName || 'Calckey')
|
meta(property='og:site_name' content= instanceName || 'Calckey')
|
||||||
meta(name='viewport' content='width=device-width, initial-scale=1')
|
meta(name='viewport' content='width=device-width, initial-scale=1')
|
||||||
meta(name='darkreader-lock')
|
link(rel='icon' href= icon || `/favicon.ico?${ nowDateMs }`)
|
||||||
link(rel='icon' href= icon || '/favicon.ico')
|
link(rel='apple-touch-icon' href= icon || `/apple-touch-icon.png?${ nowDateMs }`)
|
||||||
link(rel='apple-touch-icon' href= icon || '/apple-touch-icon.png')
|
|
||||||
link(rel='manifest' href='/manifest.json')
|
link(rel='manifest' href='/manifest.json')
|
||||||
link(rel='prefetch' href='/static-assets/badges/info.png')
|
link(rel='prefetch' href=`/static-assets/badges/info.png?${ nowDateMs }`)
|
||||||
link(rel='prefetch' href='/static-assets/badges/not-found.png')
|
link(rel='prefetch' href=`/static-assets/badges/not-found.png?${ nowDateMs }`)
|
||||||
link(rel='prefetch' href='/static-assets/badges/error.png')
|
link(rel='prefetch' href=`/static-assets/badges/error.png?${ nowDateMs }`)
|
||||||
link(rel='stylesheet' href='/assets/fontawesome/css/all.css')
|
link(rel='stylesheet' href='/assets/fontawesome/css/all.css')
|
||||||
link(rel='stylesheet' href='/static-assets/instance.css')
|
link(rel='stylesheet' href=`/static-assets/instance.css?${ nowDateMs }`)
|
||||||
link(rel='modulepreload' href=`/assets/${clientEntry.file}`)
|
link(rel='modulepreload' href=`/assets/${clientEntry.file}`)
|
||||||
|
|
||||||
each href in clientEntry.css
|
each href in clientEntry.css
|
||||||
|
@ -78,7 +77,7 @@ html
|
||||||
br
|
br
|
||||||
| Please turn on your JavaScript
|
| Please turn on your JavaScript
|
||||||
div#splash
|
div#splash
|
||||||
img#splashIcon(src= splashIcon || '/static-assets/splash.png')
|
img#splashIcon(src= splashIcon || `/static-assets/splash.png?${ nowDateMs }`)
|
||||||
span#splashText
|
span#splashText
|
||||||
block randomMOTD
|
block randomMOTD
|
||||||
= randomMOTD
|
= randomMOTD
|
||||||
|
|
Loading…
Reference in New Issue