added remote keyboard bootmenu
This commit is contained in:
parent
16b8ab7122
commit
e36c56ffce
5 changed files with 118 additions and 75 deletions
|
|
@ -294,14 +294,15 @@ if( typeof AFRAME != 'undefined '){
|
|||
await AFRAME.utils.require(this.requires)
|
||||
|
||||
let features = { // ISOTerminal plugins
|
||||
boot: "com/isoterminal/feat/boot.js",
|
||||
javascript: "com/isoterminal/feat/javascript.js",
|
||||
jsconsole: "com/isoterminal/feat/jsconsole.js",
|
||||
indexhtml: "com/isoterminal/feat/index.html.js",
|
||||
indexjs: "com/isoterminal/feat/index.js.js",
|
||||
autorestore: "com/isoterminal/feat/autorestore.js",
|
||||
pastedropFeat: "com/isoterminal/feat/pastedrop.js",
|
||||
httpfs: "com/isoterminal/feat/httpfs.js",
|
||||
boot: "com/isoterminal/feat/boot.js",
|
||||
javascript: "com/isoterminal/feat/javascript.js",
|
||||
jsconsole: "com/isoterminal/feat/jsconsole.js",
|
||||
remotekeyboard: "com/isoterminal/feat/remotekeyboard.js",
|
||||
indexhtml: "com/isoterminal/feat/index.html.js",
|
||||
indexjs: "com/isoterminal/feat/index.js.js",
|
||||
autorestore: "com/isoterminal/feat/autorestore.js",
|
||||
pastedropFeat: "com/isoterminal/feat/pastedrop.js",
|
||||
httpfs: "com/isoterminal/feat/httpfs.js",
|
||||
}
|
||||
if( this.data.emulator == 'fbterm' ){
|
||||
features['fbtermjs'] = "com/isoterminal/term.js"
|
||||
|
|
|
|||
|
|
@ -216,26 +216,24 @@ ISOTerminal.prototype.getLoaderMsg = function(){
|
|||
]
|
||||
|
||||
let motd = `
|
||||
\r[38;5;57m . . ____ _____________ ________. ._. ._. . .
|
||||
\r[38;5;93m . . .\\ \\/ /\\______ \\/ _____// | \\. .
|
||||
\r[38;5;93m . . . \\ / | _/\\_____ \\/ ~ \\ .
|
||||
\r[38;5;129m . . . / \\ | | \\/ \\ Y / .
|
||||
\r[38;5;165m . . ./___/\\ \\ |____|_ /_______ /\\___|_ /. .
|
||||
\r[38;5;201m . . . . . .\\_/. . . . \\/ . . . .\\/ . . _ \\/ . .
|
||||
\r[38;5;165m ▬▬▬▬▬▬▬▬ [38;5;51mhttps://xrsh.isvery.ninja[38;5;165m ▬▬▬▬▬▬▬▬▬▬▬▬
|
||||
\r[38;5;165m local-first, polyglot, unixy WebXR IDE & runtime
|
||||
\r[38;5;57m. . ____ _____________ ________. ._. ._. . .
|
||||
\r[38;5;93m. . .\\ \\/ /\\______ \\/ _____// | \\. .
|
||||
\r[38;5;93m. . . \\ / | _/\\_____ \\/ ~ \\ .
|
||||
\r[38;5;129m. . . / \\ | | \\/ \\ Y / .
|
||||
\r[38;5;165m. . ./___/\\ \\ |____|_ /_______ /\\___|_ /. .
|
||||
\r[38;5;201m. . . . . .\\_/. . . . \\/ . . . .\\/ . . _ \\/ . .
|
||||
\r[38;5;165m▬▬▬▬▬▬▬▬ [38;5;51mhttps://xrsh.isvery.ninja[38;5;165m ▬▬▬▬▬▬▬▬▬▬▬▬
|
||||
\r[38;5;165mlocal-first, polyglot, unixy WebXR IDE & runtime
|
||||
\r[38;5;57m
|
||||
\r credits
|
||||
\r -------
|
||||
\r @nlnet@nlnet.nl
|
||||
\r @lvk@mastodon.online
|
||||
\r @utopiah@mastodon.pirateparty.be [38;5;51m
|
||||
\r https://www.w3.org/TR/webxr
|
||||
\r https://xrfragment.org
|
||||
\r https://threejs.org
|
||||
\r https://aframe.org
|
||||
\r https://busybox.net
|
||||
\r https://buildroot.org
|
||||
\rcredits
|
||||
\r-------
|
||||
\r[38;5;51mhttps://www.w3.org/TR/webxr
|
||||
\rhttps://xrfragment.org
|
||||
\rhttps://threejs.org
|
||||
\rhttps://aframe.org
|
||||
\rhttps://busybox.net
|
||||
\rhttps://buildroot.org
|
||||
\rfediverse: @lvk@mastodon.online @utopiah@mastodon.pirateparty.be @nlnet@nlnet.nl
|
||||
\r`
|
||||
|
||||
const text_color = "\r[38;5;129m"
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ ISOTerminal.prototype.bootMenu = function(e){
|
|||
this.boot.menu.selected = false // reset
|
||||
let msg = '\n\r'
|
||||
this.boot.menu.map( (m) => {
|
||||
msg += `\r[36m ${m.key})[0m ${m.title(this.opts)}\n`
|
||||
msg += `\r[36m${m.key})[0m ${m.title(this.opts)}\n`
|
||||
})
|
||||
if( this.boot.menu.length ) msg += `\n\r enter choice> `
|
||||
msg += `\n\r[36menter choice>[0m `
|
||||
this.send(msg)
|
||||
}
|
||||
|
||||
|
|
@ -51,49 +51,3 @@ if( typeof window.PromiseWorker != 'undefined' ){ // if xrsh v86 is able to run
|
|||
)
|
||||
}
|
||||
|
||||
// REPL: jsconsole
|
||||
ISOTerminal.prototype.boot.menu.push(
|
||||
{
|
||||
key: "j",
|
||||
title: (opts) => "just give me an javascript-console in WebXR instantly",
|
||||
init: function(){
|
||||
this.prompt = "\r[36m>[0m "
|
||||
this.emit('enable-console',{stdout:true})
|
||||
this.emit('status',"javascript console")
|
||||
this.console = ""
|
||||
setTimeout( () => {
|
||||
this.send(this.prompt)
|
||||
}, 100 )
|
||||
},
|
||||
keyHandler: function(ch){
|
||||
let erase = false
|
||||
if( ch == '\x7F' ){
|
||||
ch = "\b \b" // why does write() not just support \x7F ?
|
||||
erase = true
|
||||
}
|
||||
this.send(ch)
|
||||
const reset = () => {
|
||||
this.console = ""
|
||||
setTimeout( () => {
|
||||
if( this.boot.menu.selected ) this.send(this.prompt)
|
||||
},100)
|
||||
}
|
||||
if( (ch == "\n" || ch == "\r") ){
|
||||
try{
|
||||
this.send("\n\r")
|
||||
if( this.console ) eval(this.console)
|
||||
reset()
|
||||
}catch(e){
|
||||
reset()
|
||||
throw e // re throw
|
||||
}
|
||||
}else{
|
||||
if( erase ){
|
||||
this.console = this.console.split('').slice(0,-1).join('')
|
||||
}else{
|
||||
this.console += ch
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -79,4 +79,52 @@ ISOTerminal.addEventListener('init', function(){
|
|||
this.addEventListener('enable-console', function(opts){
|
||||
this.enableConsole(opts.detail)
|
||||
})
|
||||
|
||||
// REPL: jsconsole
|
||||
ISOTerminal.prototype.boot.menu.push(
|
||||
{
|
||||
key: "j",
|
||||
title: (opts) => "just give me an javascript-console in WebXR instantly",
|
||||
init: function(){
|
||||
this.prompt = "\r[36m>[0m "
|
||||
this.emit('enable-console',{stdout:true})
|
||||
this.emit('status',"javascript console")
|
||||
this.console = ""
|
||||
setTimeout( () => {
|
||||
this.send(this.prompt)
|
||||
}, 100 )
|
||||
},
|
||||
keyHandler: function(ch){
|
||||
let erase = false
|
||||
if( ch == '\x7F' ){
|
||||
ch = "\b \b" // why does write() not just support \x7F ?
|
||||
erase = true
|
||||
}
|
||||
this.send(ch)
|
||||
const reset = () => {
|
||||
this.console = ""
|
||||
setTimeout( () => {
|
||||
if( this.boot.menu.selected ) this.send(this.prompt)
|
||||
},100)
|
||||
}
|
||||
if( (ch == "\n" || ch == "\r") ){
|
||||
try{
|
||||
this.send("\n\r")
|
||||
if( this.console ) eval(this.console)
|
||||
reset()
|
||||
}catch(e){
|
||||
reset()
|
||||
throw e // re throw
|
||||
}
|
||||
}else{
|
||||
if( erase ){
|
||||
this.console = this.console.split('').slice(0,-1).join('')
|
||||
}else{
|
||||
this.console += ch
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
})
|
||||
|
|
|
|||
42
com/isoterminal/feat/remotekeyboard.js
Normal file
42
com/isoterminal/feat/remotekeyboard.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
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("[2J\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[36m$[0m wget https://xrsh.isvery.ninja/xrsh\n\r")
|
||||
this.send("\t[36m$[0m chmod +x xrsh\n\r")
|
||||
this.send("\t[36m$[0m ./xrsh --keyboard\n\r\n\r")
|
||||
this.send("\t[36mNOTE:[0m 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()
|
||||
})
|
||||
|
||||
Loading…
Add table
Reference in a new issue