squashed xrsh
This commit is contained in:
commit
5e84b3bc18
62 changed files with 71192 additions and 0 deletions
1
.args
Normal file
1
.args
Normal file
|
|
@ -0,0 +1 @@
|
|||
-w/
|
||||
25
.env
Normal file
25
.env
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
which nix-shell && test -z "$NIX_SHELL_XRSH" && {
|
||||
|
||||
export NIX_SHELL_XRSH=1
|
||||
|
||||
# automatically mirror main between forgejo<->codeberg
|
||||
git(){
|
||||
set -x
|
||||
test $1 = "push" && test $3 = main && mirror=1
|
||||
$(which git) "$@"
|
||||
test -n "$mirror" && {
|
||||
set -x
|
||||
shift ; shift # remove first to args
|
||||
$(which git) push codeberg "$@"
|
||||
}
|
||||
set +x
|
||||
}
|
||||
|
||||
echo '[i] installing nix-shell' && nix-shell
|
||||
|
||||
}
|
||||
|
||||
test "$GITEA_ROOT_URL" = "https://forgejo.isvery.ninja/" && {
|
||||
# on the website xrsh.isvery.ninja
|
||||
echo hello website deployment
|
||||
}
|
||||
0
.env.leave
Normal file
0
.env.leave
Normal file
17
.forgejo/workflows/mirror_to_github.yaml
Normal file
17
.forgejo/workflows/mirror_to_github.yaml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
mirror_to_github:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- run: mkdir ~/.ssh
|
||||
- run: "echo \"${{ secrets.SSHKEY }}\" > ~/.ssh/id_rsa"
|
||||
- run: ssh-keyscan github.com >> ~/.ssh/known_hosts # see https://gist.github.com/vikpe/34454d69fe03a9617f2b009cc3ba200b
|
||||
- run: chmod 600 -R ~/.ssh
|
||||
- run: git remote add github git@github.com:coderofsalvation/xrsh
|
||||
- run: git push github main
|
||||
8
.forgejo/workflows/test.yaml
Normal file
8
.forgejo/workflows/test.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
on: [push]
|
||||
jobs:
|
||||
test:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- run: echo All Good
|
||||
- run: id
|
||||
- run: ls -la /var/run
|
||||
45
.github/workflows/website.yml
vendored
Normal file
45
.github/workflows/website.yml
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Simple workflow for deploying static content to GitHub Pages
|
||||
name: Deploy static content to Pages
|
||||
|
||||
on:
|
||||
# Runs on pushes targeting the default branch
|
||||
push:
|
||||
branches: ["main"]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
# Single deploy job since we're just deploying
|
||||
deploy:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v3
|
||||
- name: clone components
|
||||
run: 'cd src && git clone https://github.com/coderofsalvation/xrsh-com && cd ..'
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v1
|
||||
with:
|
||||
path: '.'
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v2
|
||||
|
||||
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
xrsh-media
|
||||
XRSH milestones.odt
|
||||
aframe/CHANGELOG.md aframe/codecov.yml aframe/CODE_OF_CONDUCT.md aframe/CONTRIBUTING.md aframe/dist aframe/docs aframe/examples aframe/index.html aframe/LICENSE aframe/ORGANIZATION.md aframe/package.json aframe/README.md aframe/ROADMAP.md aframe/scripts aframe/src aframe/tests aframe/vendor aframe/webpack.config.js aframe/webpack.prod.config.js
|
||||
result
|
||||
src/aframe
|
||||
tags
|
||||
|
||||
5
.gitmodules
vendored
Normal file
5
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[submodule "src/xrsh-com"]
|
||||
path = src/xrsh-com
|
||||
url = ./../xrsh-com
|
||||
#url = ssh://git@forgejo.isvery.ninja:8222/xrsh/xrsh-com.git
|
||||
|
||||
19
Dockerfile
Normal file
19
Dockerfile
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
FROM alpine:latest as build
|
||||
|
||||
RUN apk add --update zip bash file curl
|
||||
|
||||
ADD xrsh.com /
|
||||
|
||||
RUN curl -o assimilate https://cosmo.zip/pub/cosmos/bin/assimilate && \
|
||||
chmod +x assimilate && \
|
||||
./assimilate /xrsh.com && \
|
||||
file /xrsh.com
|
||||
|
||||
|
||||
# normalize the binary to ELF
|
||||
#RUN sh /xrsh.com --assimilate && file /xrsh.com
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=build /xrsh.com /
|
||||
CMD ["/xrsh.com"]
|
||||
675
LICENSE
Normal file
675
LICENSE
Normal file
|
|
@ -0,0 +1,675 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
||||
245
README.md
Normal file
245
README.md
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
# xrsh
|
||||
|
||||
<img src='xrsh.svg' width="25%"/>
|
||||
|
||||
## [click here for the website / hosted repo](https://xrsh.isvery.ninja)
|
||||
|
||||
## XRSH Manual
|
||||
|
||||
Documentation for XRSH users can be found [here](https://forgejo.isvery.ninja/xrsh/xrsh-buildroot/src/branch/main/buildroot-v86/board/v86/rootfs_overlay/root/manual.md)
|
||||
|
||||
> TIP: this is also available by typing `ctrl/cmd+a+0` or `man xrsh` inside XRSH
|
||||
|
||||
## Wiki / Roadmap
|
||||
|
||||
See [the wiki here](https://forgejo.isvery.ninja/xrsh/xrsh/wiki/Home#milestones)
|
||||
|
||||
## Install
|
||||
|
||||
> NOTE: installation is optional: just surf to the public version [here](https://xrsh.isvery.ninja)
|
||||
|
||||
For local use: download the crossplatform <a href="/xrsh.com" target="_blank">xrsh.com</a> executable [<a href="/xrsh.com.txt" target="_blank">checksum</a>]:<br>
|
||||
|
||||
1. [linux/mac only] run `chmod +x xrsh.com` in the console
|
||||
2. run `./xrsh.com` in the console
|
||||
3. xrsh opens in your browser at `https://127.0.0.1:8080`
|
||||
4. profit!
|
||||
|
||||
> pass `-p XXXX` to specify port (default:8080)
|
||||
|
||||
### Installation guides
|
||||
|
||||
<details>
|
||||
<summary>run standalone binary</summary>
|
||||
|
||||
1. Download [xrsh.com](https://forgejo.isvery.ninja/xrsh/xrsh/raw/branch/main/xrsh.com)
|
||||
2. optional: run `unzip xrsh.com` to verify repository contents
|
||||
3. run `chmod +x xrsh.com` in your console (only linux/mac)
|
||||
4. run `./xrsh.com` in (any) shell
|
||||
5. Profit! ✔
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>install using nixos</summary>
|
||||
|
||||
[NIX](https://nixos.org/) is a convenient way to install or develop xrsh:
|
||||
|
||||
1. `nix-shell -p xrsh thttpd`
|
||||
2. run it (`thttpd -p 8080 -d /nix/store/5q4vd50gmh52jh48z62ln1j05xzfh1fz-xrsh-0.142` e.g.)
|
||||
3. point your browser to `localhost:8080`
|
||||
4. profit!
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>run OCI container [podman/docker]</summary>
|
||||
|
||||
1. `$(which podman || which docker) run -p 8080:8080 docker.io/coderofsalvation/xrsh`
|
||||
2. point your browser to `localhost:8080`
|
||||
3. profit!
|
||||
|
||||
> NOTE 1: to add files use the `-D <dir>` overlay webroot parameter.
|
||||
|
||||
> NOTE 2: to enable SSL and add (iso)file try something like this:
|
||||
|
||||
```
|
||||
$ mkdir data
|
||||
$ cp ../xrsh.iso data/. # copy custom iso
|
||||
$ $(which podman || which docker) run -p 8080:8080 -v data/cert:etc/cert -v data:/data docker.io/coderofsalvation/xrsh /xrsh.com -D /data -c 0 -C /etc/cert/cert.pem -K /etc/cert/key.pem
|
||||
```
|
||||
|
||||
> or as an exercise in constructive laziness setup a reverse proxy like [zoraxy](https://github.com/tobychui/zoraxy), [go-proxy](https://github.com/yusing/go-proxy), [droxy], caddy or nginx-reverse-proxymanager.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>run from codeberg.org</summary>
|
||||
|
||||
(codeberg.org is a nonprofit-backed forgejo instance)
|
||||
|
||||
1. create a repository on codeberg.org
|
||||
2. `git push` the [xrsh repository](https://forgejo.isvery.ninja/xrsh/xrsh) to it
|
||||
1. create a `pages` branchclone
|
||||
2. push it to the codeberg repository
|
||||
3. profit! it is now live
|
||||
|
||||
> more info: https://docs.codeberg.org/codeberg-pages/
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>run from selfhosted forgejo/gitea instance</summary>
|
||||
|
||||
1. clone the xrsh [xrsh repository](https://forgejo.isvery.ninja/xrsh/xrsh) locally
|
||||
2. create a repo on your [forgejo](https://forgejo.org) instance
|
||||
3. `git push` the xrsh to it
|
||||
4. in your forgejo (docker/nix)-instance symlink it to the public folder (*)
|
||||
5. point your browser to `https://yourforgejo.org/assets/xrsh`
|
||||
|
||||
> \* = for example: `ln -f git/repositories/yourusername/xrsh gitea/public/assets/.`
|
||||
|
||||
> optionally customize the [xrsh yunohost package](https://forgejo.isvery.ninja/xrsh/xrsh_ynh) with your own ISO
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>install in yunohost</summary>
|
||||
|
||||
1. search for xrsh in the [yunohost](https://yunohost.org) application catalog
|
||||
2. click install
|
||||
3. profit!
|
||||
|
||||
> optionally customize the [xrsh yunohost package](https://forgejo.isvery.ninja/xrsh/xrsh_ynh) with your own ISO
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>install with systemd</summary>
|
||||
|
||||
1. Create a new systemd service file (`sudo nano /etc/systemd/system/xrsh.service` e.g.)
|
||||
2. Specify the `ExecStart` directive to run the xrsh (`[Service]\ExecStart=/path/to/xrsh.com -p 8080` e.g.).
|
||||
3. Enable the service (`sudo systemctl enable xrsh.service` e.g.)
|
||||
4. Start the service (`sudo systemctl start xrsh.service`).
|
||||
4. Verify the service: `sudo systemctl status xrsh.service` or `netstat -tuln`.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>run from github</summary>
|
||||
Sigh..good old github times (RIP)..<br>
|
||||
It used to be a simple webinterface around git in 2008.<br>
|
||||
These days running a forgejo/gitea instance + CI is literally one cmd away (or hosted by codeberg.org.<br>
|
||||
|
||||
</details>
|
||||
|
||||
## Developers
|
||||
|
||||
Make sure to clone the repo including submodules (the [xrsh-com](https://forgejo.isvery.ninja/xrsh/xrsh-com) repo)
|
||||
|
||||
```
|
||||
$ git clone --recurse-submodules https://forgejo.isvery.ninja/xrsh/xrsh
|
||||
$ cd xrsh
|
||||
$ nix-shell # optional but adviced (to get up and running instantly)
|
||||
```
|
||||
|
||||
> Now serve the repo from a HTTPS webserver (for example run `./make dev`)
|
||||
|
||||
Eventhough a custom ISO-image can be **built**, XRSH is **buildless** software.<br>
|
||||
The crossplatform binary is just a zip-file with the source (using https://redbean.dev):
|
||||
|
||||
<details>
|
||||
<summary>build using shellscript</summary>
|
||||
|
||||
1. Run `./make standalone` to package everything into `xrsh.com`
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>build using nix</summary>
|
||||
|
||||
1. `nix-build -E "with import <nixpkgs> { }; callPackage ./nix/xrsh-package.nix"`
|
||||
2. optionally see the other nix-files in `nix`-folder
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>launch different .iso / modify files</summary>
|
||||
|
||||
You can specify a different `.iso` file in various ways:
|
||||
|
||||
1. open the `xrsh.com` as a zip (drag-drop into a zip-manager, or add `.zip` extension)
|
||||
2. method 1: overwrite `xrsh.iso`
|
||||
3. method 2: open `src/index.html` and change `isoterminal="iso: ./../xrsh.iso"` to another file/URL
|
||||
|
||||
> see developer-section below on building your own iso
|
||||
|
||||
</details>
|
||||
|
||||
* development of components (`src/com`) takes places [in this git submodule](https://forgejo.isvery.ninja/xrsh/xrsh-com)
|
||||
* development of `xrsh.iso` takes places [in this gitsubmodule](https://forgejo.isvery.ninja/xrsh/xrsh-buildroot)
|
||||
|
||||
> IMPORTANT: existing AFRAME apps can embed a barebones XR terminal / REPL like this:
|
||||
|
||||
```html
|
||||
<html>
|
||||
<head>
|
||||
<script src="https://aframe.io/releases/1.6.0/aframe.min.js"></script>
|
||||
<script src="https://xrsh.isvery.ninja/xrsh.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a-scene>
|
||||
<a-entity isoterminal position="0 1.6 -0.3"></a-entity>
|
||||
</a-scene>
|
||||
<script>
|
||||
document.querySelector('a-scene').addEventListener('isoterminal_init', function(e){
|
||||
|
||||
// (OPTIONAL) override/extend bootmenu-array with your own REPL(s)
|
||||
// see com/isoterminal/feat/boot.REPL.*.js for examples
|
||||
ISOTerminal.prototype.boot.menu.push({
|
||||
key: "f",
|
||||
title: (opts) => `other awesome NLnet FOSS projects ❤️`,
|
||||
init: function( mainmenu ){
|
||||
window.open('https://nlnet.nl/project/current.html','_blank')
|
||||
// return to main menu
|
||||
mainmenu()
|
||||
},
|
||||
keyHandler: function(ch){
|
||||
this.send("\n\ryou typed:"+ch) // write to term
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
// AFRAME exposes THREE too
|
||||
console.log(THREE)
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
> this portable version runs without the ISO (which requires wasm-files, longer loadingtimes e.g.)
|
||||
|
||||
```
|
||||
|
||||
## Building your own ISO
|
||||
|
||||
As described in the [website documentation](https://xrsh.isvery.ninja/#Booting%20an%20ISO%20image) you could boot your own ISO distribution (TIP: a [filesystem overlay](https://xrsh.isvery.ninja/#Filesystem%20overlay) is easier):
|
||||
|
||||
```
|
||||
$ git clone --recurse-submodules ssh://git@forgejo.isvery.ninja:8222/xrsh/xrsh.git
|
||||
$ git clone ssh://git@forgejo.isvery.ninja:8222/xrsh/xrsh-buildroot
|
||||
$ cd xrsh
|
||||
$ rm xrsh.iso && ln -fs ../xrsh-buildroot/dist/v86-linux.iso xrsh.iso
|
||||
$ ./make dev
|
||||
```
|
||||
|
||||
You can read the [repo-README](https://forgejo.isvery.ninja/xrsh/xrsh-buildroot) about (re)building/modifying the iso
|
||||
|
||||
## Funding
|
||||
|
||||
This project is funded through [NGI0 Entrust](https://nlnet.nl/entrust), a fund established by [NLnet](https://nlnet.nl) with financial support from the European Commission's [Next Generation Internet](https://ngi.eu) program. Learn more at the [NLnet project page](https://nlnet.nl/project/xrsh).
|
||||
|
||||
[<img src="https://nlnet.nl/logo/banner.png" alt="NLnet foundation logo" width="20%" />](https://nlnet.nl)
|
||||
[<img src="https://nlnet.nl/image/logos/NGI0_tag.svg" alt="NGI Zero Logo" width="20%" />](https://nlnet.nl/entrust)
|
||||
|
||||
## Inspired by
|
||||
|
||||
* [mimetype hooks](https://forgejo.isvery.ninja/xrsh/xrsh-buildroot/src/branch/main/buildroot-v86/board/v86/rootfs_overlay/root/hook.d/mimetype): [Future of Text's](https://github.com/TheElectronicLiteratureLab/spasca-fsbased-interrop-companion/)
|
||||
* [xterm](https://invisible-island.net/xterm/)
|
||||
* [xr-terminal](https://github.com/RangerMauve/xr-terminal) of Mauve (an amazingly talented dev)
|
||||
* [Fabien Beneout's PIM](https://fabien.benetou.fr/) (the WIKI containing all secrets & ideas in life)
|
||||
3957
index.html
Normal file
3957
index.html
Normal file
File diff suppressed because one or more lines are too long
112
make
Executable file
112
make
Executable file
|
|
@ -0,0 +1,112 @@
|
|||
#!/bin/bash
|
||||
REDBEAN_VERSION=https://redbean.dev/redbean-3.0.0.com
|
||||
APP=xrsh
|
||||
DIR=$(dirname $(readlink -f $0))
|
||||
|
||||
export PATH=$PATH:.
|
||||
silent(){ "$@" 1>/dev/null 2>/dev/null; }
|
||||
|
||||
deps(){ # check dependencies
|
||||
echo "[v] checking dependencies "
|
||||
test -f ${APP}.com || {
|
||||
wget "$REDBEAN_VERSION" -O ${APP}.com
|
||||
chmod +x ${APP}.com
|
||||
}
|
||||
}
|
||||
|
||||
standalone(){ # build standalone xrsh.com binary
|
||||
|
||||
exec(){
|
||||
FILE=${APP}.com
|
||||
test -z "$1" && {
|
||||
rm ${APP}.com || true
|
||||
deps
|
||||
}
|
||||
test -n "$1" && FILE="$1"
|
||||
#cp index.html /tmp/index.html
|
||||
#sed -i 's|isoterminal=".*"|isoterminal="iso: ./../xrsh.iso"|g' index.html
|
||||
zip -x "*.git*" -r "$FILE" index.html xrsh.iso .args LICENSE src/index.{html,css} src/assets src/com/*.js src/com/lib src/com/isoterminal/{libv86.js,bios,v86.wasm,feat,PromiseWorker.js,ISOTerminal.js,localforage.js,term.js,assets,worker.js}
|
||||
#cp /tmp/index.html index.html
|
||||
sha256sum "$FILE" > "$FILE".txt
|
||||
ls -lah "$FILE"
|
||||
}
|
||||
|
||||
jslib(){
|
||||
{
|
||||
echo ""
|
||||
echo "/* xrsh.js AFRAME component "
|
||||
echo " * https://xrsh.isvery.ninja "
|
||||
echo " * SPDX: AGPL-3.0-or-later "
|
||||
echo " */"
|
||||
echo "document.head.innerHTML += \`<style type='text/css'>"
|
||||
cat src/index.css
|
||||
echo -e "</style>\`;\n"
|
||||
cat src/assets/winbox* src/com/{isoterminal,data2event,dom,html-as-texture-in-xr,pastedrop,require,window}.js src/com/lib/*.js src/com/isoterminal/{ISOTerminal.js,term.js,feat/boot.js,feat/jsconsole.js,feat/term.js,feat/remotekeyboard.js}
|
||||
echo "// mark above libs as pre-required in require.js, to prevent 'component already registered' errors "
|
||||
echo "AFRAME.utils.require.required = {";
|
||||
echo " window: true,"
|
||||
echo " winboxjs: true,"
|
||||
echo " com: true,"
|
||||
echo " dom: true,"
|
||||
echo " xhook: true,"
|
||||
echo " pastedrop: true,"
|
||||
echo " selfcontain: true,"
|
||||
echo " v86: true,"
|
||||
echo " htmlinxr: true,"
|
||||
echo " html: true,"
|
||||
echo " PromiseWorker: true,"
|
||||
echo " ISOTerminal: true,"
|
||||
echo " localforage: true,"
|
||||
echo " boot: true,"
|
||||
echo " javascript: true,"
|
||||
echo " jsconsole: true,"
|
||||
echo " indexhtml: true,"
|
||||
echo " indexjs: true,"
|
||||
echo " autorestore: true,"
|
||||
echo " pastedropFeat: true,"
|
||||
echo " httpfs: true,"
|
||||
echo " fbterm: true,"
|
||||
echo " fbtermjs: true,"
|
||||
echo " remotekeyboard: true"
|
||||
echo " remotestorage: true"
|
||||
echo " };"
|
||||
} > xrsh.js
|
||||
ls -lh xrsh.js
|
||||
}
|
||||
|
||||
test -z "$1" && { jslib; exec; }
|
||||
test -n "$1" && "$@"
|
||||
}
|
||||
|
||||
dev(){ # start dev http server
|
||||
set -x
|
||||
cd "$DIR"
|
||||
wget "$REDBEAN_VERSION" -O /tmp/server.com
|
||||
chmod +x /tmp/server.com
|
||||
test -f /tmp/cert.pem || openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout /tmp/key.pem -out /tmp/cert.pem
|
||||
/tmp/server.com -c 0 -C /tmp/cert.pem -K /tmp/key.pem -D . "$@"
|
||||
}
|
||||
|
||||
shell(){ # run xrsh shell via docker
|
||||
OCI=$(which podman || which docker)
|
||||
set -x
|
||||
$OCI rm -f xrsh || true
|
||||
$OCI run --name xrsh -d \
|
||||
-v ./src/com/isoterminal/mnt:/mnt busybox:1.31.1-musl tail -f /dev/null
|
||||
$OCI exec -it xrsh /bin/sh -i -c 'ln -s /mnt/profile /etc/profile && sh --login'
|
||||
}
|
||||
|
||||
recordings(){ # compile vhs recordings
|
||||
export PATH=$PATH:src/com/isoterminal/mnt
|
||||
export BROWSER=0
|
||||
test -z $1 && find src/tests/vhs/* | xargs -n1 vhs
|
||||
test -z $1 || vhs $1
|
||||
}
|
||||
|
||||
usage(){
|
||||
echo "Usage:"
|
||||
awk '/\(\){ #/ { gsub(/\(\){ #/," <----",$0); print " ./make "$0 }' $0
|
||||
}
|
||||
|
||||
test -z $1 && usage
|
||||
test -z $1 || "$@"
|
||||
29
nix/xrsh-package.nix
Normal file
29
nix/xrsh-package.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{ stdenv, fetchgit, lib }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "xrsh";
|
||||
version = "0.142";
|
||||
|
||||
src = fetchgit {
|
||||
fetchSubmodules = true;
|
||||
url = "https://codeberg.org/xrsh/xrsh.git";
|
||||
rev = "12f84e4cf72bf1e1268a6a4120594a825a8f66a7";
|
||||
sha256 = "sha256-0MBBlqL2TWgN94ErI2Joub0Aub5XBxGWXILPDAfiNpc=";
|
||||
};
|
||||
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
cp -r $src/{index.html,src,xrsh.ico,xrsh.svg} $out/.
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "XR shell which runs a linux ISO in WebXR";
|
||||
license = "GPL3";
|
||||
homepage = "https://xrsh.isvery.ninja";
|
||||
maintainers = with maintainers; [ coderofsalvation ];
|
||||
platforms = [ "i686-linux" "x86_64-linux" "x86_64-windows" "i686-windows" "x86_64-darwin" ];
|
||||
};
|
||||
}
|
||||
|
||||
50
nix/xrsh-server-cosmo.nix
Normal file
50
nix/xrsh-server-cosmo.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{ lib, stdenv, fetchgit, cosmopolitan, zip, bash }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "xrsh";
|
||||
version = "0.142";
|
||||
|
||||
src = cosmopolitan.src;
|
||||
|
||||
inherit (cosmopolitan) buildInputs patches strictDeps cosmocc;
|
||||
|
||||
nativeBuildInputs = [ zip bash ] ++ cosmopolitan.nativeBuildInputs; # expose zip during build (./make needs it)
|
||||
|
||||
outputs = ["out"];
|
||||
|
||||
xrsh = fetchgit {
|
||||
url = "https://codeberg.org/xrsh/xrsh";
|
||||
rev = "2a98ab1027de6f23f007a1c793784ca5200a0022";
|
||||
hash = "sha256-ARs6cIBXHyDEooYV4Xsdn201whuPxJTwof81Z8zr4NU=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
buildFlags = cosmopolitan.buildFlags ++ [ "o//tool/net/redbean.com" ];
|
||||
|
||||
dontUnpack = false;
|
||||
dontBuild = false;
|
||||
dontFixup = true; # essential, otherwise cosmopolitcan libc exec-header gets corrupted
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin
|
||||
|
||||
set -x
|
||||
cp o/tool/net/redbean.com $out/bin/xrsh.com
|
||||
chmod +x $out/bin/xrsh.com
|
||||
|
||||
cd $xrsh
|
||||
find
|
||||
bash ./make standalone $out/bin/xrsh.com
|
||||
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "XR shell which runs a linux ISO in WebXR";
|
||||
license = "MPL";
|
||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||
homepage = "https://xrsh.isvery.ninja";
|
||||
maintainers = with maintainers; [ coderofsalvation ];
|
||||
platforms = [ "i686-linux" "x86_64-linux" "x86_64-windows" "i686-windows" "x86_64-darwin" ];
|
||||
};
|
||||
}
|
||||
53
nix/xrsh-server.nix
Normal file
53
nix/xrsh-server.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{ stdenv, fetchurl, fetchzip, lib, zip }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "xrsh";
|
||||
version = "0.0.13";
|
||||
|
||||
redbean = fetchurl {
|
||||
url = "https://redbean.dev/redbean-2.2.com";
|
||||
hash = "sha256-24/HzFp3A7fMuDCjZutp5yj8eJL9PswJPAidg3qluRs=";
|
||||
};
|
||||
|
||||
xrsh = fetchzip {
|
||||
url = "https://codeberg.org/xrsh/xrsh/archive/24e117f5125e4b2ecd7432baf6fdd5f60e6b3a70.tar.gz";
|
||||
sha256 = "1x0h5krz90y8ngrzgbpjd6xdr171y54p3lqwyirq8j6ilzlq5d5i";
|
||||
};
|
||||
|
||||
xrshcom = fetchzip {
|
||||
url = "https://codeberg.org/xrsh/xrsh-com/archive/c668a8ba8f65c3d36e3a4da5ea8b87af5eb6091c.tar.gz";
|
||||
sha256 = "0mpl7h4fxg5i4lxw5447pqr12rsffcf24xdrqwqzr1zzpkdkslks";
|
||||
};
|
||||
|
||||
buildInputs = [ zip ];
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
dontBuild = true;
|
||||
|
||||
dontFixup = true; # essential, otherwise cosmopolitcan libc exec-header gets corrupted
|
||||
|
||||
installPhase = ''
|
||||
install -D $redbean $out/bin/xrsh.com
|
||||
chmod +x $out/bin/xrsh.com
|
||||
|
||||
cd $xrsh
|
||||
zip -x "*.git*" -r $out/bin/xrsh.com index.html src/index.{html,css} LICENSE src/assets
|
||||
|
||||
# add components
|
||||
mkdir /tmp/src
|
||||
cp -r $xrshcom/* /tmp/src/.
|
||||
cd /tmp
|
||||
zip -x "*.git*" -r $out/bin/xrsh.com src/com/*.js src/com/isoterminal/{xrsh.iso,libv86.js,bios,v86.wasm}
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "XR shell which runs a linux ISO in WebXR";
|
||||
license = "MPL";
|
||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||
homepage = "https://xrsh.isvery.ninja";
|
||||
maintainers = with maintainers; [ coderofsalvation ];
|
||||
platforms = [ "i686-linux" "x86_64-linux" "x86_64-windows" "i686-windows" "x86_64-darwin" ];
|
||||
};
|
||||
}
|
||||
|
||||
BIN
package.overlayfs.zip
Normal file
BIN
package.overlayfs.zip
Normal file
Binary file not shown.
BIN
package.zip
Normal file
BIN
package.zip
Normal file
Binary file not shown.
28
shell.nix
Normal file
28
shell.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#let
|
||||
# pkgs = import (builtins.fetchGit {
|
||||
# name = "nixos-23.05";
|
||||
# url = "https://github.com/nixos/nixpkgs/";
|
||||
# ref = "refs/heads/nixos-unstable";
|
||||
# rev = "ef99fa5c5ed624460217c31ac4271cfb5cb2502c";
|
||||
# }) {};
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
pkgs.mkShell {
|
||||
# nativeBuildInputs is usually what you want -- tools you need to run
|
||||
nativeBuildInputs = with pkgs.buildPackages; [
|
||||
|
||||
nodejs_20
|
||||
cosmopolitan
|
||||
zip
|
||||
vhs
|
||||
ffmpeg_6-full
|
||||
|
||||
];
|
||||
|
||||
shellHook =
|
||||
''
|
||||
export NIX_SHELL_XRSH=1
|
||||
echo -e "\n run: './make standalone' to generate binary\n"
|
||||
echo -e "\n run: ./xrsh.com to launch XR Shell\n\n"
|
||||
'';
|
||||
}
|
||||
416
src/assets/aframe-remotestorage.min.js
vendored
Normal file
416
src/assets/aframe-remotestorage.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
src/assets/aframe.min.js
vendored
Normal file
2
src/assets/aframe.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
34
src/assets/winbox.bundle.min.js
vendored
Normal file
34
src/assets/winbox.bundle.min.js
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* WinBox.js v0.2.82 (Bundle)
|
||||
* Author and Copyright: Thomas Wilkerling
|
||||
* Licence: Apache-2.0
|
||||
* Hosted by Nextapps GmbH
|
||||
* https://github.com/nextapps-de/winbox
|
||||
*/
|
||||
(function(){'use strict';var e,aa=document.createElement("style");aa.innerHTML="@keyframes wb-fade-in{0%{opacity:0}to{opacity:.85}}.winbox{position:fixed;left:0;top:0;background:#0050ff;box-shadow:0 14px 28px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.22);transition:width .3s,height .3s,left .3s,top .3s;transition-timing-function:cubic-bezier(.3,1,.3,1);contain:layout size;text-align:left;touch-action:none}.wb-body,.wb-header{position:absolute;left:0}.wb-header{top:0;width:100%;height:35px;line-height:35px;color:#fff;overflow:hidden;z-index:1}.wb-body{top:35px;right:0;bottom:0;overflow:auto;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;will-change:contents;background:#fff;margin-top:0!important;contain:strict;z-index:0}.wb-control *,.wb-icon{background-repeat:no-repeat}.wb-drag{height:100%;padding-left:10px;cursor:move}.wb-title{font-family:Arial,sans-serif;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wb-icon{display:none;width:20px;height:100%;margin:-1px 8px 0-3px;float:left;background-size:100%;background-position:center}.wb-e,.wb-w{width:10px;top:0}.wb-n,.wb-s{left:0;height:10px;position:absolute}.wb-n{top:-5px;right:0;cursor:n-resize;z-index:2}.wb-e{position:absolute;right:-5px;bottom:0;cursor:w-resize;z-index:2}.wb-s{bottom:-5px;right:0;cursor:n-resize;z-index:2}.wb-nw,.wb-sw,.wb-w{left:-5px}.wb-w{position:absolute;bottom:0;cursor:w-resize;z-index:2}.wb-ne,.wb-nw,.wb-sw{width:15px;height:15px;z-index:2;position:absolute}.wb-nw{top:-5px;cursor:nw-resize}.wb-ne,.wb-sw{cursor:ne-resize}.wb-ne{top:-5px;right:-5px}.wb-se,.wb-sw{bottom:-5px}.wb-se{position:absolute;right:-5px;width:15px;height:15px;cursor:nw-resize;z-index:2}.wb-control{float:right;height:100%;max-width:100%;text-align:center}.wb-control *{display:inline-block;width:30px;height:100%;max-width:100%;background-position:center;cursor:pointer}.no-close .wb-close,.no-full .wb-full,.no-header .wb-header,.no-max .wb-max,.no-min .wb-min,.no-resize .wb-body~div,.wb-body .wb-hide,.wb-show,.winbox.hide,.winbox.min .wb-body>*,.winbox.min .wb-full,.winbox.min .wb-min,.winbox.modal .wb-full,.winbox.modal .wb-max,.winbox.modal .wb-min{display:none}.winbox.max .wb-drag,.winbox.min .wb-drag{cursor:default}.wb-min{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAyIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNOCAwaDdhMSAxIDAgMCAxIDAgMkgxYTEgMSAwIDAgMSAwLTJoN3oiLz48L3N2Zz4=);background-size:14px auto;background-position:center calc(50% + 6px)}.wb-max{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIHZpZXdCb3g9IjAgMCA5NiA5NiI+PHBhdGggZD0iTTIwIDcxLjMxMUMxNS4zNCA2OS42NyAxMiA2NS4yMyAxMiA2MFYyMGMwLTYuNjMgNS4zNy0xMiAxMi0xMmg0MGM1LjIzIDAgOS42NyAzLjM0IDExLjMxMSA4SDI0Yy0yLjIxIDAtNCAxLjc5LTQgNHY1MS4zMTF6Ii8+PHBhdGggZD0iTTkyIDc2VjM2YzAtNi42My01LjM3LTEyLTEyLTEySDQwYy02LjYzIDAtMTIgNS4zNy0xMiAxMnY0MGMwIDYuNjMgNS4zNyAxMiAxMiAxMmg0MGM2LjYzIDAgMTItNS4zNyAxMi0xMnptLTUyIDRjLTIuMjEgMC00LTEuNzktNC00VjM2YzAtMi4yMSAxLjc5LTQgNC00aDQwYzIuMjEgMCA0IDEuNzkgNCA0djQwYzAgMi4yMS0xLjc5IDQtNCA0SDQweiIvPjwvc3ZnPg==);background-size:17px auto}.wb-close{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ii0xIC0xIDE4IDE4Ij48cGF0aCBmaWxsPSIjZmZmIiBkPSJtMS42MTMuMjEuMDk0LjA4M0w4IDYuNTg1IDE0LjI5My4yOTNsLjA5NC0uMDgzYTEgMSAwIDAgMSAxLjQwMyAxLjQwM2wtLjA4My4wOTRMOS40MTUgOGw2LjI5MiA2LjI5M2ExIDEgMCAwIDEtMS4zMiAxLjQ5N2wtLjA5NC0uMDgzTDggOS40MTVsLTYuMjkzIDYuMjkyLS4wOTQuMDgzQTEgMSAwIDAgMSAuMjEgMTQuMzg3bC4wODMtLjA5NEw2LjU4NSA4IC4yOTMgMS43MDdBMSAxIDAgMCAxIDEuNjEzLjIxeiIvPjwvc3ZnPg==);background-size:15px auto;background-position:5px center}.wb-full{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2Utd2lkdGg9IjIuNSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCAzSDVhMiAyIDAgMCAwLTIgMnYzbTE4IDBWNWEyIDIgMCAwIDAtMi0yaC0zbTAgMThoM2EyIDIgMCAwIDAgMi0ydi0zTTMgMTZ2M2EyIDIgMCAwIDAgMiAyaDMiLz48L3N2Zz4=);background-size:16px auto}.winbox.max .wb-body~div,.winbox.min .wb-body~div,.winbox.modal .wb-body~div,.winbox.modal .wb-drag,body.wb-lock iframe{pointer-events:none}.winbox.max{box-shadow:none}.winbox.max .wb-body{margin:0!important}.winbox iframe{position:absolute;width:100%;height:100%;border:0}body.wb-lock .winbox{will-change:left,top,width,height;transition:none}.winbox.modal:before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:inherit;border-radius:inherit}.winbox.modal:after{content:'';position:absolute;top:-50vh;left:-50vw;right:-50vw;bottom:-50vh;background:#0d1117;animation:wb-fade-in .2s ease-out forwards;z-index:-1}.no-animation{transition:none}.no-shadow{box-shadow:none}.no-header .wb-body{top:0}.no-move:not(.min) .wb-title{pointer-events:none}.wb-body .wb-show{display:revert}";
|
||||
var h=document.getElementsByTagName("head")[0];h.firstChild?h.insertBefore(aa,h.firstChild):h.appendChild(aa);var ba=document.createElement("div");ba.innerHTML="<div class=wb-header><div class=wb-control><span class=wb-min></span><span class=wb-max></span><span class=wb-full></span><span class=wb-close></span></div><div class=wb-drag><div class=wb-icon></div><div class=wb-title></div></div></div><div class=wb-body></div><div class=wb-n></div><div class=wb-s></div><div class=wb-w></div><div class=wb-e></div><div class=wb-nw></div><div class=wb-ne></div><div class=wb-se></div><div class=wb-sw></div>";function k(a,b,c,f){a&&a.addEventListener(b,c,f||!1)}function l(a,b){var c=window,f=m;c&&c.removeEventListener(a,b,f||!1)}function t(a,b){a.stopPropagation();b&&a.preventDefault()}function u(a,b,c){c=""+c;a["_s_"+b]!==c&&(a.style.setProperty(b,c),a["_s_"+b]=c)};/*
|
||||
self.max &&*/
|
||||
var x=[],A=[],ca={capture:!0,passive:!1},m={capture:!0,passive:!0},B,da=0,E=10,F,J,ha,K,P,ia;
|
||||
function U(a,b){if(!(this instanceof U))return new U(a);B||ja();if(a){if(b){var c=a;a=b}if("string"===typeof a)c=a;else{var f=a.id;var d=a.index;var n=a.root;var p=a.template;c=c||a.title;var v=a.icon;var L=a.mount;var Q=a.html;var g=a.url;var q=a.width;var r=a.height;var w=a.minwidth;var C=a.minheight;var y=a.maxwidth;var z=a.maxheight;var ea=a.autosize;var D=a.overflow;var G=a.min;var H=a.max;var I=a.hidden;var fa=a.modal;var X=a.x||(fa?"center":0);var Y=a.y||(fa?"center":0);var M=a.top;var N=a.left;
|
||||
var R=a.bottom;var S=a.right;var la=a.background;var O=a.border;var T=a.header;var Z=a["class"];var ma=a.oncreate;var ra=a.onclose;var sa=a.onfocus;var ta=a.onblur;var ua=a.onmove;var va=a.onresize;var wa=a.onfullscreen;var xa=a.onmaximize;var ya=a.onminimize;var za=a.onrestore;var Aa=a.onhide;var Ba=a.onshow;var Ca=a.onload}}this.g=(p||ba).cloneNode(!0);this.g.id=this.id=f||"winbox-"+ ++da;this.g.className="winbox"+(Z?" "+("string"===typeof Z?Z:Z.join(" ")):"")+(fa?" modal":"");this.g.winbox=this;
|
||||
this.window=this.g;this.body=this.g.getElementsByClassName("wb-body")[0];this.h=T||35;A.push(this);la&&this.setBackground(la);O?u(this.body,"margin",O+(isNaN(O)?"":"px")):O=0;T&&(b=this.g.getElementsByClassName("wb-header")[0],u(b,"height",T+"px"),u(b,"line-height",T+"px"),u(this.body,"top",T+"px"));c&&this.setTitle(c);v&&this.setIcon(v);L?this.mount(L):Q?this.body.innerHTML=Q:g&&this.setUrl(g,Ca);M=M?V(M,P):0;R=R?V(R,P):0;N=N?V(N,K):0;S=S?V(S,K):0;c=K-N-S;v=P-M-R;y=y?V(y,c):c;z=z?V(z,v):v;w=w?V(w,
|
||||
y):150;C=C?V(C,z):this.h;ea?((n||B).appendChild(this.body),q=Math.max(Math.min(this.body.clientWidth+2*O+1,y),w),r=Math.max(Math.min(this.body.clientHeight+this.h+O+1,z),C),this.g.appendChild(this.body)):(q=q?V(q,y):Math.max(y/2,w)|0,r=r?V(r,z):Math.max(z/2,C)|0);X=X?V(X,c,q):N;Y=Y?V(Y,v,r):M;this.x=X;this.y=Y;this.width=q;this.height=r;this.s=w;this.o=C;this.m=y;this.l=z;this.top=M;this.right=S;this.bottom=R;this.left=N;this.index=d;this.j=D;this.focused=this.hidden=this.full=this.max=this.min=!1;
|
||||
this.onclose=ra;this.onfocus=sa;this.onblur=ta;this.onmove=ua;this.onresize=va;this.onfullscreen=wa;this.onmaximize=xa;this.onminimize=ya;this.onrestore=za;this.onhide=Aa;this.onshow=Ba;I?this.hide():this.focus();if(d||0===d)this.index=d,u(this.g,"z-index",d),d>E&&(E=d);H?this.maximize():G?this.minimize():this.resize().move();ka(this);(n||B).appendChild(this.g);ma&&ma.call(this,a)}U["new"]=function(a){return new U(a)};U.stack=function(){return A};
|
||||
function V(a,b,c){"string"===typeof a&&("center"===a?a=(b-c)/2+.5|0:"right"===a||"bottom"===a?a=b-c:(c=parseFloat(a),a="%"===(""+c!==a&&a.substring((""+c).length))?b/100*c+.5|0:c));return a}
|
||||
function ja(){B=document.body;B[J="requestFullscreen"]||B[J="msRequestFullscreen"]||B[J="webkitRequestFullscreen"]||B[J="mozRequestFullscreen"]||(J="");ha=J&&J.replace("request","exit").replace("mozRequest","mozCancel").replace("Request","Exit");k(window,"resize",function(){na();oa()});k(B,"mousedown",function(){ia=!1},!0);k(B,"mousedown",function(){if(!ia){var a=A.length;if(a)for(--a;0<=a;a--){var b=A[a];if(b.focused){b.blur();break}}}});na()}
|
||||
function ka(a){W(a,"drag");W(a,"n");W(a,"s");W(a,"w");W(a,"e");W(a,"nw");W(a,"ne");W(a,"se");W(a,"sw");k(a.g.getElementsByClassName("wb-min")[0],"click",function(b){t(b);a.min?a.restore().focus():a.minimize()});k(a.g.getElementsByClassName("wb-max")[0],"click",function(b){t(b);a.max?a.restore().focus():a.maximize().focus()});J?k(a.g.getElementsByClassName("wb-full")[0],"click",function(b){t(b);a.fullscreen().focus()}):a.addClass("no-full");k(a.g.getElementsByClassName("wb-close")[0],"click",function(b){t(b);
|
||||
a.close()||(a=null)});k(a.g,"mousedown",function(){ia=!0},!0);k(a.body,"mousedown",function(){a.focus()},!0)}function pa(a){x.splice(x.indexOf(a),1);oa();a.removeClass("min");a.min=!1;a.g.title=""}function oa(){for(var a=x.length,b={},c={},f=0,d;f<a;f++)d=x[f],d=d.left+":"+d.top,c[d]?c[d]++:(b[d]=0,c[d]=1);f=0;for(var n,p;f<a;f++)d=x[f],n=d.left+":"+d.top,p=Math.min((K-d.left-d.right)/c[n],250),d.resize(p+1|0,d.h,!0).move(d.left+b[n]*p|0,P-d.bottom-d.h,!0),b[n]++}
|
||||
function W(a,b){function c(g){t(g,!0);a.focus();if("drag"===b){if(a.min){a.restore();return}if(!a.g.classList.contains("no-max")){var q=Date.now(),r=q-Q;Q=q;if(300>r){a.max?a.restore():a.maximize();return}}}a.min||(B.classList.add("wb-lock"),(p=g.touches)&&(p=p[0])?(g=p,k(window,"touchmove",f,m),k(window,"touchend",d,m)):(k(window,"mousemove",f,m),k(window,"mouseup",d,m)),v=g.pageX,L=g.pageY)}function f(g){t(g);p&&(g=g.touches[0]);var q=g.pageX;g=g.pageY;var r=q-v,w=g-L,C=a.width,y=a.height,z=a.x,
|
||||
ea=a.y,D;if("drag"===b){if(a.g.classList.contains("no-move"))return;a.x+=r;a.y+=w;var G=D=1}else{if("e"===b||"se"===b||"ne"===b){a.width+=r;var H=1}else if("w"===b||"sw"===b||"nw"===b)a.x+=r,a.width-=r,G=H=1;if("s"===b||"se"===b||"sw"===b){a.height+=w;var I=1}else if("n"===b||"ne"===b||"nw"===b)a.y+=w,a.height-=w,D=I=1}H&&(a.width=Math.max(Math.min(a.width,a.m,K-a.x-a.right),a.s),H=a.width!==C);I&&(a.height=Math.max(Math.min(a.height,a.l,P-a.y-a.bottom),a.o),I=a.height!==y);(H||I)&&a.resize();G&&
|
||||
(a.max&&(a.x=(q<K/3?a.left:q>K/3*2?K-a.width-a.right:K/2-a.width/2)+r),a.x=Math.max(Math.min(a.x,a.j?K-30:K-a.width-a.right),a.j?30-a.width:a.left),G=a.x!==z);D&&(a.max&&(a.y=a.top+w),a.y=Math.max(Math.min(a.y,a.j?P-a.h:P-a.height-a.bottom),a.top),D=a.y!==ea);if(G||D)a.max&&a.restore(),a.move();if(H||G)v=q;if(I||D)L=g}function d(g){t(g);B.classList.remove("wb-lock");p?(l("touchmove",f),l("touchend",d)):(l("mousemove",f),l("mouseup",d))}var n=a.g.getElementsByClassName("wb-"+b)[0];if(n){var p,v,L,
|
||||
Q=0;k(n,"mousedown",c,ca);k(n,"touchstart",c,ca)}}function na(){var a=document.documentElement;K=a.clientWidth;P=a.clientHeight}e=U.prototype;e.mount=function(a){this.unmount();a.i||(a.i=a.parentNode);this.body.textContent="";this.body.appendChild(a);return this};e.unmount=function(a){var b=this.body.firstChild;if(b){var c=a||b.i;c&&c.appendChild(b);b.i=a}return this};
|
||||
e.setTitle=function(a){var b=this.g.getElementsByClassName("wb-title")[0];a=this.title=a;var c=b.firstChild;c?c.nodeValue=a:b.textContent=a;return this};e.setIcon=function(a){var b=this.g.getElementsByClassName("wb-icon")[0];u(b,"background-image","url("+a+")");u(b,"display","inline-block");return this};e.setBackground=function(a){u(this.g,"background",a);return this};
|
||||
e.setUrl=function(a,b){var c=this.body.firstChild;c&&"iframe"===c.tagName.toLowerCase()?c.src=a:(this.body.innerHTML='<iframe src="'+a+'"></iframe>',b&&(this.body.firstChild.onload=b));return this};e.focus=function(a){if(!1===a)return this.blur();if(!this.focused){a=A.length;if(1<a)for(var b=1;b<=a;b++){var c=A[a-b];if(c.focused){c.blur();A.push(A.splice(A.indexOf(this),1)[0]);break}}u(this.g,"z-index",++E);this.index=E;this.addClass("focus");this.focused=!0;this.onfocus&&this.onfocus()}return this};
|
||||
e.blur=function(a){if(!1===a)return this.focus();this.focused&&(this.removeClass("focus"),this.focused=!1,this.onblur&&this.onblur());return this};e.hide=function(a){if(!1===a)return this.show();if(!this.hidden)return this.onhide&&this.onhide(),this.hidden=!0,this.addClass("hide")};e.show=function(a){if(!1===a)return this.hide();if(this.hidden)return this.onshow&&this.onshow(),this.hidden=!1,this.removeClass("hide")};
|
||||
e.minimize=function(a){if(!1===a)return this.restore();F&&qa();this.max&&(this.removeClass("max"),this.max=!1);this.min||(x.push(this),oa(),this.g.title=this.title,this.addClass("min"),this.min=!0,this.focused&&(this.blur(),Da()),this.onminimize&&this.onminimize());return this};function Da(){var a=A.length;if(a)for(--a;0<=a;a--){var b=A[a];if(!b.min){b.focus();break}}}
|
||||
e.restore=function(){F&&qa();this.min&&(pa(this),this.resize().move(),this.onrestore&&this.onrestore());this.max&&(this.max=!1,this.removeClass("max").resize().move(),this.onrestore&&this.onrestore());return this};e.maximize=function(a){if(!1===a)return this.restore();F&&qa();this.min&&pa(this);this.max||(this.addClass("max").resize(K-this.left-this.right,P-this.top-this.bottom,!0).move(this.left,this.top,!0),this.max=!0,this.onmaximize&&this.onmaximize());return this};
|
||||
e.fullscreen=function(a){this.min&&(pa(this),this.resize().move());if(!F||!qa())this.body[J](),F=this,this.full=!0,this.onfullscreen&&this.onfullscreen();else if(!1===a)return this.restore();return this};function qa(){F.full=!1;if(document.fullscreen||document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)return document[ha](),!0}
|
||||
e.close=function(a){if(this.onclose&&this.onclose(a))return!0;this.min&&pa(this);A.splice(A.indexOf(this),1);this.unmount();this.g.remove();this.g.textContent="";this.g=this.body=this.g.winbox=null;this.focused&&Da()};e.move=function(a,b,c){a||0===a?c||(this.x=a?a=V(a,K-this.left-this.right,this.width):0,this.y=b?b=V(b,P-this.top-this.bottom,this.height):0):(a=this.x,b=this.y);u(this.g,"left",a+"px");u(this.g,"top",b+"px");this.onmove&&this.onmove(a,b);return this};
|
||||
e.resize=function(a,b,c){a||0===a?c||(this.width=a?a=V(a,this.m):0,this.height=b?b=V(b,this.l):0,a=Math.max(a,this.s),b=Math.max(b,this.o)):(a=this.width,b=this.height);u(this.g,"width",a+"px");u(this.g,"height",b+"px");this.onresize&&this.onresize(a,b);return this};
|
||||
e.addControl=function(a){var b=a["class"],c=a.image,f=a.click;a=a.index;var d=document.createElement("span"),n=this.g.getElementsByClassName("wb-control")[0],p=this;b&&(d.className=b);c&&u(d,"background-image","url("+c+")");f&&(d.onclick=function(v){f.call(this,v,p)});n.insertBefore(d,n.childNodes[a||0]);return this};e.removeControl=function(a){(a=this.g.getElementsByClassName(a)[0])&&a.remove();return this};e.addClass=function(a){this.g.classList.add(a);return this};
|
||||
e.removeClass=function(a){this.g.classList.remove(a);return this};e.toggleClass=function(a){return this.g.classList.contains(a)?this.removeClass(a):this.addClass(a)};window.WinBox=U;}).call(this);
|
||||
7696
src/assets/xrfragment.aframe.js
Normal file
7696
src/assets/xrfragment.aframe.js
Normal file
File diff suppressed because one or more lines are too long
51
src/browser-extension/content.js
Normal file
51
src/browser-extension/content.js
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
function waitForAScene(callback) {
|
||||
|
||||
let scene = document.querySelector("a-scene")
|
||||
if( scene ) return callback(scene)
|
||||
|
||||
// Create a MutationObserver to monitor the DOM for changes
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
for (const mutation of mutations) {
|
||||
// Check if new nodes are added
|
||||
if (mutation.type === "childList" && mutation.addedNodes.length > 0) {
|
||||
for (const node of mutation.addedNodes) {
|
||||
// Check if the added node is <a-scene> or contains one
|
||||
if (node.nodeName === "A-SCENE" || node.querySelector?.("a-scene")) {
|
||||
observer.disconnect(); // Stop observing once found
|
||||
callback(node.nodeName === "A-SCENE" ? node : node.querySelector("a-scene"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Start observing the entire document for child node additions
|
||||
observer.observe(document.documentElement, {
|
||||
childList: true, // Observe direct children changes
|
||||
subtree: true, // Observe all levels of the DOM
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Example usage
|
||||
waitForAScene((aScene) => {
|
||||
|
||||
if( aScene.innerHTML.match(/ isoterminal/) ) return; // prevent duplicates
|
||||
|
||||
// Inject the external script
|
||||
const xrshScript = document.createElement("script");
|
||||
xrshScript.src = chrome.runtime.getURL("xrsh.js");
|
||||
document.head.appendChild(xrshScript);
|
||||
|
||||
// Add the A-Frame entity after the script loads
|
||||
xrshScript.onload = () => {
|
||||
const scene = document.querySelector("a-scene");
|
||||
if (scene) {
|
||||
const entity = document.createElement("a-entity");
|
||||
entity.setAttribute("isoterminal", "");
|
||||
entity.setAttribute("position", "0 1.6 -0.3");
|
||||
scene.appendChild(entity);
|
||||
}
|
||||
};
|
||||
});
|
||||
BIN
src/browser-extension/icon.png
Normal file
BIN
src/browser-extension/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
24
src/browser-extension/manifest.json
Normal file
24
src/browser-extension/manifest.json
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"manifest_version": 3,
|
||||
"name": "XRSH",
|
||||
"version": "1.0",
|
||||
"description": "Injects XRSH Terminal into WebXR [AFRAME] scenes.",
|
||||
"permissions": ["scripting", "activeTab"],
|
||||
"host_permissions": ["<all_urls>"],
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["<all_urls>"],
|
||||
"js": ["content.js"],
|
||||
"run_at": "document_end"
|
||||
}
|
||||
],
|
||||
"web_accessible_resources": [
|
||||
{
|
||||
"resources": ["xrsh.js"],
|
||||
"matches": ["<all_urls>"]
|
||||
}
|
||||
],
|
||||
"icons": {
|
||||
"128": "icon.png"
|
||||
}
|
||||
}
|
||||
1
src/browser-extension/xrsh.js
Symbolic link
1
src/browser-extension/xrsh.js
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../xrsh.js
|
||||
1
src/com
Symbolic link
1
src/com
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
xrsh-com/com
|
||||
37894
src/dist/index.443d2602.js
vendored
Normal file
37894
src/dist/index.443d2602.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
src/dist/index.443d2602.js.map
vendored
Normal file
1
src/dist/index.443d2602.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
251
src/dist/index.c2bf9ea7.js
vendored
Normal file
251
src/dist/index.c2bf9ea7.js
vendored
Normal file
|
|
@ -0,0 +1,251 @@
|
|||
// this is a highlevel way of loading buildless 'apps' (a collection of js components)
|
||||
AFRAME.required = {};
|
||||
AFRAME.app = new Proxy({
|
||||
add (component, entity) {
|
||||
this[component] = this[component] || [];
|
||||
this[component].push(entity);
|
||||
},
|
||||
foreach (cb) {
|
||||
for(let i in this)if (typeof this[i] != "function") this[i].map((app)=>cb({
|
||||
app,
|
||||
component: i
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
get (me, k) {
|
||||
return me[k];
|
||||
},
|
||||
set (me, k, v) {
|
||||
me[k] = v;
|
||||
}
|
||||
});
|
||||
AFRAME.registerComponent("app", {
|
||||
schema: {
|
||||
"uri": {
|
||||
type: "string"
|
||||
}
|
||||
},
|
||||
events: {
|
||||
"app:ready": function() {
|
||||
let { id, component, type } = this.parseAppURI(this.data.uri);
|
||||
AFRAME.app[component].map((app)=>{
|
||||
if (!app.el.getAttribute(component)) app.el.setAttribute(component, app.data);
|
||||
});
|
||||
}
|
||||
},
|
||||
init: function() {
|
||||
let { id, component, type } = this.parseAppURI(this.data.uri);
|
||||
let sel = `script#${component}`;
|
||||
if (AFRAME.app[component] || AFRAME.components[component] || document.head.querySelector(sel)) return AFRAME.app.add(component, this);
|
||||
AFRAME.app.add(component, this);
|
||||
this.require([
|
||||
this.data.uri
|
||||
], "app:ready");
|
||||
},
|
||||
parseAppURI: AFRAME.AComponent.prototype.parseAppURI = function(uri) {
|
||||
return {
|
||||
id: String(uri).split("/").pop(),
|
||||
component: String(uri).split("/").pop().split(".js").shift(),
|
||||
type: String(uri).split(".").pop() // 'mycom.js' => 'js'
|
||||
};
|
||||
},
|
||||
// usage: require(["./app/foo.js"])
|
||||
// require({foo: "https://foo.com/foo.js"})
|
||||
require: AFRAME.AComponent.prototype.require = function(packages, readyEvent) {
|
||||
let deps = [];
|
||||
if (!packages.map) packages = Object.values(packages);
|
||||
packages.map((_package)=>{
|
||||
let id = _package.split("/").pop();
|
||||
// prevent duplicate requests
|
||||
if (AFRAME.required[id]) return;
|
||||
AFRAME.required[id] = true;
|
||||
if (!document.head.querySelector(`script#${id}`)) {
|
||||
let { id, component, type } = this.parseAppURI(_package);
|
||||
let p = new Promise((resolve, reject)=>{
|
||||
switch(type){
|
||||
case "js":
|
||||
let script = document.createElement("script");
|
||||
script.id = id;
|
||||
script.src = _package;
|
||||
script.onload = ()=>resolve();
|
||||
script.onerror = (e)=>reject(e);
|
||||
document.head.appendChild(script);
|
||||
break;
|
||||
case "css":
|
||||
let link = document.createElement("link");
|
||||
link.id = id;
|
||||
link.href = _package;
|
||||
link.rel = "stylesheet";
|
||||
document.head.appendChild(link);
|
||||
resolve();
|
||||
break;
|
||||
}
|
||||
});
|
||||
deps.push(p);
|
||||
}
|
||||
});
|
||||
Promise.all(deps).then(()=>this.el.emit(readyEvent || "ready", packages));
|
||||
}
|
||||
});
|
||||
// monkeypatching initComponent will trigger events when components
|
||||
// are initialized (that way apps can react to attached components)
|
||||
// basically, in both situations:
|
||||
// <a-entity foo="a:1"/>
|
||||
// <a-entity app="uri: myapp.js"/> <!-- myapp.js calls this.require(['foo.js']) -->
|
||||
//
|
||||
// event 'foo' will be triggered as both entities (in)directly require component 'foo'
|
||||
AFRAME.AComponent.prototype.initComponent = function(initComponent) {
|
||||
return function() {
|
||||
this.el.emit(this.attrName, this);
|
||||
this.scene = AFRAME.scenes[0] // mount scene for convenience
|
||||
;
|
||||
return initComponent.apply(this, arguments);
|
||||
};
|
||||
}(AFRAME.AComponent.prototype.initComponent);
|
||||
AFRAME.AComponent.prototype.updateProperties = function(updateProperties) {
|
||||
return function() {
|
||||
updateProperties.apply(this, arguments);
|
||||
if (this.dom && this.data && this.data.uri) {
|
||||
tasks = {
|
||||
generateUniqueId: ()=>{
|
||||
this.el.uid = String(Math.random()).substr(10);
|
||||
return tasks;
|
||||
},
|
||||
ensureOverlay: ()=>{
|
||||
let overlay = document.querySelector("#overlay");
|
||||
if (!overlay) {
|
||||
overlay = document.createElement("div");
|
||||
overlay.id = "overlay";
|
||||
document.body.appendChild(overlay);
|
||||
document.querySelector("a-scene").setAttribute("webxr", "overlayElement:#overlay");
|
||||
}
|
||||
tasks.overlay = overlay;
|
||||
return tasks;
|
||||
},
|
||||
createReactiveDOMElement: ()=>{
|
||||
const reactify = (el, aframe)=>new Proxy(this.data, {
|
||||
get (me, k, v) {
|
||||
return me[k];
|
||||
},
|
||||
set (me, k, v) {
|
||||
me[k] = v;
|
||||
aframe.emit(k, {
|
||||
el,
|
||||
k,
|
||||
v
|
||||
});
|
||||
}
|
||||
});
|
||||
this.el.dom = document.createElement("div");
|
||||
this.el.dom.className = this.parseAppURI(this.data.uri).component;
|
||||
this.el.dom.innerHTML = this.dom.html(this);
|
||||
this.data = reactify(this.dom.el, this.el);
|
||||
this.dom.events.map((e)=>this.el.dom.addEventListener(e, (ev)=>this.el.emit(e, ev)));
|
||||
return tasks;
|
||||
},
|
||||
addCSS: ()=>{
|
||||
if (this.dom.css && !document.head.querySelector(`style#${this.attrName}`)) document.head.innerHTML += `<style id="${this.attrName}">${this.dom.css}</style>`;
|
||||
return tasks;
|
||||
},
|
||||
scaleDOMvsXR: ()=>{
|
||||
if (this.dom.scale) this.el.setAttribute("scale", `${this.dom.scale} ${this.dom.scale} ${this.dom.scale}`);
|
||||
return tasks;
|
||||
},
|
||||
addModalFunctions: ()=>{
|
||||
this.el.close = ()=>{
|
||||
this.el.dom.remove();
|
||||
this.el.removeAttribute("html");
|
||||
};
|
||||
return tasks;
|
||||
}
|
||||
};
|
||||
tasks.generateUniqueId().ensureOverlay().addCSS().createReactiveDOMElement().scaleDOMvsXR().addModalFunctions();
|
||||
tasks.overlay.appendChild(this.el.dom);
|
||||
this.el.emit("DOMready", {
|
||||
el: this.el.dom
|
||||
});
|
||||
}
|
||||
};
|
||||
}(AFRAME.AComponent.prototype.updateProperties);
|
||||
document.head.innerHTML += `
|
||||
<style type="text/css">
|
||||
/* CSS reset */
|
||||
html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace, monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type="button"],[type="reset"],[type="submit"],button{-webkit-appearance:button}[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}
|
||||
|
||||
a-scene{
|
||||
position:fixed;
|
||||
top:0;
|
||||
left:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
}
|
||||
canvas{
|
||||
z-index:10;
|
||||
}
|
||||
|
||||
#overlay{
|
||||
display: flex; /* tile modals */
|
||||
z-index:10;
|
||||
}
|
||||
#overlay.hide{
|
||||
z-index:-10;
|
||||
}
|
||||
|
||||
#toggle_overlay{
|
||||
position: fixed;
|
||||
right: 20px;
|
||||
bottom: 73px;
|
||||
width: 58px;
|
||||
text-align: center;
|
||||
height: 40px;
|
||||
padding: 0;
|
||||
z-index: 100;
|
||||
border: 3px solid #3aacff;
|
||||
border-radius:11px;
|
||||
transition:0.3s;
|
||||
padding: 0px;
|
||||
font-weight: bold;
|
||||
cursor:pointer;
|
||||
font-family:sans-serif;
|
||||
font-size:15px;
|
||||
color: #FFF;
|
||||
background: #3aacff;
|
||||
transition:0.5s;
|
||||
}
|
||||
.XR #toggle_overlay{
|
||||
background: transparent;
|
||||
color: #3aacff;
|
||||
}
|
||||
|
||||
.XR #overlay{
|
||||
visibility: hidden;
|
||||
}
|
||||
</style>
|
||||
`;
|
||||
// draw a button so we can toggle apps between 2D / XR
|
||||
let toggle = (state)=>{
|
||||
state = state || document.body.className.match(/XR/);
|
||||
document.body.classList[state ? "remove" : "add"]([
|
||||
"XR"
|
||||
]);
|
||||
AFRAME.scenes[0].emit(state ? "apps:2D" : "apps:XR");
|
||||
};
|
||||
document.addEventListener("DOMContentLoaded", (event)=>{
|
||||
let btn = document.createElement("button");
|
||||
btn.id = "toggle_overlay";
|
||||
btn.innerText = "XRSH";
|
||||
btn.addEventListener("click", (e)=>toggle());
|
||||
document.body.appendChild(btn);
|
||||
document.querySelector("a-scene").addEventListener("enter-vr", ()=>toggle(true));
|
||||
document.querySelector("a-scene").addEventListener("exit-vr", ()=>toggle(false));
|
||||
document.querySelector("a-scene").addEventListener("loaded", ()=>{
|
||||
let VRbtn = document.querySelector("a-scene .a-enter-vr");
|
||||
let ARbtn = document.querySelector("a-scene .a-enter-ar");
|
||||
if (VRbtn) document.body.appendChild(VRbtn) // move to body
|
||||
;
|
||||
if (ARbtn) document.body.appendChild(ARbtn) // so they will always be visible
|
||||
;
|
||||
});
|
||||
});
|
||||
|
||||
//# sourceMappingURL=index.c2bf9ea7.js.map
|
||||
1
src/dist/index.c2bf9ea7.js.map
vendored
Normal file
1
src/dist/index.c2bf9ea7.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
43
src/dist/index.html
vendored
Normal file
43
src/dist/index.html
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>xrsh</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<script src="/index.443d2602.js"></script>
|
||||
<script src="/index.c2bf9ea7.js"></script>
|
||||
|
||||
|
||||
<!-- user app extensions -->
|
||||
<!-- <script>AFRAME.components['helloworld'].Component.prototype.dependencies["https://acme.com/myExtension.js"]</script> -->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<a-scene webxr="overlayElement:#-overlay;" light="defaultLightsEnabled: true" cursor="rayOrigin: mouse" raycaster="objects: [html]; interval:100;">
|
||||
|
||||
<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-entity position=" 0 1.5 -1" app="uri: app/helloworld.js; foo: bar"></a-entity>
|
||||
<a-entity position=" 0 1.5 -1" app="uri: app/manual.js; foo: bar"></a-entity>
|
||||
<a-entity app="uri: app/apptiler.js; foo: bar"></a-entity>
|
||||
|
||||
<a-entity id="player" wasd-controls="" look-controls="">
|
||||
<a-entity id="left-hand" laser-controls="hand: left" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: #floor">
|
||||
<a-entity rotation="-35 0 0" position="0 0.1 0" id="navigator">
|
||||
<a-entity id="back" xrf-button="label: <; width:0.05; action: history.back()" position="-0.025 0 0" class="ray"></a-entity>
|
||||
<a-entity id="next" xrf-button="label: >; width:0.05; action: history.forward()" position=" 0.025 0 0" class="ray"></a-entity>
|
||||
</a-entity>
|
||||
</a-entity>
|
||||
<a-entity id="right-hand" laser-controls="hand: right" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: #floor"></a-entity>
|
||||
<a-entity camera="fov:90" position="0 1.6 0" id="camera"></a-entity>
|
||||
</a-entity>
|
||||
|
||||
<!-- addressible & navigatable worlds -->
|
||||
<a-entity xrf=""></a-entity>
|
||||
|
||||
</a-scene>
|
||||
|
||||
<script src="/xrsh.3464ddca.js"></script></body>
|
||||
</html>
|
||||
585
src/dist/xrsh.3464ddca.js
vendored
Normal file
585
src/dist/xrsh.3464ddca.js
vendored
Normal file
|
|
@ -0,0 +1,585 @@
|
|||
// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
|
||||
(function (modules, entry, mainEntry, parcelRequireName, globalName) {
|
||||
/* eslint-disable no-undef */
|
||||
var globalObject =
|
||||
typeof globalThis !== 'undefined'
|
||||
? globalThis
|
||||
: typeof self !== 'undefined'
|
||||
? self
|
||||
: typeof window !== 'undefined'
|
||||
? window
|
||||
: typeof global !== 'undefined'
|
||||
? global
|
||||
: {};
|
||||
/* eslint-enable no-undef */
|
||||
|
||||
// Save the require from previous bundle to this closure if any
|
||||
var previousRequire =
|
||||
typeof globalObject[parcelRequireName] === 'function' &&
|
||||
globalObject[parcelRequireName];
|
||||
|
||||
var cache = previousRequire.cache || {};
|
||||
// Do not use `require` to prevent Webpack from trying to bundle this call
|
||||
var nodeRequire =
|
||||
typeof module !== 'undefined' &&
|
||||
typeof module.require === 'function' &&
|
||||
module.require.bind(module);
|
||||
|
||||
function newRequire(name, jumped) {
|
||||
if (!cache[name]) {
|
||||
if (!modules[name]) {
|
||||
// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var currentRequire =
|
||||
typeof globalObject[parcelRequireName] === 'function' &&
|
||||
globalObject[parcelRequireName];
|
||||
if (!jumped && currentRequire) {
|
||||
return currentRequire(name, true);
|
||||
}
|
||||
|
||||
// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if (previousRequire) {
|
||||
return previousRequire(name, true);
|
||||
}
|
||||
|
||||
// Try the node require function if it exists.
|
||||
if (nodeRequire && typeof name === 'string') {
|
||||
return nodeRequire(name);
|
||||
}
|
||||
|
||||
var err = new Error("Cannot find module '" + name + "'");
|
||||
err.code = 'MODULE_NOT_FOUND';
|
||||
throw err;
|
||||
}
|
||||
|
||||
localRequire.resolve = resolve;
|
||||
localRequire.cache = {};
|
||||
|
||||
var module = (cache[name] = new newRequire.Module(name));
|
||||
|
||||
modules[name][0].call(
|
||||
module.exports,
|
||||
localRequire,
|
||||
module,
|
||||
module.exports,
|
||||
this
|
||||
);
|
||||
}
|
||||
|
||||
return cache[name].exports;
|
||||
|
||||
function localRequire(x) {
|
||||
var res = localRequire.resolve(x);
|
||||
return res === false ? {} : newRequire(res);
|
||||
}
|
||||
|
||||
function resolve(x) {
|
||||
var id = modules[name][1][x];
|
||||
return id != null ? id : x;
|
||||
}
|
||||
}
|
||||
|
||||
function Module(moduleName) {
|
||||
this.id = moduleName;
|
||||
this.bundle = newRequire;
|
||||
this.exports = {};
|
||||
}
|
||||
|
||||
newRequire.isParcelRequire = true;
|
||||
newRequire.Module = Module;
|
||||
newRequire.modules = modules;
|
||||
newRequire.cache = cache;
|
||||
newRequire.parent = previousRequire;
|
||||
newRequire.register = function (id, exports) {
|
||||
modules[id] = [
|
||||
function (require, module) {
|
||||
module.exports = exports;
|
||||
},
|
||||
{},
|
||||
];
|
||||
};
|
||||
|
||||
Object.defineProperty(newRequire, 'root', {
|
||||
get: function () {
|
||||
return globalObject[parcelRequireName];
|
||||
},
|
||||
});
|
||||
|
||||
globalObject[parcelRequireName] = newRequire;
|
||||
|
||||
for (var i = 0; i < entry.length; i++) {
|
||||
newRequire(entry[i]);
|
||||
}
|
||||
|
||||
if (mainEntry) {
|
||||
// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var mainExports = newRequire(mainEntry);
|
||||
|
||||
// CommonJS
|
||||
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
||||
module.exports = mainExports;
|
||||
|
||||
// RequireJS
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return mainExports;
|
||||
});
|
||||
|
||||
// <script>
|
||||
} else if (globalName) {
|
||||
this[globalName] = mainExports;
|
||||
}
|
||||
}
|
||||
})({"lHQeq":[function(require,module,exports) {
|
||||
var global = arguments[3];
|
||||
var HMR_HOST = null;
|
||||
var HMR_PORT = null;
|
||||
var HMR_SECURE = false;
|
||||
var HMR_ENV_HASH = "d6ea1d42532a7575";
|
||||
module.bundle.HMR_BUNDLE_ID = "0907ca6d3464ddca";
|
||||
"use strict";
|
||||
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope */ /*::
|
||||
import type {
|
||||
HMRAsset,
|
||||
HMRMessage,
|
||||
} from '@parcel/reporter-dev-server/src/HMRServer.js';
|
||||
interface ParcelRequire {
|
||||
(string): mixed;
|
||||
cache: {|[string]: ParcelModule|};
|
||||
hotData: {|[string]: mixed|};
|
||||
Module: any;
|
||||
parent: ?ParcelRequire;
|
||||
isParcelRequire: true;
|
||||
modules: {|[string]: [Function, {|[string]: string|}]|};
|
||||
HMR_BUNDLE_ID: string;
|
||||
root: ParcelRequire;
|
||||
}
|
||||
interface ParcelModule {
|
||||
hot: {|
|
||||
data: mixed,
|
||||
accept(cb: (Function) => void): void,
|
||||
dispose(cb: (mixed) => void): void,
|
||||
// accept(deps: Array<string> | string, cb: (Function) => void): void,
|
||||
// decline(): void,
|
||||
_acceptCallbacks: Array<(Function) => void>,
|
||||
_disposeCallbacks: Array<(mixed) => void>,
|
||||
|};
|
||||
}
|
||||
interface ExtensionContext {
|
||||
runtime: {|
|
||||
reload(): void,
|
||||
getURL(url: string): string;
|
||||
getManifest(): {manifest_version: number, ...};
|
||||
|};
|
||||
}
|
||||
declare var module: {bundle: ParcelRequire, ...};
|
||||
declare var HMR_HOST: string;
|
||||
declare var HMR_PORT: string;
|
||||
declare var HMR_ENV_HASH: string;
|
||||
declare var HMR_SECURE: boolean;
|
||||
declare var chrome: ExtensionContext;
|
||||
declare var browser: ExtensionContext;
|
||||
declare var __parcel__import__: (string) => Promise<void>;
|
||||
declare var __parcel__importScripts__: (string) => Promise<void>;
|
||||
declare var globalThis: typeof self;
|
||||
declare var ServiceWorkerGlobalScope: Object;
|
||||
*/ var OVERLAY_ID = "__parcel__error__overlay__";
|
||||
var OldModule = module.bundle.Module;
|
||||
function Module(moduleName) {
|
||||
OldModule.call(this, moduleName);
|
||||
this.hot = {
|
||||
data: module.bundle.hotData[moduleName],
|
||||
_acceptCallbacks: [],
|
||||
_disposeCallbacks: [],
|
||||
accept: function(fn) {
|
||||
this._acceptCallbacks.push(fn || function() {});
|
||||
},
|
||||
dispose: function(fn) {
|
||||
this._disposeCallbacks.push(fn);
|
||||
}
|
||||
};
|
||||
module.bundle.hotData[moduleName] = undefined;
|
||||
}
|
||||
module.bundle.Module = Module;
|
||||
module.bundle.hotData = {};
|
||||
var checkedAssets /*: {|[string]: boolean|} */ , assetsToDispose /*: Array<[ParcelRequire, string]> */ , assetsToAccept /*: Array<[ParcelRequire, string]> */ ;
|
||||
function getHostname() {
|
||||
return HMR_HOST || (location.protocol.indexOf("http") === 0 ? location.hostname : "localhost");
|
||||
}
|
||||
function getPort() {
|
||||
return HMR_PORT || location.port;
|
||||
}
|
||||
// eslint-disable-next-line no-redeclare
|
||||
var parent = module.bundle.parent;
|
||||
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== "undefined") {
|
||||
var hostname = getHostname();
|
||||
var port = getPort();
|
||||
var protocol = HMR_SECURE || location.protocol == "https:" && ![
|
||||
"localhost",
|
||||
"127.0.0.1",
|
||||
"0.0.0.0"
|
||||
].includes(hostname) ? "wss" : "ws";
|
||||
var ws;
|
||||
try {
|
||||
ws = new WebSocket(protocol + "://" + hostname + (port ? ":" + port : "") + "/");
|
||||
} catch (err) {
|
||||
if (err.message) console.error(err.message);
|
||||
ws = {};
|
||||
}
|
||||
// Web extension context
|
||||
var extCtx = typeof browser === "undefined" ? typeof chrome === "undefined" ? null : chrome : browser;
|
||||
// Safari doesn't support sourceURL in error stacks.
|
||||
// eval may also be disabled via CSP, so do a quick check.
|
||||
var supportsSourceURL = false;
|
||||
try {
|
||||
(0, eval)('throw new Error("test"); //# sourceURL=test.js');
|
||||
} catch (err) {
|
||||
supportsSourceURL = err.stack.includes("test.js");
|
||||
}
|
||||
// $FlowFixMe
|
||||
ws.onmessage = async function(event /*: {data: string, ...} */ ) {
|
||||
checkedAssets = {} /*: {|[string]: boolean|} */ ;
|
||||
assetsToAccept = [];
|
||||
assetsToDispose = [];
|
||||
var data /*: HMRMessage */ = JSON.parse(event.data);
|
||||
if (data.type === "update") {
|
||||
// Remove error overlay if there is one
|
||||
if (typeof document !== "undefined") removeErrorOverlay();
|
||||
let assets = data.assets.filter((asset)=>asset.envHash === HMR_ENV_HASH);
|
||||
// Handle HMR Update
|
||||
let handled = assets.every((asset)=>{
|
||||
return asset.type === "css" || asset.type === "js" && hmrAcceptCheck(module.bundle.root, asset.id, asset.depsByBundle);
|
||||
});
|
||||
if (handled) {
|
||||
console.clear();
|
||||
// Dispatch custom event so other runtimes (e.g React Refresh) are aware.
|
||||
if (typeof window !== "undefined" && typeof CustomEvent !== "undefined") window.dispatchEvent(new CustomEvent("parcelhmraccept"));
|
||||
await hmrApplyUpdates(assets);
|
||||
// Dispose all old assets.
|
||||
let processedAssets = {} /*: {|[string]: boolean|} */ ;
|
||||
for(let i = 0; i < assetsToDispose.length; i++){
|
||||
let id = assetsToDispose[i][1];
|
||||
if (!processedAssets[id]) {
|
||||
hmrDispose(assetsToDispose[i][0], id);
|
||||
processedAssets[id] = true;
|
||||
}
|
||||
}
|
||||
// Run accept callbacks. This will also re-execute other disposed assets in topological order.
|
||||
processedAssets = {};
|
||||
for(let i = 0; i < assetsToAccept.length; i++){
|
||||
let id = assetsToAccept[i][1];
|
||||
if (!processedAssets[id]) {
|
||||
hmrAccept(assetsToAccept[i][0], id);
|
||||
processedAssets[id] = true;
|
||||
}
|
||||
}
|
||||
} else fullReload();
|
||||
}
|
||||
if (data.type === "error") {
|
||||
// Log parcel errors to console
|
||||
for (let ansiDiagnostic of data.diagnostics.ansi){
|
||||
let stack = ansiDiagnostic.codeframe ? ansiDiagnostic.codeframe : ansiDiagnostic.stack;
|
||||
console.error("\uD83D\uDEA8 [parcel]: " + ansiDiagnostic.message + "\n" + stack + "\n\n" + ansiDiagnostic.hints.join("\n"));
|
||||
}
|
||||
if (typeof document !== "undefined") {
|
||||
// Render the fancy html overlay
|
||||
removeErrorOverlay();
|
||||
var overlay = createErrorOverlay(data.diagnostics.html);
|
||||
// $FlowFixMe
|
||||
document.body.appendChild(overlay);
|
||||
}
|
||||
}
|
||||
};
|
||||
ws.onerror = function(e) {
|
||||
if (e.message) console.error(e.message);
|
||||
};
|
||||
ws.onclose = function() {
|
||||
console.warn("[parcel] \uD83D\uDEA8 Connection to the HMR server was lost");
|
||||
};
|
||||
}
|
||||
function removeErrorOverlay() {
|
||||
var overlay = document.getElementById(OVERLAY_ID);
|
||||
if (overlay) {
|
||||
overlay.remove();
|
||||
console.log("[parcel] \u2728 Error resolved");
|
||||
}
|
||||
}
|
||||
function createErrorOverlay(diagnostics) {
|
||||
var overlay = document.createElement("div");
|
||||
overlay.id = OVERLAY_ID;
|
||||
let errorHTML = '<div style="background: black; opacity: 0.85; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; font-family: Menlo, Consolas, monospace; z-index: 9999;">';
|
||||
for (let diagnostic of diagnostics){
|
||||
let stack = diagnostic.frames.length ? diagnostic.frames.reduce((p, frame)=>{
|
||||
return `${p}
|
||||
<a href="/__parcel_launch_editor?file=${encodeURIComponent(frame.location)}" style="text-decoration: underline; color: #888" onclick="fetch(this.href); return false">${frame.location}</a>
|
||||
${frame.code}`;
|
||||
}, "") : diagnostic.stack;
|
||||
errorHTML += `
|
||||
<div>
|
||||
<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">
|
||||
\u{1F6A8} ${diagnostic.message}
|
||||
</div>
|
||||
<pre>${stack}</pre>
|
||||
<div>
|
||||
${diagnostic.hints.map((hint)=>"<div>\uD83D\uDCA1 " + hint + "</div>").join("")}
|
||||
</div>
|
||||
${diagnostic.documentation ? `<div>\u{1F4DD} <a style="color: violet" href="${diagnostic.documentation}" target="_blank">Learn more</a></div>` : ""}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
errorHTML += "</div>";
|
||||
overlay.innerHTML = errorHTML;
|
||||
return overlay;
|
||||
}
|
||||
function fullReload() {
|
||||
if ("reload" in location) location.reload();
|
||||
else if (extCtx && extCtx.runtime && extCtx.runtime.reload) extCtx.runtime.reload();
|
||||
}
|
||||
function getParents(bundle, id) /*: Array<[ParcelRequire, string]> */ {
|
||||
var modules = bundle.modules;
|
||||
if (!modules) return [];
|
||||
var parents = [];
|
||||
var k, d, dep;
|
||||
for(k in modules)for(d in modules[k][1]){
|
||||
dep = modules[k][1][d];
|
||||
if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) parents.push([
|
||||
bundle,
|
||||
k
|
||||
]);
|
||||
}
|
||||
if (bundle.parent) parents = parents.concat(getParents(bundle.parent, id));
|
||||
return parents;
|
||||
}
|
||||
function updateLink(link) {
|
||||
var href = link.getAttribute("href");
|
||||
if (!href) return;
|
||||
var newLink = link.cloneNode();
|
||||
newLink.onload = function() {
|
||||
if (link.parentNode !== null) // $FlowFixMe
|
||||
link.parentNode.removeChild(link);
|
||||
};
|
||||
newLink.setAttribute("href", // $FlowFixMe
|
||||
href.split("?")[0] + "?" + Date.now());
|
||||
// $FlowFixMe
|
||||
link.parentNode.insertBefore(newLink, link.nextSibling);
|
||||
}
|
||||
var cssTimeout = null;
|
||||
function reloadCSS() {
|
||||
if (cssTimeout) return;
|
||||
cssTimeout = setTimeout(function() {
|
||||
var links = document.querySelectorAll('link[rel="stylesheet"]');
|
||||
for(var i = 0; i < links.length; i++){
|
||||
// $FlowFixMe[incompatible-type]
|
||||
var href /*: string */ = links[i].getAttribute("href");
|
||||
var hostname = getHostname();
|
||||
var servedFromHMRServer = hostname === "localhost" ? new RegExp("^(https?:\\/\\/(0.0.0.0|127.0.0.1)|localhost):" + getPort()).test(href) : href.indexOf(hostname + ":" + getPort());
|
||||
var absolute = /^https?:\/\//i.test(href) && href.indexOf(location.origin) !== 0 && !servedFromHMRServer;
|
||||
if (!absolute) updateLink(links[i]);
|
||||
}
|
||||
cssTimeout = null;
|
||||
}, 50);
|
||||
}
|
||||
function hmrDownload(asset) {
|
||||
if (asset.type === "js") {
|
||||
if (typeof document !== "undefined") {
|
||||
let script = document.createElement("script");
|
||||
script.src = asset.url + "?t=" + Date.now();
|
||||
if (asset.outputFormat === "esmodule") script.type = "module";
|
||||
return new Promise((resolve, reject)=>{
|
||||
var _document$head;
|
||||
script.onload = ()=>resolve(script);
|
||||
script.onerror = reject;
|
||||
(_document$head = document.head) === null || _document$head === void 0 || _document$head.appendChild(script);
|
||||
});
|
||||
} else if (typeof importScripts === "function") {
|
||||
// Worker scripts
|
||||
if (asset.outputFormat === "esmodule") return import(asset.url + "?t=" + Date.now());
|
||||
else return new Promise((resolve, reject)=>{
|
||||
try {
|
||||
importScripts(asset.url + "?t=" + Date.now());
|
||||
resolve();
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
async function hmrApplyUpdates(assets) {
|
||||
global.parcelHotUpdate = Object.create(null);
|
||||
let scriptsToRemove;
|
||||
try {
|
||||
// If sourceURL comments aren't supported in eval, we need to load
|
||||
// the update from the dev server over HTTP so that stack traces
|
||||
// are correct in errors/logs. This is much slower than eval, so
|
||||
// we only do it if needed (currently just Safari).
|
||||
// https://bugs.webkit.org/show_bug.cgi?id=137297
|
||||
// This path is also taken if a CSP disallows eval.
|
||||
if (!supportsSourceURL) {
|
||||
let promises = assets.map((asset)=>{
|
||||
var _hmrDownload;
|
||||
return (_hmrDownload = hmrDownload(asset)) === null || _hmrDownload === void 0 ? void 0 : _hmrDownload.catch((err)=>{
|
||||
// Web extension fix
|
||||
if (extCtx && extCtx.runtime && extCtx.runtime.getManifest().manifest_version == 3 && typeof ServiceWorkerGlobalScope != "undefined" && global instanceof ServiceWorkerGlobalScope) {
|
||||
extCtx.runtime.reload();
|
||||
return;
|
||||
}
|
||||
throw err;
|
||||
});
|
||||
});
|
||||
scriptsToRemove = await Promise.all(promises);
|
||||
}
|
||||
assets.forEach(function(asset) {
|
||||
hmrApply(module.bundle.root, asset);
|
||||
});
|
||||
} finally{
|
||||
delete global.parcelHotUpdate;
|
||||
if (scriptsToRemove) scriptsToRemove.forEach((script)=>{
|
||||
if (script) {
|
||||
var _document$head2;
|
||||
(_document$head2 = document.head) === null || _document$head2 === void 0 || _document$head2.removeChild(script);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function hmrApply(bundle /*: ParcelRequire */ , asset /*: HMRAsset */ ) {
|
||||
var modules = bundle.modules;
|
||||
if (!modules) return;
|
||||
if (asset.type === "css") reloadCSS();
|
||||
else if (asset.type === "js") {
|
||||
let deps = asset.depsByBundle[bundle.HMR_BUNDLE_ID];
|
||||
if (deps) {
|
||||
if (modules[asset.id]) {
|
||||
// Remove dependencies that are removed and will become orphaned.
|
||||
// This is necessary so that if the asset is added back again, the cache is gone, and we prevent a full page reload.
|
||||
let oldDeps = modules[asset.id][1];
|
||||
for(let dep in oldDeps)if (!deps[dep] || deps[dep] !== oldDeps[dep]) {
|
||||
let id = oldDeps[dep];
|
||||
let parents = getParents(module.bundle.root, id);
|
||||
if (parents.length === 1) hmrDelete(module.bundle.root, id);
|
||||
}
|
||||
}
|
||||
if (supportsSourceURL) // Global eval. We would use `new Function` here but browser
|
||||
// support for source maps is better with eval.
|
||||
(0, eval)(asset.output);
|
||||
// $FlowFixMe
|
||||
let fn = global.parcelHotUpdate[asset.id];
|
||||
modules[asset.id] = [
|
||||
fn,
|
||||
deps
|
||||
];
|
||||
} else if (bundle.parent) hmrApply(bundle.parent, asset);
|
||||
}
|
||||
}
|
||||
function hmrDelete(bundle, id) {
|
||||
let modules = bundle.modules;
|
||||
if (!modules) return;
|
||||
if (modules[id]) {
|
||||
// Collect dependencies that will become orphaned when this module is deleted.
|
||||
let deps = modules[id][1];
|
||||
let orphans = [];
|
||||
for(let dep in deps){
|
||||
let parents = getParents(module.bundle.root, deps[dep]);
|
||||
if (parents.length === 1) orphans.push(deps[dep]);
|
||||
}
|
||||
// Delete the module. This must be done before deleting dependencies in case of circular dependencies.
|
||||
delete modules[id];
|
||||
delete bundle.cache[id];
|
||||
// Now delete the orphans.
|
||||
orphans.forEach((id)=>{
|
||||
hmrDelete(module.bundle.root, id);
|
||||
});
|
||||
} else if (bundle.parent) hmrDelete(bundle.parent, id);
|
||||
}
|
||||
function hmrAcceptCheck(bundle /*: ParcelRequire */ , id /*: string */ , depsByBundle /*: ?{ [string]: { [string]: string } }*/ ) {
|
||||
if (hmrAcceptCheckOne(bundle, id, depsByBundle)) return true;
|
||||
// Traverse parents breadth first. All possible ancestries must accept the HMR update, or we'll reload.
|
||||
let parents = getParents(module.bundle.root, id);
|
||||
let accepted = false;
|
||||
while(parents.length > 0){
|
||||
let v = parents.shift();
|
||||
let a = hmrAcceptCheckOne(v[0], v[1], null);
|
||||
if (a) // If this parent accepts, stop traversing upward, but still consider siblings.
|
||||
accepted = true;
|
||||
else {
|
||||
// Otherwise, queue the parents in the next level upward.
|
||||
let p = getParents(module.bundle.root, v[1]);
|
||||
if (p.length === 0) {
|
||||
// If there are no parents, then we've reached an entry without accepting. Reload.
|
||||
accepted = false;
|
||||
break;
|
||||
}
|
||||
parents.push(...p);
|
||||
}
|
||||
}
|
||||
return accepted;
|
||||
}
|
||||
function hmrAcceptCheckOne(bundle /*: ParcelRequire */ , id /*: string */ , depsByBundle /*: ?{ [string]: { [string]: string } }*/ ) {
|
||||
var modules = bundle.modules;
|
||||
if (!modules) return;
|
||||
if (depsByBundle && !depsByBundle[bundle.HMR_BUNDLE_ID]) {
|
||||
// If we reached the root bundle without finding where the asset should go,
|
||||
// there's nothing to do. Mark as "accepted" so we don't reload the page.
|
||||
if (!bundle.parent) return true;
|
||||
return hmrAcceptCheck(bundle.parent, id, depsByBundle);
|
||||
}
|
||||
if (checkedAssets[id]) return true;
|
||||
checkedAssets[id] = true;
|
||||
var cached = bundle.cache[id];
|
||||
assetsToDispose.push([
|
||||
bundle,
|
||||
id
|
||||
]);
|
||||
if (!cached || cached.hot && cached.hot._acceptCallbacks.length) {
|
||||
assetsToAccept.push([
|
||||
bundle,
|
||||
id
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function hmrDispose(bundle /*: ParcelRequire */ , id /*: string */ ) {
|
||||
var cached = bundle.cache[id];
|
||||
bundle.hotData[id] = {};
|
||||
if (cached && cached.hot) cached.hot.data = bundle.hotData[id];
|
||||
if (cached && cached.hot && cached.hot._disposeCallbacks.length) cached.hot._disposeCallbacks.forEach(function(cb) {
|
||||
cb(bundle.hotData[id]);
|
||||
});
|
||||
delete bundle.cache[id];
|
||||
}
|
||||
function hmrAccept(bundle /*: ParcelRequire */ , id /*: string */ ) {
|
||||
// Execute the module.
|
||||
bundle(id);
|
||||
// Run the accept callbacks in the new version of the module.
|
||||
var cached = bundle.cache[id];
|
||||
if (cached && cached.hot && cached.hot._acceptCallbacks.length) cached.hot._acceptCallbacks.forEach(function(cb) {
|
||||
var assetsToAlsoAccept = cb(function() {
|
||||
return getParents(module.bundle.root, id);
|
||||
});
|
||||
if (assetsToAlsoAccept && assetsToAccept.length) {
|
||||
assetsToAlsoAccept.forEach(function(a) {
|
||||
hmrDispose(a[0], a[1]);
|
||||
});
|
||||
// $FlowFixMe[method-unbinding]
|
||||
assetsToAccept.push.apply(assetsToAccept, assetsToAlsoAccept);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
},{}],"j4kuM":[function(require,module,exports) {
|
||||
|
||||
},{}]},["lHQeq","j4kuM"], "j4kuM", "parcelRequire7788")
|
||||
|
||||
//# sourceMappingURL=xrsh.3464ddca.js.map
|
||||
1
src/dist/xrsh.3464ddca.js.map
vendored
Normal file
1
src/dist/xrsh.3464ddca.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
221
src/index.css
Normal file
221
src/index.css
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
/*
|
||||
* HTML-2-WebGL limitations / guidelines for html-mesh compatibility:
|
||||
* - no icon libraries (favicon e.g.)
|
||||
* - in case of 'border-radius: 2px 3px 4px 5px' (2px will apply to all corners)
|
||||
* - dont use transform: scale(1.2) e.g.
|
||||
* - dont use pseudoclasses like :before or :after (they mess up html-to-canvas conversion)
|
||||
* - use visibility:hidden/visible instead of display:none
|
||||
*/
|
||||
|
||||
:root {
|
||||
--xrsh-primary: #00AA;
|
||||
--xrsh-primary-fg: #FFF;
|
||||
--xrsh-light-primary: #00a3Ff;
|
||||
--xrsh-secondary: #872eff;
|
||||
--xrsh-third: #ce7df2;
|
||||
--xrsh-box-shadow: #0005;
|
||||
--xrsh-dark-gray: #343334;
|
||||
--xrsh-gray: #424280;
|
||||
--xrsh-white: #fdfdfd;
|
||||
--xrsh-black: #001c;
|
||||
--xrsh-light-gray: #efefef;
|
||||
--xrsh-lighter-gray: #e4e2fb96;
|
||||
--xrsh-window-radius: 10px;
|
||||
--xrsh-control-radius: 7px;
|
||||
--xrsh-font-sans-serif: system-ui, -apple-system, segoe ui, roboto, ubuntu, helvetica, cantarell, noto sans, sans-serif;
|
||||
--xrsh-font-monospace: menlo, monaco, lucida console, liberation mono, dejavu sans mono, bitstream vera sans mono, courier new, monospace, serif;
|
||||
--xrsh-font-size-0: 12px;
|
||||
--xrsh-font-size-1: 14px;
|
||||
--xrsh-font-size-2: 17px;
|
||||
--xrsh-font-size-3: 21px;
|
||||
--xrsh-modal-button-bg: #CCC;
|
||||
--xrsh-modal-button-fg: #FFF;
|
||||
}
|
||||
|
||||
body,
|
||||
html.a-fullscreen body{
|
||||
color: var(--xrsh-light-gray);
|
||||
font-size: var(--xrsh-font-size-1);
|
||||
font-family: var(--xrsh-font-sans-serif);
|
||||
accent-color: var(--xrsh-light-primary);
|
||||
line-height:22px;
|
||||
}
|
||||
|
||||
h1,h2,h3,h4,h5{
|
||||
color: var(--xrsh-light-gray);
|
||||
}
|
||||
h1 { font-size: var(--xrsh-font-size-3); }
|
||||
h2,h3,h4{ font-size: var(--xrsh-font-size-2); }
|
||||
|
||||
a,a:visited,a:active{
|
||||
color: var(--xrsh-light-primary);
|
||||
}
|
||||
|
||||
/*
|
||||
* Form elements
|
||||
*/
|
||||
|
||||
button,.btn,input[type=submit]{
|
||||
border-radius: var(--xrsh-control-radius);
|
||||
background: var(--xrsh-primary);
|
||||
color: var(--xrsh-primary-fg);
|
||||
transition:0.3s;
|
||||
padding: 10px;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
cursor:pointer;
|
||||
}
|
||||
button:hover,.btn:hover,input[type=submit]:hover{
|
||||
background: var(--xrsh-white);
|
||||
color: var(--xrsh-dark-gray) !important;
|
||||
}
|
||||
|
||||
legend{
|
||||
font-size: var(--xrsh-font-size-0);
|
||||
margin-bottom: 15px;
|
||||
border-bottom: 1px solid var(--xrsh-light-primary);
|
||||
}
|
||||
|
||||
body .winbox fieldset,
|
||||
fieldset{
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
margin-bottom: 0px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
label{
|
||||
margin-left:10px;
|
||||
}
|
||||
button,input,.btn{
|
||||
margin-bottom:10px;
|
||||
}
|
||||
[type="checkbox"], [type="radio"]{
|
||||
transform: scale(1.4);
|
||||
margin-left:3px;
|
||||
}
|
||||
|
||||
/*
|
||||
* WinBox (windows) theme
|
||||
*/
|
||||
.winbox {
|
||||
box-shadow:none !important;
|
||||
background: transparent !important;
|
||||
}
|
||||
.winbox .wb-body{
|
||||
background: var(--xrsh-dark-gray);
|
||||
/*margin-top: -6px !important;*/
|
||||
z-index: 100;
|
||||
border-radius:0px 0px var(--xrsh-window-radius) var(--xrsh-window-radius);
|
||||
}
|
||||
.winbox .wb-header{
|
||||
background: var(--xrsh-dark-gray);
|
||||
z-index:1000;
|
||||
font-weight: bold;
|
||||
border-radius: var(--xrsh-window-radius) var(--xrsh-window-radius) 0px 0px;
|
||||
line-height:36px;
|
||||
|
||||
}
|
||||
.winbox.max .wb-header{
|
||||
border-radius:0px;
|
||||
}
|
||||
|
||||
.XR .winbox .wb-header{
|
||||
border-radius:0px !important;
|
||||
margin-top:0px;
|
||||
}
|
||||
|
||||
.XR .winbox .wb-control .xr {
|
||||
display:block;
|
||||
}
|
||||
.winbox .wb-control .xr {
|
||||
display:none;
|
||||
background:transparent !important;
|
||||
position: absolute;
|
||||
top: -2px;
|
||||
cursor:pointer;
|
||||
}
|
||||
.winbox .wb-control .xr.xr-wb-close,
|
||||
.winbox .wb-control .xr.xr-wb-min{
|
||||
right: 2px;
|
||||
}
|
||||
|
||||
.winbox .wb-body{
|
||||
top: 35 !important;
|
||||
padding-top:35px;
|
||||
}
|
||||
.winbox .wb-control{
|
||||
padding-right:5px;
|
||||
height:29px;
|
||||
color:#FFF;
|
||||
z-index:1001;
|
||||
}
|
||||
.winbox .wb-drag{
|
||||
padding-left:19px;
|
||||
}
|
||||
.winbox .wb-control > span{
|
||||
background-size: 12px auto !important;
|
||||
}
|
||||
|
||||
.winbox *{
|
||||
color: var(--xrsh-light-gray);
|
||||
font-size: var(--xrsh-font-size-1);
|
||||
font-family: var(--xrsh-font-sans-serif);
|
||||
}
|
||||
|
||||
.winbox input[type=text]{
|
||||
color: var(--xrsh-dark-gray);
|
||||
border-radius: 6px;
|
||||
color: var(--xrsh-dark-gray);
|
||||
height: 25px;
|
||||
margin-bottom: 2px;
|
||||
border-block: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.winbox .wb-body *::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
}
|
||||
.winbox .wb-body *::-webkit-scrollbar-track {
|
||||
background: var(--xrsh-gray);
|
||||
border-left: 9px solid white;
|
||||
border-right: 9px solid white;
|
||||
}
|
||||
.winbox .wb-body *::-webkit-scrollbar-thumb {
|
||||
background: var(--xrsh-white);
|
||||
}
|
||||
|
||||
/*
|
||||
* icons for non-XR (please source from https://css.gg
|
||||
*
|
||||
* (NOTE: they will not be visible in XR)
|
||||
*/
|
||||
.gg-stack,
|
||||
.gg-stack::after,
|
||||
.gg-stack::before {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border: 2px solid
|
||||
}
|
||||
.gg-stack {
|
||||
margin-right: 8px;
|
||||
margin-top: 8px;
|
||||
transform: scale(var(--ggs,1)) translate(14px,-1px);
|
||||
position: relative
|
||||
}
|
||||
.gg-stack::after,
|
||||
.gg-stack::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
border-left: 0;
|
||||
border-bottom: 0;
|
||||
right: -5px;
|
||||
top: -5px
|
||||
}
|
||||
.gg-stack::before {
|
||||
right: -8px;
|
||||
top: -8px
|
||||
}
|
||||
83
src/index.html
Normal file
83
src/index.html
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>xrsh v0.143</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<link rel="stylesheet" href="./index.css"></link>
|
||||
<script src="./assets/aframe.min.js"></script>
|
||||
<script src="./assets/xrfragment.aframe.js"></script>
|
||||
|
||||
<script src="com/require.js"></script>
|
||||
<script src="com/isoterminal.js"></script>
|
||||
|
||||
<!-- todo fix lazy initialisation of require.js -->
|
||||
<script src="com/launcher.js"></script>
|
||||
<script src="com/helloworld-window.js"></script>
|
||||
<script src="com/pressable.js"></script>
|
||||
|
||||
</head>
|
||||
<body style="background:linear-gradient( 45deg, #324, #8c74ff)">
|
||||
<a-scene selfcontainer
|
||||
light="defaultLightsEnabled: true"
|
||||
cursor="rayOrigin: mouse"
|
||||
renderer="colorManagement: false; stencil: true; antialias:true; highRefreshRate:true; foveationLevel: 0.5;"
|
||||
xr-mode-ui="XRMode: xr"
|
||||
obb-collider="showColliders:false"
|
||||
raycaster="objects: [html]; interval:100;"
|
||||
>
|
||||
|
||||
<a-entity isoterminal="iso: ./../xrsh.iso; overlayfs: /package.overlayfs.zip; bootMenuURL: 1" position="0 1.6 -0.3">
|
||||
<a-entity launcher pressable position="0 -0.315 0"></a-entity>
|
||||
</a-entity>
|
||||
|
||||
<a-entity helloworld-window pressable position="0 1.6 0"></a-entity>
|
||||
|
||||
<a-entity id="player">
|
||||
<a-entity camera="fov:90" position="0 1.6 0" id="camera" wasd-controls gaze-touch-to-click></a-entity>
|
||||
<a-entity id="left-hand" hand-tracking-grab-controls="hand: left; modelColor: #EEEEEE; hoverEnabled:true"
|
||||
laser-controls="hand: left"
|
||||
raycaster="far:0.04"
|
||||
blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: #floor"
|
||||
>
|
||||
</a-entity>
|
||||
<a-entity id="right-hand" hand-tracking-grab-controls="hand: right; modelColor: #EEEEEE; hoverEnabled:true"
|
||||
laser-controls="hand: right"
|
||||
raycaster="far:0.04"
|
||||
blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: #floor"
|
||||
____pinch-to-teleport="rig: #player"></a-entity>
|
||||
</a-entity>
|
||||
|
||||
</a-scene>
|
||||
|
||||
</body>
|
||||
|
||||
<script>
|
||||
|
||||
// HOWDY DEVELOPER!
|
||||
// for a REPL boilerplate see this codepen instead: https://codepen.io/coderofsalvation/pen/wBwRpew
|
||||
|
||||
document.querySelector('a-scene').addEventListener('isoterminal_init', function(e){
|
||||
// example custom REPL (https://xrsh.isvery.ninja/#Custom%20REPLs)
|
||||
const myREPL = {
|
||||
key: "f",
|
||||
prompt: "\r\nmyrepl> ",
|
||||
title: (opts) => `other awesome NLnet FOSS projects ❤️`,
|
||||
init: function( mainmenu ){
|
||||
window.open('https://nlnet.nl/project/current.html','_blank')
|
||||
this.send("\n\rreturning to mainmenu")
|
||||
mainmenu()
|
||||
},
|
||||
keyHandler: function(ch){
|
||||
this.send(ch) // echo keys to user
|
||||
},
|
||||
cmdHandler: function(cmd){
|
||||
this.send("\r\n"+cmd) // only works after commenting mainmenu()\n")
|
||||
this.send(myREPL.prompt)
|
||||
}
|
||||
}
|
||||
ISOTerminal.prototype.boot.menu.push(myREPL)
|
||||
})
|
||||
</script>
|
||||
|
||||
</html>
|
||||
56
src/tests/ISOTerminal.js
Normal file
56
src/tests/ISOTerminal.js
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
isoterminal = document.querySelector("[isoterminal]")
|
||||
|
||||
isoterminal.addEventListener("ready", function(){
|
||||
|
||||
term = isoterminal.components.isoterminal.term
|
||||
convert = ISOTerminal.prototype.convert
|
||||
|
||||
console.test.tests = {} // empty previous tests
|
||||
|
||||
console.test("com/isoterminal/ISOTerminal.js", async () => {
|
||||
|
||||
term.worker.create_file("foo", convert.toUint8Array("hello") )
|
||||
.then( (res) => {
|
||||
term.worker.read_file("foo")
|
||||
.then( (res) => {
|
||||
try{
|
||||
let data = convert.Uint8ArrayToString( res )
|
||||
console.assert( data == "hello", "worker.create_file")
|
||||
}catch(e){
|
||||
console.assert( false, "worker.create_file")
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(console.error)
|
||||
.finally(console.dir)
|
||||
|
||||
})
|
||||
|
||||
console.test("com/isoterminal/ISOTerminal.js", async () => {
|
||||
|
||||
term.worker.read_file("foo")
|
||||
.then( (res) => {
|
||||
try{
|
||||
let data = convert.Uint8ArrayToString( res )
|
||||
console.assert( data.length && data == "hello", "worker.postMessage.promise()")
|
||||
}catch(e){
|
||||
console.assert( false, "worker.postMessage.promise()")
|
||||
}
|
||||
})
|
||||
.catch(console.error)
|
||||
.finally(console.dir)
|
||||
|
||||
})
|
||||
|
||||
|
||||
console.test.run()
|
||||
|
||||
})
|
||||
|
||||
console.test("com/isoterminal.js", async () => {
|
||||
console.assert( AFRAME.components.isoterminal != undefined, "AFRAME.components.isoterminal")
|
||||
})
|
||||
|
||||
console.test("xrsh.iso", async () => {
|
||||
console.assert( false, "create testsuite.zip package which tests iso")
|
||||
})
|
||||
7
src/tests/aframesnippet.txt
Normal file
7
src/tests/aframesnippet.txt
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<a-box position="-2 2.5 -3" rotation="0 45 0" color="#000000"></a-box>
|
||||
<a-box position="-1 2.5 -3" rotation="0 45 0" color="#222222"></a-box>
|
||||
<a-box position="0 2.5 -3" rotation="0 45 0" color="#555555"></a-box>
|
||||
<a-box position="1 2.5 -3" rotation="0 45 0" color="#aaaaaa"></a-box>
|
||||
<a-box position="2 2.5 -3" rotation="0 45 0" color="#CCCCCC"></a-box>
|
||||
|
||||
<a-entity app="uri: app/example/helloworld-iframe.js; url: 'https://fabien.benetou.fr/Cookbook/Electronics'" position="1 1.25 -1.7"></a-entity>
|
||||
46
src/tests/eventbus.html
Normal file
46
src/tests/eventbus.html
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>eventbus for browsertabs</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<style type="text/css">
|
||||
* { border-radius: 5px; font-family: Verdana; font-size:17px; }
|
||||
button { border: none; background:#F0A; padding:10px; }
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="margin:10% 40%">
|
||||
<h1>eventbus for duplicate browsertabs</h1>
|
||||
|
||||
1. Open this page in another,<br>
|
||||
2. Copy something text to clipboard<br>
|
||||
3. Click Paste in one tab
|
||||
<br><Br>
|
||||
<button id="paste">paste</button>
|
||||
<br><br>
|
||||
|
||||
<pre id="out" style="border:2px solid #CCC; width:100%;height:200px"> </pre>
|
||||
|
||||
<script>
|
||||
let out = document.querySelector('#out')
|
||||
let paste = document.querySelector('#paste')
|
||||
|
||||
const show = (text) => out.innerHTML += `\n${window.localStorage.getItem('paste')}`
|
||||
|
||||
window.addEventListener("storage", show )
|
||||
|
||||
paste.addEventListener('click',(e) => {
|
||||
navigator.clipboard.readText()
|
||||
.then( (text) => {
|
||||
window.localStorage.setItem('paste', text)
|
||||
show()
|
||||
})
|
||||
})
|
||||
|
||||
show('connected to eventbus')
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
10
src/tests/index.js
Normal file
10
src/tests/index.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
const run = async function(){
|
||||
await AFRAME.utils.require({
|
||||
"test_util": "tests/util.js",
|
||||
"test_isoterminal":"tests/ISOTerminal.js"
|
||||
})
|
||||
console.test.run()
|
||||
}
|
||||
|
||||
run()
|
||||
28
src/tests/util.js
Normal file
28
src/tests/util.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
// minimalistc testrunner
|
||||
window.console.test = async (name,cb) => {
|
||||
let tests = console.test.tests = console.test.tests || {}
|
||||
tests[name] = tests[name] || []
|
||||
tests[name].push(cb)
|
||||
}
|
||||
|
||||
window.console.test.run = async (cb) => {
|
||||
const tests = window.console.test.tests
|
||||
for( let name in tests ){
|
||||
console.log("\x1b[34m\x1b[36;49m"+name+"\x1B[m")
|
||||
for( let test in tests[name] ){
|
||||
await tests[name][test]()
|
||||
}
|
||||
}
|
||||
if( cb ) cb()
|
||||
}
|
||||
|
||||
window.console.assert = ((assert) => (a,reason,data) => {
|
||||
console.log("\x1b[34m\x1b[36;49m♥ \x1B[m"+reason)
|
||||
assert.call( console, a, {reason} )
|
||||
if( !a ){
|
||||
console.dir(data)
|
||||
throw 'abort..'
|
||||
}
|
||||
|
||||
})(console.assert)
|
||||
21
src/tests/vhs/alert.tape
Normal file
21
src/tests/vhs/alert.tape
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Where should we write the GIF?
|
||||
Output ./../media/terminal/alert.gif
|
||||
|
||||
# Set up a 1200x600 terminal with 46px font.
|
||||
Set Margin 0
|
||||
Set FontSize 19
|
||||
Set Width 500
|
||||
Set Height 200
|
||||
Set CursorBlink true
|
||||
|
||||
# Type a command in the terminal.
|
||||
Type "alert hello"
|
||||
|
||||
# Pause for dramatic effect...
|
||||
Sleep 1000ms
|
||||
|
||||
# Run the command by pressing enter.
|
||||
Enter
|
||||
|
||||
# Admire the output for a bit.
|
||||
Sleep 3s
|
||||
43
src/tests/vhs/annotate.tape
Normal file
43
src/tests/vhs/annotate.tape
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# Where should we write the GIF?
|
||||
Output ./../media/terminal/annotate.gif
|
||||
|
||||
# Set up a 1200x600 terminal with 46px font.
|
||||
Set Margin 0
|
||||
Set FontSize 19
|
||||
Set Width 500
|
||||
Set Height 200
|
||||
Set CursorBlink true
|
||||
|
||||
Type "mkdir /tmp/foo"
|
||||
# Pause for dramatic effect...
|
||||
Sleep 1000ms
|
||||
|
||||
# Run the command by pressing enter.
|
||||
Enter
|
||||
|
||||
Type "cd /tmp/foo"
|
||||
# Pause for dramatic effect...
|
||||
Sleep 1000ms
|
||||
|
||||
# Run the command by pressing enter.
|
||||
Enter
|
||||
|
||||
# Type a command in the terminal.
|
||||
Type "annotate this is a cool directory"
|
||||
|
||||
# Pause for dramatic effect...
|
||||
Sleep 1000ms
|
||||
|
||||
# Run the command by pressing enter.
|
||||
Enter
|
||||
|
||||
Type "cd /tmp/foo"
|
||||
|
||||
# Pause for dramatic effect...
|
||||
Sleep 1000ms
|
||||
|
||||
# Run the command by pressing enter.
|
||||
Enter
|
||||
|
||||
# Admire the output for a bit.
|
||||
Sleep 3s
|
||||
54
src/tests/vhs/confirm.tape
Normal file
54
src/tests/vhs/confirm.tape
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# Where should we write the GIF?
|
||||
Output ./../media/terminal/confirm.gif
|
||||
|
||||
# Set up a 1200x600 terminal with 46px font.
|
||||
Set Margin 0
|
||||
Set FontSize 19
|
||||
Set Width 500
|
||||
Set Height 200
|
||||
Set CursorBlink true
|
||||
|
||||
# Type a command in the terminal.
|
||||
Type "confirm 'do it?'"
|
||||
|
||||
# Pause for dramatic effect...
|
||||
Sleep 1000ms
|
||||
|
||||
Enter
|
||||
|
||||
# Pause for dramatic effect...
|
||||
Sleep 1000ms
|
||||
|
||||
Type "y"
|
||||
|
||||
Enter
|
||||
|
||||
# Admire the output for a bit.
|
||||
Sleep 3s
|
||||
|
||||
# Type a command in the terminal.
|
||||
Type "in=$(confirm 'do it?')"
|
||||
Sleep 1000ms
|
||||
|
||||
Enter
|
||||
Sleep 700ms
|
||||
|
||||
Type "y"
|
||||
Sleep 1000ms
|
||||
|
||||
Enter
|
||||
Sleep 1000ms
|
||||
|
||||
Type "echo $in"
|
||||
Sleep 1000ms
|
||||
|
||||
Enter
|
||||
Sleep 1000ms
|
||||
|
||||
Type "test $in = true && echo ♥"
|
||||
Sleep 2000ms
|
||||
|
||||
Enter
|
||||
|
||||
# Admire the output for a bit.
|
||||
Sleep 3s
|
||||
54
src/tests/vhs/prompt.tape
Normal file
54
src/tests/vhs/prompt.tape
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# Where should we write the GIF?
|
||||
Output ./../media/terminal/prompt.gif
|
||||
|
||||
# Set up a 1200x600 terminal with 46px font.
|
||||
Set Margin 0
|
||||
Set FontSize 19
|
||||
Set Width 500
|
||||
Set Height 200
|
||||
Set CursorBlink true
|
||||
|
||||
# Type a command in the terminal.
|
||||
Type "prompt 'whatsup'"
|
||||
|
||||
# Pause for dramatic effect...
|
||||
Sleep 700ms
|
||||
|
||||
Enter
|
||||
|
||||
# Pause for dramatic effect...
|
||||
Sleep 700ms
|
||||
|
||||
Type "FOSS"
|
||||
|
||||
Enter
|
||||
|
||||
# Admire the output for a bit.
|
||||
Sleep 3s
|
||||
|
||||
# Type a command in the terminal.
|
||||
Type "in=$(prompt 'whatsup')"
|
||||
Sleep 1000ms
|
||||
|
||||
Enter
|
||||
Sleep 700ms
|
||||
|
||||
Type "FOSS"
|
||||
Sleep 1000ms
|
||||
|
||||
Enter
|
||||
Sleep 1000ms
|
||||
|
||||
Type "echo $in"
|
||||
Sleep 1000ms
|
||||
|
||||
Enter
|
||||
Sleep 1000ms
|
||||
|
||||
Type "test $in = FOSS && echo ♥"
|
||||
Sleep 2000ms
|
||||
|
||||
Enter
|
||||
|
||||
# Admire the output for a bit.
|
||||
Sleep 3s
|
||||
57
src/tests/vhs/set-x.tape
Normal file
57
src/tests/vhs/set-x.tape
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# Where should we write the GIF?
|
||||
Output ./../media/terminal/set-x.gif
|
||||
|
||||
# Set up a 1200x600 terminal with 46px font.
|
||||
Set Margin 0
|
||||
Set FontSize 19
|
||||
Set Width 600
|
||||
Set Height 500
|
||||
Set CursorBlink true
|
||||
|
||||
# Type a command in the terminal.
|
||||
Type 'vi'
|
||||
|
||||
# Pause for dramatic effect...
|
||||
Sleep 1000ms
|
||||
|
||||
Enter
|
||||
|
||||
# Type a command in the terminal.
|
||||
Type "i#!/bin/sh"
|
||||
|
||||
Enter
|
||||
|
||||
Type "set -x # enable debugging
|
||||
Enter
|
||||
Enter
|
||||
Type "foo=bar"
|
||||
Enter
|
||||
Type "echo $foo"
|
||||
Enter
|
||||
|
||||
Sleep 4000ms
|
||||
|
||||
# Type a command in the terminal.
|
||||
Escape
|
||||
Type ":wq! myscript"
|
||||
|
||||
# Pause for dramatic effect...
|
||||
Sleep 2000ms
|
||||
|
||||
Enter
|
||||
|
||||
Type "chmod +x myscript"
|
||||
|
||||
Sleep 1000ms
|
||||
|
||||
Enter
|
||||
|
||||
Type "./myscript"
|
||||
|
||||
Sleep 2000ms
|
||||
|
||||
Enter
|
||||
|
||||
# Admire the output for a bit.
|
||||
Sleep 4s
|
||||
|
||||
13618
src/tests/xrsh.html
Normal file
13618
src/tests/xrsh.html
Normal file
File diff suppressed because one or more lines are too long
1
src/xrsh-com
Submodule
1
src/xrsh-com
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 10bbfd27e21a1b7368c38432178309263662aef6
|
||||
60
xrsh
Executable file
60
xrsh
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
#!/bin/sh
|
||||
PORT=9090
|
||||
PROCFILE=/tmp/.xrsh
|
||||
|
||||
usage(){ echo "Usage: xrsh [--keyboard] [--kill]"; exit; }
|
||||
|
||||
assert_cmds(){
|
||||
for cmd in $1; do
|
||||
command -v $cmd &>/dev/null || { echo "error: please install $cmd (not found)"; exit 1; }
|
||||
done
|
||||
}
|
||||
|
||||
showip(){
|
||||
{ # naive way of getting network ip
|
||||
command -v ip &>/dev/null && ip addr show
|
||||
command -v ifconfig &>/dev/null && ifconfig
|
||||
} | grep 'inet ' | grep -v ' 127' | awk '! /addr:/ { gsub(/\/.*/,"",$2); if( !SEEN[$2] ) print $2; SEEN[$2]=1 }'
|
||||
|
||||
}
|
||||
|
||||
setupcerts(){
|
||||
test -f ~/.websocat/cert.pem && return 0
|
||||
mkdir ~/.websocat 2>/dev/null || true
|
||||
echo "--- generating temporary SSL certs (press enter to all questions) ---"
|
||||
#openssl req -x509 -newkey rsa:4096 -keyout ~/.websocat/key.pem -out ~/.websocat/cert.pem -days 365
|
||||
openssl req -x509 -newkey rsa:2048 -new -nodes -keyout ~/.websocat/key.pem -out ~/.websocat/cert.pem -days 3650
|
||||
openssl pkcs12 -export -out ~/.websocat/q.pkcs12 -inkey ~/.websocat/key.pem -in ~/.websocat/cert.pem
|
||||
wget "https://curl.haxx.se/ca/cacert.pem" -O ~/.websocat/cacert.pem
|
||||
}
|
||||
|
||||
keyboard(){
|
||||
assert_cmds websocat pkill
|
||||
trap "stty sane; trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT # cleanup processes when exit
|
||||
echo $$ > $PROCFILE
|
||||
echo ""
|
||||
echo " 1. type 'k' (remote keyboard) in xrsh"
|
||||
echo " 2. enter ipaddress: $(showip)"
|
||||
echo ""
|
||||
echo "warn: CTRL-C is forwarded too"
|
||||
echo "warn: to exit this app run: $0 --kill"
|
||||
echo "warn: this terminal is now in raw sendmode, expect weird characters!"
|
||||
stty raw
|
||||
if test -n "$SSL"; then
|
||||
setupcerts
|
||||
websocat -E -b -s --pkcs12-der ~/.websocat/q.pkcs12 0.0.0.0:$PORT 2>&1
|
||||
else
|
||||
websocat -E -b -s 0.0.0.0:$PORT 2>&1 # http-only
|
||||
fi
|
||||
}
|
||||
|
||||
# launch!
|
||||
test -n "$1" || { echo "usage: xrsh [--ssl] [--keyboard] [--kill]"; exit; }
|
||||
for arg in $*; do
|
||||
case $arg in
|
||||
--kill) pkill -P $(cat $PROCFILE); exit ;;
|
||||
--ssl) export SSL=1; ;;
|
||||
--keyboard) keyboard "$@"; ;;
|
||||
esac
|
||||
done
|
||||
|
||||
BIN
xrsh.com
Executable file
BIN
xrsh.com
Executable file
Binary file not shown.
1
xrsh.com.txt
Normal file
1
xrsh.com.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
e791dba58adf568d34648eeed71e047d60b126b3dd5a6d81306a4307c5b7c3ad xrsh.com
|
||||
36
xrsh.html
Normal file
36
xrsh.html
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
|
||||
<script src="https://aframe.io/releases/1.6.0/aframe.min.js"></script>
|
||||
<script src="https://xrsh.isvery.ninja/xrsh.js"></script>
|
||||
|
||||
<a-scene>
|
||||
<a-entity isoterminal position="0 1.6 -0.3"></a-entity>
|
||||
|
||||
<a-entity id="left-hand" hand-tracking-grab-controls="hand: left; modelColor: #EEEEEE; hoverEnabled:true"
|
||||
laser-controls="hand: left" raycaster="objects:.ray,[html]"></a-entity>
|
||||
<a-entity id="right-hand" hand-tracking-grab-controls="hand: right; modelColor: #EEEEEE; hoverEnabled:true"
|
||||
laser-controls="hand: right"
|
||||
raycaster="objects:.ray,[html]"></a-entity>
|
||||
</a-scene>
|
||||
|
||||
<script>
|
||||
document.querySelector('a-scene').addEventListener('isoterminal_init', function(e){
|
||||
// override/extend bootmenu-array with your own REPL(s)
|
||||
// see com/isoterminal/feat/boot.REPL.*.js for examples
|
||||
ISOTerminal.prototype.boot.menu.push({
|
||||
key: "f",
|
||||
title: (opts) => `other awesome NLnet FOSS projects ❤️`,
|
||||
init: function( mainmenu ){
|
||||
window.open('https://nlnet.nl/project/current.html','_blank')
|
||||
// return to main menu
|
||||
mainmenu()
|
||||
},
|
||||
keyHandler: function(ch){
|
||||
this.send("\n\ryou typed:"+ch) // write to term
|
||||
}
|
||||
})
|
||||
|
||||
// AFRAME exposes THREE by default
|
||||
console.log( THREE )
|
||||
})
|
||||
</script>
|
||||
|
||||
BIN
xrsh.ico
Normal file
BIN
xrsh.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
1
xrsh.iso
Symbolic link
1
xrsh.iso
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
xrsh.iso.buildroot
|
||||
1
xrsh.iso.buildroot
Symbolic link
1
xrsh.iso.buildroot
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../xrsh-buildroot/dist/v86-linux.iso
|
||||
1
xrsh.iso.repository
Symbolic link
1
xrsh.iso.repository
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
src/xrsh-buildroot/xrsh.iso
|
||||
1
xrsh.iso.wtux
Symbolic link
1
xrsh.iso.wtux
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../wtux/output/wtux.iso
|
||||
4503
xrsh.js
Normal file
4503
xrsh.js
Normal file
File diff suppressed because one or more lines are too long
9
xrsh.nix.log
Normal file
9
xrsh.nix.log
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
env-vars:
|
||||
CHANNEL=nixpkgs
|
||||
CMD=nix-build
|
||||
channels:
|
||||
nixos https://nixos.org/channels/nixos-24.05
|
||||
nixos-22.11 https://nixos.org/channels/nixos-22.11
|
||||
nixos-24.05 https://nixos.org/channels/nixos-24.05
|
||||
nixos-unstable https://nixos.org/channels/nixos-unstable
|
||||
/nix/store/p3314mbnga40x8sdmfx1xzc0cdbqvf50-xrsh-0.221
|
||||
2
xrsh.svg
Normal file
2
xrsh.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 19 KiB |
1
xrsh.txt
Normal file
1
xrsh.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
add6b58606caee30ede4f391a6ada33e6cc9cab651b0732cc4d1b423fa7bc730 xrsh.com
|
||||
Loading…
Add table
Reference in a new issue