Fix bug err failed

This commit is contained in:
Danny Spina 2023-06-23 23:02:28 +02:00
parent 78cd3ed78f
commit 5e65c17c4b
2 changed files with 11 additions and 1 deletions

View File

@ -100,6 +100,8 @@ app.get("/", async (req, res) => {
<html>
<head>
<meta charset="UTF-8">
<link rel="icon" type="image/x-icon" href="/favicon.svg" />
<link rel="stylesheet" href="/styles/serp.css" media="print" onload="this.media='all'">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Blaze - ${query}</title>
<style>
@ -295,6 +297,14 @@ app.get("/favicon.svg", (_, res) => {
res.sendFile(path.join(__dirname + "/favicon.svg"));
});
app.get("/service-worker.js", (_, res) => {
res.sendFile(path.join(__dirname + "/service-worker.js"));
});
app.get("/styles/serp.css", (_, res) => {
res.sendFile(path.join(__dirname + "/styles/serp.css"));
});
app.listen(port, () => {
console.log(`Got request`);
});

View File

@ -27,7 +27,7 @@ self.addEventListener("fetch", (event: any) => {
const cachedEtag = cachedResponse
? cachedResponse.headers.get("X-Blaze-Etag")
: null;
if (currentEtag === cachedEtag) {
if (cachedResponse && currentEtag === cachedEtag) {
return cachedResponse;
} else {
return cache