Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
require("clipboard").read().then(function (str) {
if (str) {
MeshServerLog('Getting clipboard content, ' + str.length + ' byte(s)', data);
mesh.SendCommand({ "action": "msg", "type": "getclip", "sessionid": data.sessionid, "data": str });
}
});
}
break;
}
case 'setclip': {
// Set the load clipboard to a user value
//sendConsoleText('setClip: ' + JSON.stringify(data));
if (typeof data.data == 'string') {
MeshServerLog('Setting clipboard content, ' + data.data.length + ' byte(s)', data);
if (typeof data.data == 'string') {
if (require('MeshAgent').isService) { require('clipboard').dispatchWrite(data.data); } else { require("clipboard")(data.data); } // Set the clipboard
mesh.SendCommand({ "action": "msg", "type": "setclip", "sessionid": data.sessionid, "success": true });
}
}
break;
}
default:
// Unknown action, ignore it.
break;
}
break;
}
case 'acmactivate': {
if (amt != null) {
MeshServerLog('Attempting Intel AMT ACM mode activation', data);
amt.setAcmResponse(data);
}
case 'log':
if (args['_'].length != 1) { response = 'Proper usage: log "sample text"'; } else { MeshServerLog(args['_'][0]); response = 'ok'; }
break;
case 'getclip':
if (require('MeshAgent').isService) {
require('clipboard').dispatchRead().then(function (str) { sendConsoleText(str, sessionid); });
} else {
require("clipboard").read().then(function (str) { sendConsoleText(str, sessionid); });
}
break;
case 'setclip': {
if (args['_'].length != 1) {
response = 'Proper usage: setclip "sample text"';
} else {
if (require('MeshAgent').isService) {
require('clipboard').dispatchWrite(args['_'][0]);
response = 'Setting clipboard to: "' + args['_'][0] + '"';
}
else {
require("clipboard")(args['_'][0]); response = 'Setting clipboard to: "' + args['_'][0] + '"';
}
}
break;
}
case 'amtreset': {
if (amt != null) { amt.reset(); response = 'Done.'; }
break;
}
case 'amtlmsreset': {
if (amt != null) { amt.lmsreset(); response = 'Done.'; }
break;
}