diff --git a/com/isoterminal.js b/com/isoterminal.js index 4ce8e95..e72514e 100644 --- a/com/isoterminal.js +++ b/com/isoterminal.js @@ -11,25 +11,26 @@ * * > depends on [AFRAME.utils.require](com/require.js) * - * | property | type | default | info | - * |------------------|-----------|------------------------|------| - * | `iso` | `string` | https`//forgejo.isvery.ninja/assets/xrsh-buildroot/main/xrsh.iso" | | - * | `overlayfs` | `string` | '' | zip URL/file to autoextract on top of filesystem | - * | `width` | `number` | 800 || - * | `height` | `number` | 600 || - * | `depth` | `number` | 0.03 || - * | `lineHeight` | `number` | 18 || - * | `bootmenu` | `boolean` | true | give user choice [or boot straight into ISO ] | - * | `padding` | `number`` | 18 | | - * | `maximized` | `boolean` | false | | - * | `minimized` | `boolean` | false | | - * | `muteUntilPrompt`| `boolean` | true | mute stdout until a prompt is detected in ISO | - * | `HUD` | `boolean` | false | link to camera movement | - * | `transparent` | `boolean` | false | heavy, needs good gpu | - * | `memory` | `number` | 60 | VM memory (in MB) [NOTE` quest or smartphone webworker might crash > 40mb ] | - * | `bufferLatency` | `number` | 1 | in ms` bufferlatency from webworker to term (batch-update every char to texture) | - * | `debug` | `boolean` | false | | - * | `emulator` | `string` | fbterm | terminal emulator | + * | property | type | default | info | + * |-------------------|-----------|------------------------|------| + * | `iso` | `string` | https`//forgejo.isvery.ninja/assets/xrsh-buildroot/main/xrsh.iso" | | + * | `overlayfs` | `string` | '' | zip URL/file to autoextract on top of filesystem | + * | `width` | `number` | 800 || + * | `height` | `number` | 600 || + * | `depth` | `number` | 0.03 || + * | `lineHeight` | `number` | 18 || + * | `bootMenu` | `string` | "" | character to auto-enter in bootMenu | + * | `bootMenuURL` | `string` | "" | character to auto-enter in bootmeun when URL has fragment (#foo.zip e.g.) | + * | `padding` | `number`` | 18 | | + * | `maximized` | `boolean` | false | | + * | `minimized` | `boolean` | false | | + * | `muteUntilPrompt` | `boolean` | true | mute stdout until a prompt is detected in ISO | + * | `HUD` | `boolean` | false | link to camera movement | + * | `transparent` | `boolean` | false | heavy, needs good gpu | + * | `memory` | `number` | 60 | VM memory (in MB) [NOTE` quest or smartphone webworker might crash > 40mb ] | + * | `bufferLatency` | `number` | 1 | in ms` bufferlatency from webworker to term (batch-update every char to texture) | + * | `debug` | `boolean` | false | | + * | `emulator` | `string` | fbterm | terminal emulator | * * > for more info see [xrsh.isvery.ninja](https://xrsh.isvery.ninja) * @@ -75,7 +76,9 @@ if( typeof AFRAME != 'undefined '){ height: { type: 'number',"default": 600 }, depth: { type: 'number',"default": 0.03 }, lineHeight: { type: 'number',"default": 18 }, - bootmenu: { type: 'string', "default": 'show' }, // show bootmenu or autosend key to bootmenu (key '1' e.g.) + bootOnFragment: { type: 'string',"default": "nothing" }, + bootMenu: { type: 'string', "default": '' }, // show bootMenu if empty, or autosend key to bootMenu (key '1' e.g.) + bootMenuURL: { type: 'string', "default": '' }, // show bootMenu if empty, or autosend key to bootMenu (key '1' e.g.) padding: { type: 'number',"default": 18 }, maximized: { type: 'boolean',"default":false}, minimized: { type: 'boolean',"default":false}, diff --git a/com/isoterminal/ISOTerminal.js b/com/isoterminal/ISOTerminal.js index cd74ccf..e96672c 100644 --- a/com/isoterminal/ISOTerminal.js +++ b/com/isoterminal/ISOTerminal.js @@ -268,9 +268,7 @@ ISOTerminal.prototype.startVM = function(opts){ this.emit('status',msglib.loadmsg) this.emit('serial-output-string', msg) - if( this.opts.bootmenu == 'show'){ - this.emit('bootmenu',{}) - } + this.emit('bootMenu',{bootMenu: this.opts.bootMenu, bootMenuURL: this.opts.bootMenuURL }) } ISOTerminal.prototype.bootISO = function(){ diff --git a/com/isoterminal/feat/boot.js b/com/isoterminal/feat/boot.js index da92c63..8909337 100644 --- a/com/isoterminal/feat/boot.js +++ b/com/isoterminal/feat/boot.js @@ -4,15 +4,27 @@ ISOTerminal.addEventListener('ready', function(e){ 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 += `\n\r[36menter choice>[0m ` - this.send(msg) + const autobootURL = e.detail.bootMenuURL && document.location.hash.length > 1 + const autoboot = e.detail.bootMenu || autobootURL + if( !autoboot ){ + + alert("ja") + let msg = '\n\r' + this.boot.menu.map( (m) => { + msg += `\r[36m${m.key})[0m ${m.title(this.opts)}\n` + }) + msg += `\n\r[36menter choice>[0m ` + this.send(msg) + + }else{ // autoboot + if( this.term ){ + this.term.handler( e.detail.bootMenu || e.detail.bootMenuURL ) + this.term.handler("\n") + } + } } -ISOTerminal.addEventListener('bootmenu', function(e){ this.bootMenu() }) +ISOTerminal.addEventListener('bootMenu', function(e){ this.bootMenu(e) } ) ISOTerminal.prototype.boot = async function(e){ // set environment diff --git a/com/selfcontainer.js b/com/selfcontainer.js index 97169c8..3e69e63 100644 --- a/com/selfcontainer.js +++ b/com/selfcontainer.js @@ -47,8 +47,8 @@ AFRAME.registerComponent('selfcontainer', { cb(res) }else{ - // never cache requests to filesystem - if( request.url.match(/(^\/mnt\/)/) ) return cb(response) + // never cache requests to filesystem or zip/sh packages + if( request.url.match(/(^\/mnt\/|\.zip$|\.sh$)/) ) return cb(response) console.log("selfcontainer.js: caching "+request.url) if( response.text ){