improved unixy urls
This commit is contained in:
parent
9cded01543
commit
5261353fca
11 changed files with 67 additions and 12 deletions
|
|
@ -31,7 +31,7 @@ test -f /root/.boot || {
|
|||
|
||||
touch /root/.boot # make sure we run below once
|
||||
|
||||
# add menu items
|
||||
# add menu items https://xrsh.isvery.ninja/#Launcher%20menu
|
||||
find /root/.config/launcher -type f | while read item; do
|
||||
js '
|
||||
let term = document.querySelector("[isoterminal]").components.isoterminal.term
|
||||
|
|
@ -59,5 +59,7 @@ test -f /root/.boot || {
|
|||
# uncomment to set location (3D scene file [with XR Fragments] )
|
||||
#require https://xrfragment.org/index.glb
|
||||
#require https://coderofsalvation.github.io/xrsh-media/assets/background.glb
|
||||
#
|
||||
}
|
||||
|
||||
# auto-load /mnt/.env (if passed via AFRAME's isoterminal="overlayfs: boot.sh" e.g.
|
||||
test -f /mnt/.env && source /mnt/.env
|
||||
|
|
|
|||
|
|
@ -1,14 +1,53 @@
|
|||
#!/bin/sh
|
||||
source /etc/profile.sh
|
||||
|
||||
javascript='
|
||||
const isoterminal = document.querySelector("[isoterminal]").components.isoterminal.term
|
||||
isoterminal.save()
|
||||
return "[OK] xrsh state saved\n"
|
||||
'
|
||||
state(){
|
||||
javascript='
|
||||
const isoterminal = document.querySelector("[isoterminal]").components.isoterminal.term
|
||||
isoterminal.save()
|
||||
return "[OK] xrsh state saved\n"
|
||||
'
|
||||
|
||||
echo "[i] triggering ~/hook.d/save/* scripts"
|
||||
hook save
|
||||
echo "[i] warning: do not resize the browserwindow"
|
||||
echo "[i] please wait.."
|
||||
js "$javascript"
|
||||
exit
|
||||
}
|
||||
|
||||
echo "[i] triggering ~/hook.d/save/* scripts"
|
||||
hook save
|
||||
echo "[i] warning: do not resize the browserwindow"
|
||||
echo "[i] please wait.."
|
||||
js "$javascript"
|
||||
file(){
|
||||
javascript='
|
||||
|
||||
filename='$1'
|
||||
|
||||
function saveUint8Array(uint8Array, filename = 'download.bin', mimeType = 'application/octet-stream') {
|
||||
const blob = new Blob([uint8Array], { type: mimeType });
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
|
||||
// Programmatically trigger the click event
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
|
||||
// Clean up the URL object
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
let term = document.querySelector("[isoterminal]")
|
||||
term.emit("read_file", [filename, (str,buf) > saveUint8Array(buf, filename) )
|
||||
|
||||
return ""
|
||||
'
|
||||
hook save
|
||||
js "$javascript"
|
||||
exit
|
||||
}
|
||||
|
||||
test -z "$1" && state
|
||||
test -n "$1" && file
|
||||
echo "Usage: save [file] # pass no argument to save VM state to localStorage"
|
||||
|
|
|
|||
2
buildroot-v86/board/v86/rootfs_overlay/root/scene1/.env
Normal file → Executable file
2
buildroot-v86/board/v86/rootfs_overlay/root/scene1/.env
Normal file → Executable file
|
|
@ -1,2 +1,4 @@
|
|||
#!/bin/sh
|
||||
cd $(dirname $(readlink -f $0))
|
||||
echo "loading AFRAME glTF scene"
|
||||
cp index.html /root/index.html
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
echo "" > /root/index.html # cleanup
|
||||
2
buildroot-v86/board/v86/rootfs_overlay/root/scene2/.env
Normal file → Executable file
2
buildroot-v86/board/v86/rootfs_overlay/root/scene2/.env
Normal file → Executable file
|
|
@ -1,3 +1,5 @@
|
|||
#!/bin/sh
|
||||
cd $(dirname $(readlink -f $0))
|
||||
echo "loading THREE.js scene"
|
||||
echo "" > /root/index.html # empty scene
|
||||
cp index.js /root/index.js
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
echo "" > /root/index.html # empty scene
|
||||
cp cleanup.js /root/index.js
|
||||
3
buildroot-v86/board/v86/rootfs_overlay/root/scene2/cleanup.js
Executable file
3
buildroot-v86/board/v86/rootfs_overlay/root/scene2/cleanup.js
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
const ascene = AFRAME.scenes[0]
|
||||
const scene = ascene.object3D
|
||||
scene.getObjectByName("cube").remove()
|
||||
|
|
@ -4,6 +4,7 @@ const object = new THREE.Mesh(
|
|||
new THREE.BoxGeometry(1, 1, 1),
|
||||
new THREE.MeshBasicMaterial({ color: 0xff0000 })
|
||||
);
|
||||
object.name = "cube"
|
||||
object.position.set(0.3, 1.4, -0.4)
|
||||
object.scale.set(0.2,0.2,0.2)
|
||||
|
||||
|
|
|
|||
2
buildroot-v86/board/v86/rootfs_overlay/root/scene3/.env
Normal file → Executable file
2
buildroot-v86/board/v86/rootfs_overlay/root/scene3/.env
Normal file → Executable file
|
|
@ -1,2 +1,4 @@
|
|||
#!/bin/sh
|
||||
cd $(dirname $(readlink -f $0))
|
||||
echo "loading AFRAME demo scene"
|
||||
cp index.html /root/index.html
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
echo "" > /root/index.html # cleanup
|
||||
BIN
dist/v86-linux.iso
vendored
BIN
dist/v86-linux.iso
vendored
Binary file not shown.
Loading…
Add table
Reference in a new issue