diff --git a/index.ts b/index.ts index 91f1bd4..26696fb 100644 --- a/index.ts +++ b/index.ts @@ -144,8 +144,18 @@ app.get("/blazed", async (req, res) => { if (xhr.status !== 200) { console.error("XHR request failed:", xhr.status, xhr.statusText); - res.send(` -
+ res.send( + minify( + ` + + + + + + Blaze - error + + +

Blaze could not load the page :(

Reason: ${xhr.status} ${xhr.statusText}


@@ -157,7 +167,12 @@ app.get("/blazed", async (req, res) => {
Go back
- `); + + + `, + minifierOptions + ) + ); return; } @@ -191,8 +206,9 @@ app.get("/blazed", async (req, res) => { blazeDisclaimer.style.width = "100dvw"; blazeDisclaimer.style.border = "1px solid red"; blazeDisclaimer.style.padding = "1rem"; + blazeDisclaimer.style.textAlign = "center"; blazeDisclaimer.innerHTML = ` -

BLAZE INFO

+

BLAZE INFO

The page you are seeing could not be correctly blazed due to these webpage characteristics. Blaze served anyway a lightweight version of the page. @@ -203,7 +219,9 @@ app.get("/blazed", async (req, res) => { const referenceElement = document.body.firstChild; document.body.insertBefore(blazeDisclaimer, referenceElement); - return res.send(document.toString()); + const blazedPage = minify(document.toString(), minifierOptions); + + return res.send(blazedPage); } //TODO: find if there are more performant ways to remove images or evaluate if is the case to remove images