Add etag header to last modified check of motd (#1739)

* Add etag header to last modified check of motd

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2021-12-31 09:30:12 +01:00 committed by GitHub
parent ca49eb957d
commit 20d9a15cff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 6 deletions

View file

@ -32,7 +32,8 @@ export const fetchMotd = async (customizeAssetsUrl: string): Promise<void> => {
if (response.status !== 200) {
return
}
if (response.headers.get('Last-Modified') === cachedLastModified) {
const lastModified = response.headers.get('Last-Modified') || response.headers.get('etag')
if (lastModified === cachedLastModified) {
return
}
}
@ -47,9 +48,9 @@ export const fetchMotd = async (customizeAssetsUrl: string): Promise<void> => {
const motdText = await response.text()
const lastModified = response.headers.get('Last-Modified')
const lastModified = response.headers.get('Last-Modified') || response.headers.get('etag')
if (!lastModified) {
log.warn("'Last-Modified' not found for motd.txt!")
log.warn("'Last-Modified' or 'Etag' not found for motd.txt!")
}
setMotd(motdText, lastModified)