add display sleep/awake to console

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
si458 2023-11-12 19:04:59 +00:00
parent d80a74b915
commit 08d5aef9c9
1 changed files with 16 additions and 1 deletions

View File

@ -3727,7 +3727,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
var response = null; var response = null;
switch (cmd) { switch (cmd) {
case 'help': { // Displays available commands 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'; } if (require('os').dns != null) { availcommands += ',dnsinfo'; }
try { require('linux-dhcp'); availcommands += ',dhcp'; } catch (ex) { } try { require('linux-dhcp'); availcommands += ',dhcp'; } catch (ex) { }
if (process.platform == 'win32') { if (process.platform == 'win32') {
@ -4874,6 +4874,21 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
} }
break; 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 case 'sendall': { // Send a message to all consoles on this mesh
sendConsoleText(args['_'].join(' ')); sendConsoleText(args['_'].join(' '));
break; break;