Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
aframe-xterm-component
Advanced tools
Render ANSI terminals in Web VR scenes.
Uses xterm.js for the terminal rendering logic.
Under the hood, xterm.js is rendering the terminal to a series of canvases. This component takes those canvases, merges them together, and sets your entity's material to point at the canvas.
From there you can write text to the terminal and respond to feedback.
Make sure to include the xterm.js dependency in addition to the component.
<link rel="stylesheet" href="//unpkg.com/xterm@3.12.0/dist/xterm.css" />
<script src="//unpkg.com/xterm@3.12.0/dist/xterm.js"></script>
<script src="//unpkg.com/aframe-xterm-component/aframe-xterm-component.js"></script>
Here's a quick example of how you can write to the component.
AFRAME.AFRAME.registerComponent('xterm-example', {
dependencies: ['xterm'],
init: function() {
const message = 'Hello from \x1B[1;3;31mWebVR\x1B[0m !\r\n$ '
const xterm = this.el.components['xterm']
xterm.write(message)
this.el.addEventListener('xterm-data', ({detail}) => {
console.log('Got input from terminal', detail)
})
}
})
By default the terminal will render with 80 columns, and 25 rows (default size for windows command prompt). You can change this by setting it in the component options.
<a-entity
xterm="rows: 4; cols: 20;"
></a-entity>
You can change the color scheme using the component parameters by adding properties that start with theme_
. You can find a list of all theme options in the xterm.js documentation.
For example you can have a bright color scheme using this:
<a-entity
xterm="
theme_background: white;
theme_foreground: black;"
></a-entity>
The example in index.html
uses a Websocket to connect to a local Node.js server which creates a shell.
After cloning the repository somewhere, do the following:
npm install
node server.js
And then open localhost:8080/index.html in a WebVR browser in your headset. (Or in a regular browser if you just want to check it out in 3D)
Make sure you have a keyboard connected. I've tested it on the Google Daydream using Firefox Reality and the Logitech K380 BlueTooth keyboard.
You'll want to use a pointer of some sort to click on the terminal to give it keyboard focus.
On Android, I'm using the UserLAnd App in order to create an Ubuntu environment, and running the server from there.
FAQs
Playing around with getting xterm.js working in Aframe VR
We found that aframe-xterm-component demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.