diff options
author | tomsmeding <hallo@tomsmeding.nl> | 2015-12-18 23:45:33 +0100 |
---|---|---|
committer | tomsmeding <hallo@tomsmeding.nl> | 2015-12-18 23:45:33 +0100 |
commit | 29e461d2b0cdd1b0fa867c4f4b902d393610b909 (patch) | |
tree | ccb789b433769ef600d4a54af3a018bfa9c15954 | |
parent | a90e6e162b910d16320ddbc08f49cff636f4d186 (diff) |
improvements
-rwxr-xr-x | client.js | 15 | ||||
-rw-r--r-- | client.out | 7 | ||||
-rw-r--r-- | package.json | 4 | ||||
-rwxr-xr-x | serverstore.js | 2 |
4 files changed, 21 insertions, 7 deletions
@@ -83,8 +83,10 @@ function handleChanges(changes){ if(!namedate)continue; changes[i].mtime=new Date(changes[i].mtime); now=new Date(); - if((now-changes[i].mtime)/1000>15||(now-namedate)/1000>15)continue; //15 seconds limit - sendfile(changes[i].name); + if((now-changes[i].mtime)/1000>60||(now-namedate)/1000>60)continue; //1 minute limit + setTimeout(function(n){ + return function(){sendfile(n);}; + }(changes[i].name),100); } } @@ -151,7 +153,11 @@ function sendfile(fname,retries){ } } console.log("Successful upload"); - fs.unlink(fname); //not sync, take your time + setTimeout(function(){ + fs.unlink(fname,function(err){ //not sync, take your time + if(err)console.log(err); + }); + },200); toClipboard.sync(body.trim()); dialog.info(body+"\n(Copied to clipboard.)"); }); @@ -159,7 +165,8 @@ function sendfile(fname,retries){ req.on("error",function(err){ console.log(err); }); - req.end(fs.readFileSync(fname)); + try{req.end(fs.readFileSync(fname));} + catch(e){console.log(e);} }); } diff --git a/client.out b/client.out new file mode 100644 index 0000000..daa1b0a --- /dev/null +++ b/client.out @@ -0,0 +1,7 @@ +Using server tomsmeding.nl +Username? Password? +Checking existence... +-- (Client ready.) +Going to request challenge... +challenge = 3bd65bd35376f5091c671c7293030095fcb3b4153f4bf34ffaabac6a60e0e867 +User login ok. diff --git a/package.json b/package.json index 6000b2b..cd159d2 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,12 @@ "url": "https://github.com/tomsmeding/serverstore" }, "dependencies": { - "body-parser": "^1.13.3", + "body-parser": "^1.14.1", "dialog": "^0.1.8", "express": "^4.13.3", "glob": "^5.0.15", "kbd": "^0.1.0", - "node-persist": "^0.0.6", + "node-persist": "0.0.8", "to-clipboard": "^0.2.0" }, "devDependencies": {}, diff --git a/serverstore.js b/serverstore.js index e95a1ec..b24af20 100755 --- a/serverstore.js +++ b/serverstore.js @@ -124,7 +124,7 @@ app.get("/exists/:reguserid",function(req,res){ }); app.get("/checklogin/:userid/:authhash",function(req,res){ - res.sendStatus(200); + res.sendStatus(200); //login checking is done in the authhash param res.end(); }); |