diff --git a/routes/blog.js b/routes/blog.js index b0415d7..9a0bed0 100644 --- a/routes/blog.js +++ b/routes/blog.js @@ -6,7 +6,7 @@ var cachedResult = {} app.get("/blogposts", (rreq, rres) => { if (Date.now() < timeSinceLastQuery+10000) { // if it has been <10 seconds since last request - rres.set("Access-Control-Allow-Origin","*") + if (rreq.query.format === "html") { // if ?format=html then send HTML rres.send(cachedResult.asHtml) @@ -17,7 +17,7 @@ app.get("/blogposts", (rreq, rres) => { } else { timeSinceLastQuery = Date.now() cachedResult = parseFiles() - rres.set("Access-Control-Allow-Origin","*") + if (rreq.query.format === "html") { // if ?format=html then send HTML rres.send(cachedResult.asHtml) diff --git a/routes/cider.js b/routes/cider.js index 4960cea..048566c 100644 --- a/routes/cider.js +++ b/routes/cider.js @@ -5,7 +5,7 @@ var currentListening = {} var currentListeningHtml = "" app.get("/cider", (rreq,rres) => { - rres.set("Access-Control-Allow-Origin","*") + rres.send("Cider endpoint is temporarily unavailable.") }) @@ -18,7 +18,7 @@ app.get("/cider", (rreq,rres) => { // if (funcRes == 1) { // rres.sendStatus(503) // If there was a problem getting the upstream JSON, return 503 Service Unavailable. // } else { -// rres.set("Access-Control-Allow-Origin","*") // Required (I think?) because of CORS. +// // Required (I think?) because of CORS. // currentListening = funcRes // rres.send(funcRes) // }