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> <html>
<head> <head>
<meta charset="UTF-8"> <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"> <meta name="viewport" content="width=device-width,initial-scale=1">
<title>Blaze - ${query}</title> <title>Blaze - ${query}</title>
<style> <style>
@ -295,6 +297,14 @@ app.get("/favicon.svg", (_, res) => {
res.sendFile(path.join(__dirname + "/favicon.svg")); 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, () => { app.listen(port, () => {
console.log(`Got request`); console.log(`Got request`);
}); });

View File

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