From 08d5aef9c9bb381ff5168106586c7808e86f70cb Mon Sep 17 00:00:00 2001 From: si458 Date: Sun, 12 Nov 2023 19:04:59 +0000 Subject: [PATCH] add display sleep/awake to console Signed-off-by: si458 --- agents/meshcore.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/agents/meshcore.js b/agents/meshcore.js index 4f27cdcd..9bd7f582 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -3727,7 +3727,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) { var response = null; switch (cmd) { case 'help': { // Displays available commands - var fin = '', f = '', availcommands = 'domain,translations,agentupdate,errorlog,msh,timerinfo,coreinfo,coredump,service,fdsnapshot,fdcount,startupoptions,alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,wslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,openurl,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,wallpaper,agentmsg,task,uninstallagent'; + var fin = '', f = '', availcommands = 'domain,translations,agentupdate,errorlog,msh,timerinfo,coreinfo,coredump,service,fdsnapshot,fdcount,startupoptions,alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,wslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,openurl,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,wallpaper,agentmsg,task,uninstallagent,display'; if (require('os').dns != null) { availcommands += ',dnsinfo'; } try { require('linux-dhcp'); availcommands += ',dhcp'; } catch (ex) { } if (process.platform == 'win32') { @@ -4874,6 +4874,21 @@ function processConsoleCommand(cmd, args, rights, sessionid) { } break; } + case 'display': { + if (args['_'].length != 1) { + response = 'Proper usage: display (sleep | awake)".'; + } else { + var sleepawake = [args['_'][0]]; + if(sleepawake=='sleep'){ + require('power-monitor').sleepDisplay() + }else if(sleepawake=='awake'){ + require('power-monitor').wakeDisplay() + + } + response = 'Setting Display To ' + sleepawake; + } + break; + } case 'sendall': { // Send a message to all consoles on this mesh sendConsoleText(args['_'].join(' ')); break;