diff options
-rwxr-xr-x | webserver.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/webserver.js b/webserver.js index 3815e42..e4fa02a 100755 --- a/webserver.js +++ b/webserver.js @@ -78,7 +78,7 @@ function requestFile(req,res,path){ fname=cmn.rootdir+"/web_files"+path; console.log("Requesting file "+fname); if(!fs.existsSync(fname)){ - res.send("That file does not exist."); + res.status(404).send("That file does not exist."); return; } var stats=fs.statSync(fname); @@ -105,7 +105,7 @@ function requestFile(req,res,path){ .replace("[/*LISTINGLISTING*/]",JSON.stringify(items)) ); } else { - res.send("That file does not exist."); + res.status(404).send("That file does not exist."); return; } } @@ -142,6 +142,15 @@ app.get("/.well-known/*",function(req,res){ requestFile(req,res,"/well-known"+unescape(makeUrlSafe(req,12))); }); +app.get("/google*.html",function(req,res){ + var url=unescape(makeUrlSafe(req,0)); + if(url.match(/^\/google[0-9a-fA-F]*\.html$/)){ + res.sendFile(__dirname+url); + } else { + res.status(404).send("That file does not exist."); + } +}); + ["o","k","rip","rip2"].forEach(function(target){ app.get("/"+target,function(req,res){ res.sendFile(cmn.rootdir+"/web_files/"+target+".html"); |