codemirror pkg + fs/THREE.js

This commit is contained in:
Leon van Kammen 2024-12-30 09:47:23 +01:00
parent 301cad8398
commit dc3fe69bc8
8 changed files with 77 additions and 4 deletions

View File

@ -26,7 +26,7 @@
::sysinit:/etc/init.d/rcS ::sysinit:/etc/init.d/rcS
# Put a getty on the serial port # Put a getty on the serial port
console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL #console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL
#console::respawn:-/bin/sh # vga console #console::respawn:-/bin/sh # vga console
# Auto-login as root on ttyS0 # Auto-login as root on ttyS0

View File

@ -56,8 +56,9 @@ test -d /dev/browser || {
} }
setup_mounts(){ setup_mounts(){
mkdir /mnt/helloworld mkdir /mnt/helloworld /mnt/THREE
fusescript /root/fs/helloworld /mnt/helloworld fusescript /root/fs/helloworld /mnt/helloworld
fusescript /root/fs/THREE.js /mnt/THREE
} }
modprobe fuse # load fuse modprobe fuse # load fuse

View File

@ -9,6 +9,11 @@ alias make="mim"
# minimalist autoenv version [https://github.com/hyperupcall/autoenv] # minimalist autoenv version [https://github.com/hyperupcall/autoenv]
cd(){ cd(){
dir_cur=$(pwd)
ignore=0
test "${dir_cur:0:4}" = /mnt && ignore=1
test "${1:0:4}" = /mnt && ignore=1
test "$ignore" = 1 && { command cd ${1:+"$@"}; return 1; }
test -f $(pwd)/.env.leave && source $(pwd)/.env.leave # cleanup environment test -f $(pwd)/.env.leave && source $(pwd)/.env.leave # cleanup environment
command cd ${1:+"$@"} && { command cd ${1:+"$@"} && {
hook cd "$@" hook cd "$@"

View File

@ -2,3 +2,6 @@
msg = args.join(' ') msg = args.join(' ')
console.log(msg) console.log(msg)
//alert(msg) //alert(msg)
const term = document.querySelector('[isoterminal]').components.isoterminal.term
term.exec("logger bin/helloworld.js "+msg)

View File

@ -0,0 +1,64 @@
#!/bin/js
// Function to handle getattr command
function getattr(path,obj) {
let size = 1
if (path === '/' || path.match(/\/[0-9]+$/) ) {
return "16877 2 1000 1000 4096 8\n"
} else {
return `33188 1 1000 1000 ${size} 1\n`
}
return ''
}
function getPath(str){
const scene = document.querySelector('a-scene').object3D
const path = str.split("/")
const name = path.pop()
const parent = path.pop()
let obj = name == ""
? scene
: scene.getObjectById( parseInt(name.substr(1)) )
const propvalue = ""
if( obj && obj[ name ] ) propvalue = obj[name]
return {obj,propname:name,propvalue}
}
// Main function to handle commands
function main(args) {
console.log( 'fs/THREE '+args.join(' ') )
let children = ''
let props = ['name','uuid','position','rotation']
switch (args[0]) {
case 'readdir':{
const {obj,propvalue,propname} = getPath( args[1] )
if( obj && obj.children ){
children = obj.children.map( (n) => n.name || n.id )
.join("\n")
}
return `${children}\n${props.join('\n')}\n`
break;
}
case 'getattr':{
const {obj,propvalue,propname} = getPath( args[1] )
return getattr(args[1],{args,obj,propvalue,propname});
break;
}
case 'read':{
const {propvalue,propname} = getPath( args[1] )
return propvalue;
break;
}
default:
return ''
}
}
// Run the main function
return main(args.slice(1));

View File

@ -5,4 +5,4 @@ me="$(dirname $(readlink -f $0))"
file="$(readlink -f "$1")" file="$(readlink -f "$1")"
$me/codemirror.js "$file" $me/codemirror.js "$file"
echo "press ctrl-X to exit editor" echo "press ctrl-Q to exit editor"

View File

@ -88,7 +88,7 @@ AFRAME.registerComponent('codemirror', {
}) })
this.editor.setOption("theme", "shadowfox") this.editor.setOption("theme", "shadowfox")
this.editor.setOption("extraKeys", { this.editor.setOption("extraKeys", {
"Ctrl-X": (cm) => { "Ctrl-Q": (cm) => {
this.el.emit('close',true) // window.js will react accordingly this.el.emit('close',true) // window.js will react accordingly
} }
}) })

BIN
dist/v86-linux.iso vendored

Binary file not shown.