diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/changes/changes.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/changes/changes.js b/modules/changes/changes.js index c3f24af..c923741 100644 --- a/modules/changes/changes.js +++ b/modules/changes/changes.js @@ -158,6 +158,35 @@ module.exports=function(app,io,_moddir){ persist.setItemSync("urls",urls); res.send(); }); + app.delete("/changes/url/delete",function(req,res){ + var param; + try {param=JSON.parse(req.body);} + catch(e){ + res.status(400); + res.send("Invalid JSON sent"); + } + var url=param.url; + var todate=new Date(param.todate); + if(!urls[url]){ + res.status(404); + res.send("URL not found in watch list"); + return; + } + if(todate.getTime()==NaN){ + res.status(400); + res.send("Invalid time sent"); + } + var tl=urls[url].timeline; + var i; + for(i=0;i<tl.length;i++){ + if(tl[i][0]<=todate){ + tl.splice(i,1); + i--; + } + } + res.status(200); + res.send(); + }); app.post("/changes/refresh",function(req,res){ refreshURLs(); res.send(); |