gemfedwiki

gemini fedwiki proxy
git clone git://jb55.com/gemfedwiki
Log | Files | Refs | README

commit 3c1ee7fc7dac5df49e5b2f53f5c94ad7833e39d3
parent 01759ff7cad50b9dbc4fbf61ad29e9450420a7ca
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 27 Oct 2021 19:01:06 -0700

return requests properly

Diffstat:
Mindex.js | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/index.js b/index.js @@ -96,8 +96,9 @@ async function handle_request(req, res) { console.log(req.path) - if (req.path === "/") { + if (!req.path || req.path === "" || req.path === "/") { fs.readFile("index.gmi", (err, dat) => { + res.sendHeader(20, 'text/gemini') res.end(dat) }) return @@ -107,6 +108,7 @@ async function handle_request(req, res) if (indreq) { try { const gmi = await make_index_request(indreq[1], "/" + indreq[1]) + res.sendHeader(20, 'text/gemini') return res.end(gmi) } catch (e) { return res.notFound() @@ -122,6 +124,7 @@ async function handle_request(req, res) const url = host + "/" + slug + ".json" try { const gmi = await make_request(url, "/" + host) + res.sendHeader(20, 'text/gemini') return res.end(gmi) } catch (e) { return res.notFound()