fixed require+ziprun (runs .sh or zip)
This commit is contained in:
parent
6ce07aa483
commit
bb8fd366dd
|
@ -64,12 +64,19 @@ require(){
|
|||
echo "<a-entity xrf='$1'></a-entity>" >> /root/index.html
|
||||
;;
|
||||
|
||||
sh)
|
||||
sh|zip)
|
||||
js '
|
||||
fetch('$1')
|
||||
.then( (res) => res.text() )
|
||||
.then( (text) => console.log(text) )
|
||||
'
|
||||
fetch("'$1'")
|
||||
.then( (res) => res.arrayBuffer() )
|
||||
.then( async (buf) => {
|
||||
// write to filesystem
|
||||
const term = document.querySelector("[isoterminal]").components.isoterminal.term
|
||||
await term.worker.create_file("'$(basename "$1")'", new Uint8Array(buf) )
|
||||
let cmd = String("'$1'").match(/\.zip$/) ? `/root/bin/ziprun /mnt/"'$(basename $1)'"` : "./'$1'"
|
||||
term.exec(cmd)
|
||||
})
|
||||
' > $file
|
||||
echo "[.] wrote $file"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
|
|
@ -9,7 +9,7 @@ fi
|
|||
if [[ "$1" =~ "zip$" ]]; then
|
||||
echo "[.] detected XRSH zip package in URL"
|
||||
echo "[.] fetching $1"
|
||||
ziprun "$1"
|
||||
require "$1"
|
||||
fi
|
||||
|
||||
# otherwise execute
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue