diff options
author | tomsmeding <tom.smeding@gmail.com> | 2019-02-09 11:53:30 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2019-02-09 11:53:30 +0100 |
commit | 262f3b7b1a658f3cbe53936a57921f52e1842aed (patch) | |
tree | 9d0c26620b9ea3729121347cb531d4ec7088a79f /client.js | |
parent | 414de167bca501f11733daf2ff9bf662f5166a30 (diff) |
Notification instead of dialog box (1.0.1)
Diffstat (limited to 'client.js')
-rwxr-xr-x | client.js | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -4,9 +4,9 @@ var fs=require("fs"), path=require("path"), https=require("https"), crypto=require("crypto"), - dialog=require("dialog"), kbd=require("kbd"), - toClipboard=require("to-clipboard"); + toClipboard=require("to-clipboard"), + notifier=require("node-notifier"); var HOSTNAME=process.argv[2]||"tomsmeding.com",HTTPSPORT=443; console.log("Using server "+HOSTNAME); @@ -49,6 +49,13 @@ var ignored=[]; var currentState=[]; +function notify(message) { + notifier.notify({ + title: "serverstore", + message: message, + }); +} + //lots of code taken/modified from tomsmeding/gvajnez function collectDirState(dir){ if(!dir)dir=directory; @@ -141,7 +148,7 @@ function getchallenge(cb){ }); res.on("end",function(){ if(res.statusCode!=200){ - dialog.warn("Could not request challenge! Is your internet connection alive?\n\n"+body); + notify("Could not request challenge! Is your internet connection alive?\n"+body); return; } console.log("challenge = "+body); @@ -176,12 +183,12 @@ function sendfile(fname,retries){ res.on("end",function(){ if(res.statusCode!=200){ if(retries>0)sendfile(fname,retries-1); - else dialog.warn("Could not upload image! Are your credentials still okay?\n\n"+body); + else notify("Could not upload image! Are your credentials still okay?\n"+body); return; } console.log("Successful upload"); toClipboard.sync(body.trim()); - dialog.info(body+"\n(Copied to clipboard.)"); + notify("Uploaded, link copied"); try { fs.unlinkSync(fname); } catch(e){ |