From 8729493b181036c00db4f94777d38a4f2a8558bf Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Thu, 1 Feb 2018 20:13:28 +0100 Subject: Show index.html by default in /f --- webserver.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/webserver.js b/webserver.js index 1d618cc..549aebd 100755 --- a/webserver.js +++ b/webserver.js @@ -76,7 +76,7 @@ for(i=0;i",path) - .replace("[/*LISTINGLISTING*/]",JSON.stringify(items)) + .replace("",path) + .replace("[/*LISTINGLISTING*/]",JSON.stringify(items)) ); + } else if(stats.isDirectory()&&fs.readdirSync(fname).indexOf("index.html")!=-1){ + res.sendFile(node_path.join(fname,"index.html")); } else { res.status(404).send("That file does not exist."); return; @@ -132,16 +134,16 @@ app.get("/",function(req,res){ app.get(["/f/univq","/f/univq/*"],cmn.authgen()); app.get(["/f","/f/*"],function(req,res){ - requestFile(req,res,unescape(makeUrlSafe(req,2))); + requestFile(req,res,false,unescape(makeUrlSafe(req,2))); }); app.get(["/ff","/ff/*"],cmn.authgen()); app.get(["/ff","/ff/*"],function(req,res){ - requestFile(req,res,unescape(makeUrlSafe(req,3))); + requestFile(req,res,true,unescape(makeUrlSafe(req,3))); }); app.get("/.well-known/*",function(req,res){ - requestFile(req,res,"/well-known"+unescape(makeUrlSafe(req,12))); + requestFile(req,res,false,"/well-known"+unescape(makeUrlSafe(req,12))); }); app.get("/google*.html",function(req,res){ -- cgit v1.2.3-70-g09d2