GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - cloudcmd/gritty: web terminal emulator

BranchesTags
Open more actions menu

Latest commit

 

History

581 Commits
581 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
bin
bin
 
 
client
client
 
 
css
css
 
 
img
img
 
 
server
server
 
 
test
test
 
 
.babelrc
.babelrc
 
 
.browserslistrc
.browserslistrc
 
 
.eslintrc.json
.eslintrc.json
 
 
.gitignore
.gitignore
 
 
.madrun.js
.madrun.js
 
 
.npmignore
.npmignore
 
 
.nycrc.json
.nycrc.json
 
 
ChangeLog
ChangeLog
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
help.json
help.json
 
 
index.html
index.html
 
 
package.json
package.json
 
 
webpack.config.js
webpack.config.js
 
 

Repository files navigation

Gritty License NPM version Build Status Coverage Status

Web terminal emulator. Based on node-pty and xterm.js.

Gritty

Install

npm i gritty -g

Usage

Usage: gritty [options]
Options:
  -h, --help              display this help and exit
  -v, --version           output version information and exit
  --path                  output path of a gritty and exit
  --port                  set port number
  --command               command to run in terminal (shell by default)
  --auto-restart          restart command when on exit
  --no-auto-restart       do not restart command on exit

Windows

On Windows there is no build tools by default. When can't install gritty try to install windows-build-tools first.

npm i windows-build-tools -g
npm i gritty -g

Gritty

Use as standalone

Start gritty, and go to url http://localhost:1337

API

Client API

gritty(element [, options])

const prefix = '/gritty';
const env = {}; // default
const fontFamily = 'Courier';

gritty('body', {
    prefix,
    env,
    fontFamily,
});

Server API

gritty.listen(socket, [, options])

Gritty could be used as middleware:

const prefix = '/gritty';

const auth = (accept, reject) => (username, password) => {
    accept();
};

gritty.listen(socket, {
    prefix,
    auth, // optional
});

gritty(options)

Middleware function:

const prefix = '/gritty';

gritty({
    prefix,
});

Usage as middleware

To use gritty in your programs you should make local install:

npm i gritty socket.io express --save

And use it this way:

// server.js
import http from 'node:http';
import {gritty} from 'gritty';
import express from 'express';
import {Server} from 'socket.io';

const app = express();
const server = http.createServer(app);
const socket = new Server(server);

const port = 1337;
const ip = '0.0.0.0';

app.use(gritty());
app.use(express.static(__dirname));

gritty.listen(socket, {
    command: 'mc', // optional
    autoRestart: true, // default
});

server.listen(port, ip);
<!-- index.html -->

<div class="gritty"></div>
<script src="/gritty/gritty.js"></script>
<script>
    const options = {
        prefix: 'console',
        command: 'bash', // optional
        autoRestart: true, // optional
        cwd: '/', // optional
        env: {
            TERMINAL: 'gritty',
            CURRENT: getCurrentFile,
        }
    };
    
    gritty('.terminal', options);
    
    function getCurrentFile() {
        return 'filename.txt';
    }
</script>

License

MIT

About

web terminal emulator

Topics

cloudcmdconsoleemulatornodejsterminalttyvt100webxterm

Resources

Readme
MIT license
Activity
Custom properties

Stars

112 stars

Watchers

3 watching

Forks

29 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.