xrsh-com/com/isoterminal/feat/remotekeyboard.js

43 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

ISOTerminal.prototype.enableRemoteKeyboard = function(opts){
// initialize REPL
ISOTerminal.prototype.boot.menu.push(
{
key: "k",
title: (opts) => "connect a remote keyboard",
init: function( mainmenu ){
this.emit('status',"")
this.emit('enable-console',{stdout:true})
setTimeout( () => {
this.send("\n\r1. open a terminal on your laptop/desktop\n\r")
this.send("2. run (or install) the keyboard forwarder:\n\n\r")
this.send("\t$ wget https://xrsh.isvery.ninja/xrsh\n\r")
this.send("\t$ chmod +x xrsh\n\r")
this.send("\t$ ./xrsh --keyboard\n\r\n\r")
this.send("\tNOTE: windows-users need WSL\n\n\r")
this.send("press a key to connect.. (or 'm' for mainmenu)\n\r")
}, 100 )
},
keyHandler: function(ch){
this.send(ch)
if( ch == 'm'){
this.bootMenu()
}else if( (ch == "\n" || ch == "\r") ){
try{
console.log("running websocket server")
this.send("\n\r")
}catch(e){
reset()
throw e // re throw
}
}
}
}
)
}
ISOTerminal.addEventListener('init', function(){
this.enableRemoteKeyboard()
})