updated for remotestorage
This commit is contained in:
parent
bbe1cf10ee
commit
ff80d2fb9e
14 changed files with 65 additions and 28 deletions
BIN
buildroot-v86/board/v86/rootfs_overlay/bin/zip
Executable file
BIN
buildroot-v86/board/v86/rootfs_overlay/bin/zip
Executable file
Binary file not shown.
|
|
@ -35,11 +35,12 @@ help_tips(){
|
|||
echo '----'
|
||||
echo 'text editors ' "type '<cm|vi|mg|nano> <textfile>'"
|
||||
echo 'programming languages ' "type 'ls ~/bin/helloworld*'"
|
||||
echo 'run 64bit linux app ' "type 'blink <x86_64 binary>'"
|
||||
echo 'upload file to xrsh ' "type 'upload <file>'"
|
||||
echo 'download file locally ' "type 'download <file>'"
|
||||
echo 'paste text ' "ctrl/cmd+shift+v'"
|
||||
echo 'paste text to file ' "ctrl/cmd+v'"
|
||||
echo 'import file to scene ' "drag-drop file or ctrl/cmd+v or type 'upload'"
|
||||
echo 'import remote URL ' "type 'require <https://xrfragment.org/index.glb>'"
|
||||
echo 'import remote URL ' "type 'require https://xrfragment.org/index.glb'"
|
||||
echo 'reset scene & shell ' "type 'reset'"
|
||||
echo 'js run ' "type 'js 'alert(\"hello\")'"
|
||||
echo 'js console.log: ' "type 'console document.baseURI"
|
||||
|
|
@ -47,7 +48,6 @@ help_tips(){
|
|||
echo 'js inspect: ' "type 'js \"return document.baseURI\"'"
|
||||
echo 'js capture console: ' "type 'tail -f /dev/browser/console'"
|
||||
echo 'js<->filesystem hooks:' "type 'see [executable] files in ~/hook.d'"
|
||||
echo 'include file into page' "type 'require <url.js|css>'"
|
||||
echo 'say something ' "type 'say hello'"
|
||||
echo ''
|
||||
echo 'type "help" or "man xrsh" to read the full manual'
|
||||
|
|
|
|||
|
|
@ -32,19 +32,7 @@ test -f /root/.boot || {
|
|||
touch /root/.boot # make sure we run below once
|
||||
|
||||
# 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
|
||||
launcher.register({
|
||||
name: "'$(basename $item)'",
|
||||
cb: () => term.exec("'$item'")
|
||||
})
|
||||
return "'$item'"
|
||||
'
|
||||
done > /tmp/log
|
||||
|
||||
# get latest xrfragments to support interactive models
|
||||
require https://xrfragment.org/dist/xrfragment.aframe.js
|
||||
/root/bin/launcher init
|
||||
|
||||
# start index.js if /dev/browser/js filesize is not great than 0
|
||||
if [ ! -s /dev/browser/js ]; then
|
||||
|
|
|
|||
19
buildroot-v86/board/v86/rootfs_overlay/root/bin/launcher
Executable file
19
buildroot-v86/board/v86/rootfs_overlay/root/bin/launcher
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
init(){
|
||||
|
||||
# add menu items https://xrsh.isvery.ninja/#Launcher%20menu
|
||||
{ find /root/.config/launcher -type f; find /root/.config/launcher -type l; } | while read item; do
|
||||
js '
|
||||
let term = document.querySelector("[isoterminal]").components.isoterminal.term
|
||||
launcher.register({
|
||||
name: "'$(basename $item)'",
|
||||
cb: () => term.emit("exec",["'$item'"])
|
||||
})
|
||||
return "'$item'"
|
||||
'
|
||||
done > /tmp/log
|
||||
|
||||
}
|
||||
|
||||
"$@"
|
||||
|
|
@ -4,8 +4,8 @@ source /etc/profile.sh
|
|||
state(){
|
||||
javascript='
|
||||
const isoterminal = document.querySelector("[isoterminal]").components.isoterminal.term
|
||||
isoterminal.save()
|
||||
return "[OK] xrsh state saved\n"
|
||||
isoterminal.save({'$1':true})
|
||||
return "\n"
|
||||
'
|
||||
|
||||
echo "[i] triggering ~/hook.d/save/* scripts"
|
||||
|
|
@ -16,6 +16,9 @@ state(){
|
|||
exit
|
||||
}
|
||||
|
||||
test -z "$1" && state
|
||||
echo "Usage: save"
|
||||
echo "it saves VM state to localStorage"
|
||||
test -n "$1" && state "$1"
|
||||
test -z "$1" && {
|
||||
echo "Usage: save [localstorage|remotestorage]"
|
||||
echo ""
|
||||
echo "save VM (filesystem) to local (=default) or remotestorage"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
infinite inotifyd echo /root | awk '
|
||||
exec inotifyd echo /root /root/.config/launcher | awk '
|
||||
|
||||
# listen for writes to rootdir and send them to DOM
|
||||
/^[wne] \/root index\.html/ { system("cat "$2"/"$3" | grep -vE \"^#!\" > /dev/browser/html") }
|
||||
/^[wne] \/root index\.js/ { system("cat "$2"/"$3" | grep -vE \"^#!\" > /dev/browser/js") }
|
||||
/^[wne] \/root index\.html/ { system("cat "$2"/"$3" | grep -vE \"^#!\" > /dev/browser/html") }
|
||||
/^[wne] \/root index\.js/ { system("cat "$2"/"$3" | grep -vE \"^#!\" > /dev/browser/js") }
|
||||
/^[wne] \/root\/.config\/launcher/ { system("/root/bin/launcher init") }
|
||||
/.*/ { system("logger "$0) }
|
||||
|
||||
'
|
||||
|
|
|
|||
13
buildroot-v86/board/v86/rootfs_overlay/root/default.html
Executable file
13
buildroot-v86/board/v86/rootfs_overlay/root/default.html
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/html
|
||||
<a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9"></a-box>
|
||||
<a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
|
||||
<a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
|
||||
<a-plane position="0 0.05 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
|
||||
|
||||
<!--
|
||||
<a-box position="0 1.4 -0.5" scale="0.2 0.2 0.2" color="#FF00AA" grabbable></a-box>
|
||||
-->
|
||||
|
||||
|
||||
<!-- for [lowerlevel] THREE.js code see ~/index.js -->
|
||||
|
||||
|
|
@ -6,6 +6,11 @@ if [[ "$1" =~ "pos=|t=" ]]; then
|
|||
echo "[.] detected Media/XR Fragment in URI"
|
||||
fi
|
||||
|
||||
if [[ "$1" =~ "access_token=" ]]; then
|
||||
# remotestorage redirect oAuth
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "$1" =~ "zip$" ]]; then
|
||||
echo "[.] detected XRSH zip package in URL"
|
||||
echo "[.] fetching $1"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
# launcher init
|
||||
/root/bin/launcher init &
|
||||
|
||||
# intialize global funcs
|
||||
/root/index.js &> /dev/null
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,13 @@ Currently the following languages are supported:
|
|||
* nano (busybox nano)
|
||||
* mg (microemacs)
|
||||
|
||||
# Autoboot
|
||||
|
||||
To skip the bootmenu you can provide a bootoption via the URL:
|
||||
|
||||
* autoboot the ISO: http://xrsh.isvery.ninja/src/index.html#1
|
||||
* autoboot and run `date` cmd: http://localhost:8080/src/index.html#1&date
|
||||
|
||||
# Multiple terminals [GNU screen]
|
||||
|
||||
## From the cmdline
|
||||
|
|
|
|||
|
|
@ -13,5 +13,6 @@ else
|
|||
fi
|
||||
|
||||
$me/codemirror.js "$file" $2 $3 $4
|
||||
echo "NOTE: codemirror can only edit files in /mnt (for now)"
|
||||
echo "press ctrl-Q to exit editor"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#!/bin/sh
|
||||
cd $(dirname $(readlink -f $0))
|
||||
echo "loading AFRAME glTF scene"
|
||||
cp index.html /root/index.html
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#!/bin/sh
|
||||
cd $(dirname $(readlink -f $0))
|
||||
echo "loading THREE.js scene"
|
||||
echo "" > /root/index.html # empty scene
|
||||
cp index.js /root/index.js
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#!/bin/sh
|
||||
cd $(dirname $(readlink -f $0))
|
||||
echo "loading AFRAME demo scene"
|
||||
cp index.html /root/index.html
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue