From 750b4a15499cb57918b67df9c27adfe9a7159bd8 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sat, 28 Oct 2017 00:22:18 +0200 Subject: Add google ownership verification file thing --- webserver.js | 13 +++++++++++-- 1 file 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"); -- cgit v1.2.3-70-g09d2