From 262f3b7b1a658f3cbe53936a57921f52e1842aed Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sat, 9 Feb 2019 11:53:30 +0100 Subject: Notification instead of dialog box (1.0.1) --- client.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'client.js') diff --git a/client.js b/client.js index 7fd765c..5313b0a 100755 --- a/client.js +++ b/client.js @@ -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){ -- cgit v1.2.3-54-g00ecf