summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-10-28 00:22:18 +0200
committertomsmeding <tom.smeding@gmail.com>2017-10-28 00:24:42 +0200
commit750b4a15499cb57918b67df9c27adfe9a7159bd8 (patch)
treed0789536a18c195a189e4d0422eb8376258c3775
parenteb42fcf1084ce2b083c066af43d2349308621eb1 (diff)
Add google ownership verification file thing
-rwxr-xr-xwebserver.js13
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");