added zipfile dragdrop
This commit is contained in:
parent
90693459a5
commit
2d468b8411
8 changed files with 132 additions and 76 deletions
|
|
@ -3,6 +3,7 @@ Welcome to XRSH
|
|||
Please hook up your (bluetooth) keyboard to use xrsh.
|
||||
Use [38;5;129mCtrl+a+0/1/2/3/..[38;5;165m to switch terminals.
|
||||
Use [38;5;129mCtrl+a+c[38;5;165m to create a new terminal.
|
||||
Use [38;5;129m'save'[38;5;165m to save session (survives tab-close)
|
||||
Type [38;5;129m'save'[38;5;165m to save session (survives tab-close)
|
||||
Type [38;5;129m'help_tips'[38;5;165m for tips
|
||||
Happy hacking! \o/
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
export HOME=/root
|
||||
export PATH=$PATH:/etc:~/bin
|
||||
export PATH=~/bin:$PATH:/etc
|
||||
|
||||
# source URL data from v86 (file created by v86 during boot)
|
||||
test -f /mnt/profile.browser && source /mnt/profile.browser
|
||||
|
|
@ -33,13 +33,16 @@ help_tips(){
|
|||
echo 'text editors ' "type '<vi|mg|nano> <textfile>'"
|
||||
echo 'programming languages ' "type 'ls ~/bin/helloworld*'"
|
||||
echo 'run 64bit linux app ' "type 'blink <x86_64 binary>'"
|
||||
echo 'paste text ' "ctrl/cmd+shift+v'"
|
||||
echo 'paste text to file ' "ctrl/cmd+v'"
|
||||
echo 'import file to scene ' "drag-drop or ctrl/cmd+v'"
|
||||
echo 'reset scene & shell ' "type 'reset'"
|
||||
echo 'js run ' "type 'js 'alert(\"hello\")'"
|
||||
echo 'js console.log: ' "type 'console document.baseURI"
|
||||
echo 'js function as cmd: ' "type 'alias $1=\"jsh $1\"' to run '$1 yo' as $1('yo')"
|
||||
echo 'js inspect: ' "type 'js \"return document.baseURI\"'"
|
||||
echo 'js console mute: ' "type 'echo 0 > /dev/browser/tty' to disable"
|
||||
echo 'js capture console: ' "type 'tail -f /dev/browser/console'"
|
||||
echo 'jsh<->sh hooks: ' "type 'chmod +x ~/hook.d/*/* && alert helloworld'"
|
||||
echo 'js<->filesystem hooks:' "type 'see [executable] files in ~/hook.d'"
|
||||
echo 'include file into page' "type 'require <url.js|css>'"
|
||||
echo ''
|
||||
echo 'type "help" or "man xrsh" to read the full manual'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/sh
|
||||
test -n "$1" || { echo "usage: a-gltf-model <gltf-file>"; exit; }
|
||||
|
||||
file="${1#/}" # strip leading slash if present
|
||||
file="$(readlink -f "$1")"
|
||||
file="${file#/}" # strip leading slash if present
|
||||
|
||||
echo "<a-gltf-model src='file://xrsh/$file'></a-gltf-model>" >> /root/index.html
|
||||
|
|
|
|||
6
buildroot-v86/board/v86/rootfs_overlay/root/bin/reset
Executable file
6
buildroot-v86/board/v86/rootfs_overlay/root/bin/reset
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
/usr/bin/reset
|
||||
set -x
|
||||
echo '' > ~/index.html # empty scene
|
||||
set +x
|
||||
echo "[i] terminal and 3D scene are re-initialized"
|
||||
|
|
@ -7,7 +7,8 @@ javascript='
|
|||
return "[OK] xrsh state saved\n"
|
||||
'
|
||||
|
||||
echo "[OK] triggering ~/hook.d/save/* scripts"
|
||||
echo "[i] triggering ~/hook.d/save/* scripts"
|
||||
hook save
|
||||
echo "[..] please wait.."
|
||||
echo "[i] warning: do not resize the browserwindow"
|
||||
echo "[i] please wait.."
|
||||
js "$javascript"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
set -e # halt on error
|
||||
file="$1"
|
||||
dir="$(basename "$file")"
|
||||
|
||||
logger "$0: extracting $file"
|
||||
|
||||
mkdir -p "/root/$dir"
|
||||
cd "/root/$dir"
|
||||
unzip "$file"
|
||||
|
||||
test -x app && {
|
||||
logger "$0: detected $(pwd)/app executable"
|
||||
logger "$0: running $(pwd)/app"
|
||||
./app
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
XRSH Manual
|
||||
===========
|
||||
|
||||
```
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
. . ____ _____________ ________. ._. ._. . . . . . . . .
|
||||
. . _\ \/ /\______ \/ _____// | \. . . . . . . .
|
||||
|
|
@ -8,7 +9,7 @@ XRSH Manual
|
|||
_ _ / \ | | \/ \ Y / _ _ _ _ _ _ _
|
||||
. . /___/\ \ |____|_ /_______ /\___|_ /. . . . . . . .
|
||||
. . . . . .\_/. . . . \/ . . . .\/ . . _ \/ . . . . . . . .
|
||||
▬▬▬▬ https://xrsh.isvery.ninja ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
|
||||
================ https://xrsh.isvery.ninja ================
|
||||
|
||||
Open, local-first, polyglot, unix hackable & selfcontained XR apps.
|
||||
Using worlds first WebXR linux distro.
|
||||
|
|
@ -17,6 +18,7 @@ XRSH Manual
|
|||
all FOSS devs | copy.sh (v86) aframe.io (AFRAME)
|
||||
Leon van Kammen | @lvk@mastodon.online
|
||||
Fabien Benetou | @utopiah@mastodon.pirateparty.be
|
||||
```
|
||||
|
||||
# Getting started
|
||||
|
||||
|
|
@ -49,44 +51,66 @@ Currently the following languages are supported:
|
|||
* nano (busybox nano)
|
||||
* mg (microemacs)
|
||||
|
||||
# Boot sequence
|
||||
# Multiple terminals [GNU screen]
|
||||
|
||||
The following files are loaded during boot (via `/etc/profile`)
|
||||
## From the cmdline
|
||||
|
||||
| file | info |
|
||||
|-----------------------|---------------------------------------------------|
|
||||
| /etc/profile.xrsh | sets up xrsh environment |
|
||||
| /etc/profile.sh | global shellscript functions |
|
||||
| /etc/profile.js | global javascript functions |
|
||||
| /mnt/profile.browser | environment vars set by browser (`echo $HOSTNAME`)|
|
||||
| /root/.profile | user shellscript functions/settings |
|
||||
| /root/.profile.js | user javascript functions |
|
||||
| /root/.screenrc | GNU screen initialisations |
|
||||
| https://.../#ls | URI fragment is executed as command in own screen |
|
||||
|
||||
> TIP: to keep things portable with future versions of XRSH: modify files in `/root/*`
|
||||
|
||||
# Calling terminal from javascript
|
||||
|
||||
```javascript
|
||||
const term = document.querySelector('[isoterminal]').components.isoterminal.term
|
||||
term.exec("ls -la")
|
||||
|
||||
// interact directly with files
|
||||
await term.worker.create_file("hello.txt", term.convert.toUint8Array("hello") )
|
||||
await term.worker.update_file("hello.txt", term.convert.toUint8Array("hi") )
|
||||
await term.worker.append_file("hello.txt", term.convert.toUint8Array("world") )
|
||||
const f = await term.worker.read_file("hello.txt")
|
||||
```
|
||||
xrsh # screen –DR # list of detached screen
|
||||
xrsh # screen –r PID # attach detached screen session
|
||||
xrsh # screen –dmS Myses # start a detached screen session
|
||||
xrsh # screen –r MySes #attach screen session with name MySession
|
||||
```
|
||||
|
||||
# Calling javascript from terminal
|
||||
## Basics
|
||||
|
||||
Various options:
|
||||
```
|
||||
ctrl a c -> create new window
|
||||
ctrl a A -> set window name
|
||||
ctrl a w -> show all window
|
||||
ctrl a 1|2|3|… -> switch to window n
|
||||
ctrl a " -> choose window
|
||||
ctrl a ctrl a -> switch between window
|
||||
ctrl a d -> detach window
|
||||
ctrl a ? -> help
|
||||
ctrl a [ -> start copy, move cursor to the copy location, press ENTER, select the chars, press ENTER to copy the selected characters to the buffer
|
||||
ctrl a ] -> paste from buffer
|
||||
```
|
||||
|
||||
1. Just add the `#!/bin/js` shebang to the top of a javascript file (+ chmod +x)
|
||||
2. Run `js "alert('hello')"` in the shell
|
||||
3. Run `jsh alert hello` in the shell
|
||||
4. Run `jsh` to start an interactive shell
|
||||
## Advanced
|
||||
|
||||
```
|
||||
ctrl a S -> create split screen
|
||||
ctrl a TAB -> switch between split screens
|
||||
ctrl a Q -> Kill all regions but the current one.
|
||||
ctrl a X -> remove active window from split screen
|
||||
ctrl a O -> logout active window (disable output)
|
||||
ctrl a I -> login active window (enable output)
|
||||
```
|
||||
|
||||
# Importing files
|
||||
|
||||
Files can be imported (always to /mnt/clipboard) in various ways:
|
||||
|
||||
* copy-pasted text (from clipboard via ctrl/cmd+v )
|
||||
* drag-dropped file ends up in /mnt/clipboard [based on ~/hook.d/mimetype/* things happen or not]
|
||||
* type 'upload' to trigger a file-upload dialog [ends up in /mnt/clip
|
||||
|
||||
XRSH ships with hooks for importing .glb 3D files, text-files & zip-packages, all described below.
|
||||
|
||||
# XRSH Packages
|
||||
|
||||
A XRSH package is just a zip with an entrypoint, which gets extracted to /root/{zipname} that's it!
|
||||
|
||||
It can be loaded in various ways into [your own instance of] https://xrsh.isvery.ninja:
|
||||
|
||||
* copy the zip in a filemanager to your clipboard, and paste it into your XRSH-tab
|
||||
* drag-drop the zip from a filemanager to your XRSH-tab
|
||||
* download the zip, and type 'upload' in XRSH to import it
|
||||
|
||||
Currently, 'app' links to 'bin/app.sh', but there are also other scriptinglanguages it could link to as well (see bin-folder).
|
||||
|
||||
> see example package at https://xrsh.isvery.ninja/package.zip
|
||||
|
||||
# Hooks
|
||||
|
||||
|
|
@ -132,42 +156,6 @@ But you can do it manually too:
|
|||
|
||||
These are various ways to enable hybrid eventing between browser and terminal (languages).
|
||||
|
||||
# Multiple terminals [GNU screen]
|
||||
|
||||
## From the cmdline
|
||||
|
||||
```
|
||||
xrsh # screen –DR # list of detached screen
|
||||
xrsh # screen –r PID # attach detached screen session
|
||||
xrsh # screen –dmS Myses # start a detached screen session
|
||||
xrsh # screen –r MySes #attach screen session with name MySession
|
||||
```
|
||||
|
||||
## Basics
|
||||
|
||||
```
|
||||
ctrl a c -> create new window
|
||||
ctrl a A -> set window name
|
||||
ctrl a w -> show all window
|
||||
ctrl a 1|2|3|… -> switch to window n
|
||||
ctrl a " -> choose window
|
||||
ctrl a ctrl a -> switch between window
|
||||
ctrl a d -> detach window
|
||||
ctrl a ? -> help
|
||||
ctrl a [ -> start copy, move cursor to the copy location, press ENTER, select the chars, press ENTER to copy the selected characters to the buffer
|
||||
ctrl a ] -> paste from buffer
|
||||
```
|
||||
|
||||
## Advanced
|
||||
|
||||
```
|
||||
ctrl a S -> create split screen
|
||||
ctrl a TAB -> switch between split screens
|
||||
ctrl a Q -> Kill all regions but the current one.
|
||||
ctrl a X -> remove active window from split screen
|
||||
ctrl a O -> logout active window (disable output)
|
||||
ctrl a I -> login active window (enable output)
|
||||
```
|
||||
|
||||
## webrequests to the filesystem
|
||||
|
||||
|
|
@ -181,3 +169,43 @@ current [security] limitations:
|
|||
|
||||
* only /mnt directory is exposed
|
||||
* file needs to be world-readable (`chmod +r /mnt/<file>`)
|
||||
|
||||
# Boot sequence
|
||||
|
||||
The following files are loaded during boot (via `/etc/profile`)
|
||||
|
||||
| file | info |
|
||||
|-----------------------|---------------------------------------------------|
|
||||
| /etc/profile.xrsh | sets up xrsh environment |
|
||||
| /etc/profile.sh | global shellscript functions |
|
||||
| /etc/profile.js | global javascript functions |
|
||||
| /mnt/profile.browser | environment vars set by browser (`echo $HOSTNAME`)|
|
||||
| /root/.profile | user shellscript functions/settings |
|
||||
| /root/.profile.js | user javascript functions |
|
||||
| /root/.screenrc | GNU screen initialisations |
|
||||
| https://.../#ls | URI fragment is executed as command in own screen |
|
||||
|
||||
> TIP: to keep things portable with future versions of XRSH: modify files in `/root/*`
|
||||
|
||||
# Calling terminal from javascript
|
||||
|
||||
```javascript
|
||||
const term = document.querySelector('[isoterminal]').components.isoterminal.term
|
||||
term.exec("ls -la")
|
||||
|
||||
// interact directly with files
|
||||
await term.worker.create_file("hello.txt", term.convert.toUint8Array("hello") )
|
||||
await term.worker.update_file("hello.txt", term.convert.toUint8Array("hi") )
|
||||
await term.worker.append_file("hello.txt", term.convert.toUint8Array("world") )
|
||||
const f = await term.worker.read_file("hello.txt")
|
||||
```
|
||||
|
||||
# Calling javascript from terminal
|
||||
|
||||
Various options:
|
||||
|
||||
1. Just add the `#!/bin/js` shebang to the top of a javascript file (+ chmod +x)
|
||||
2. Run `js "alert('hello')"` in the shell
|
||||
3. Run `jsh alert hello` in the shell
|
||||
4. Run `jsh` to start an interactive shell
|
||||
|
||||
|
|
|
|||
BIN
dist/v86-linux.iso
vendored
BIN
dist/v86-linux.iso
vendored
Binary file not shown.
Loading…
Add table
Reference in a new issue