Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ty #166

Open
wants to merge 136 commits into
base: 256_color
Choose a base branch
from
Open

ty #166

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
120e419
make state machine more consistent. refactor.
chjj Apr 3, 2012
14a0714
set defaultColors differently
chjj Apr 3, 2012
0e1c5f6
Merge branch '256_color'
chjj Apr 4, 2012
779a8f3
remove comments. readme.
chjj Apr 4, 2012
da5103f
always show cursor after switching screen buffers.
chjj Apr 4, 2012
12021ce
hide h1 and #help on lights out
chjj Apr 4, 2012
dcd1ad2
handle OSC title code
chjj Apr 4, 2012
f206109
refactor eraseLine. refactor getRows. optimize.
chjj Apr 4, 2012
c737d73
refactor getRows. ignore DCS, APC, PM. fix broken bold.
chjj Apr 4, 2012
705b017
refactor csi codes. remove unused variables.
chjj Apr 4, 2012
bf34515
small changes
chjj Apr 4, 2012
c3bae51
v0.2.5
chjj Apr 4, 2012
11f2e16
fix inverse colors
chjj Apr 4, 2012
89a95a0
fix inverse. log and error functions. fix title setting.
chjj Apr 4, 2012
2b04bc3
optimize character creation.
chjj Apr 4, 2012
1be0c55
fix regression involving getRows/updateRange. refactor.
chjj Apr 4, 2012
20c6d07
refactor scrollBottom and cols checks
chjj Apr 4, 2012
d23d063
remove comments
chjj Apr 5, 2012
8f295c6
refactor key events
chjj Apr 5, 2012
3dd20f8
refactor. rename variables, functions.
chjj Apr 5, 2012
ae22f00
add experimental program-specific features. refactor term.
chjj Apr 6, 2012
4e7d1fb
improve and enable csi ps c. improve prefix checks.
chjj Apr 6, 2012
ee35641
send focus events
chjj Apr 6, 2012
ddb1f9a
better tabstop calculation
chjj Apr 6, 2012
b5f7c3b
more compliant tab stops
chjj Apr 6, 2012
e58ab0a
implement 132 col mode. implement soft reset. refactor.
chjj Apr 6, 2012
55e086e
revise DEC SCLD charset.
chjj Apr 6, 2012
7a7bcc8
misc
chjj Apr 6, 2012
5cf6dc2
remove unnecessary updateRange call. remove Terminal._colors.
chjj Apr 6, 2012
012e7c3
small changes
chjj Apr 7, 2012
e6e05d8
add dcs control sequences, ignore apc and pm.
chjj Apr 9, 2012
72602ff
improve mouse events. add support for urxvt, vt200, sgr events.
chjj Apr 9, 2012
a90547f
rewrite bin/tty.js. daemonize from node instead of bash script.
chjj Apr 9, 2012
02e5dd5
fix strange vt200 mouse bug with vim
chjj Apr 10, 2012
752e577
improve daemonizer
chjj Apr 12, 2012
b760b3e
v0.2.6
chjj Apr 12, 2012
6a44564
static/tty.js wrapper
chjj Apr 12, 2012
4761db2
pass socket reference to Tab and Window
chjj Apr 13, 2012
ed07ffa
refactor doc name. update document title.
chjj Apr 16, 2012
cd6ddb3
sync terminal id with server
chjj Apr 16, 2012
3a62803
refactor colors 16-255
chjj Apr 18, 2012
a53ff13
limit 256 colors sequence at 255. convert 88 to 256.
chjj Apr 18, 2012
7dfd00b
add normalMouse property.
chjj Apr 18, 2012
65b8e9c
refactor and add properties to constructor.
chjj Apr 18, 2012
bb58810
typos
May 7, 2012
cdf7163
Merge pull request #24 from pyrotechnick/patch-1
chjj May 9, 2012
148500e
fix device status cursor position reporting
chjj May 12, 2012
880d775
add tests
chjj May 14, 2012
c4396ae
add shift modifier support to backspace and tab
chjj May 14, 2012
f3cb68b
add EventEmitter and events
chjj May 29, 2012
3ebfc7b
prevent code duplication
chjj May 29, 2012
cea7552
add experimental key hooks. fix misc event related things.
chjj May 30, 2012
5f5be66
require pty.js v0.1.2
chjj May 30, 2012
ad15a3e
make Terminal more streamlike
chjj May 31, 2012
0d791ee
handle alt-`
chjj May 31, 2012
70c9fbf
hook into key events instead of hooking key handler.
chjj May 31, 2012
e42db4c
expose everything. better namespacing.
chjj May 31, 2012
4155618
have term.js set title.
chjj May 31, 2012
25cb2cc
major refactor of lib/tty.js.
chjj Jun 13, 2012
db64632
fully implement charset switching. fixes elinks bug. closes #28.
chjj Jun 13, 2012
2a66683
add glevel methods and eventemitter calls.
chjj Jun 15, 2012
247b452
use different inheritence, futureproof for express.
chjj Jun 15, 2012
d7b14c8
refactor, remove hooks, config.
chjj Jun 19, 2012
36717df
more robust charset management
chjj Jun 19, 2012
0f5aca8
change logger and session management.
chjj Jun 21, 2012
bf2b196
refactor config.js
chjj Jun 24, 2012
db8db4e
express compat
chjj Jun 27, 2012
bd89f7a
update package.json. stricter dependency versions.
chjj Jun 27, 2012
bbe39f3
v0.2.7
chjj Jun 27, 2012
eb9b92a
drop older express compatibility.
chjj Jul 11, 2012
19a886b
sync session
chjj Jul 22, 2012
31a2215
minor refactor and comments.
chjj Jul 22, 2012
e45ad55
remove comments explaining a way to avoid handleDisconnect call.
chjj Jul 22, 2012
9c632c3
send SIGWINCH to processes during sync.
chjj Jul 22, 2012
14b5956
refactor, add -k option, set default rows to 24.
chjj Jul 22, 2012
be2d3ef
misc
chjj Jul 23, 2012
9e6a207
redraw terminals better on sync
chjj Jul 24, 2012
95d2db9
add localOnly option
chjj Jul 24, 2012
7ed3477
fix checkConfig
chjj Sep 14, 2012
e3c4dda
stay up to date with express and socket.io
chjj Sep 14, 2012
c1c2c55
fix initLocal
chjj Sep 14, 2012
067dc42
get rid of express createServer warning.
chjj Sep 14, 2012
d69507b
v0.2.8
chjj Oct 22, 2012
038fd11
fix terminal reset with event emitter.
chjj Oct 22, 2012
ad73315
add simple terminal example.
chjj Oct 22, 2012
ec30c47
slightly improve example.
chjj Oct 24, 2012
e3f3b95
include mit license in term.js. see #47.
chjj Nov 19, 2012
a2f67ee
add add https.disabled option.
chjj Dec 14, 2012
55e1a9b
misc. comments.
chjj Jan 3, 2013
985ac5f
Add potential fixes for #54.
chjj Jan 6, 2013
5c6545d
use express 3.0.6 and socket.io 0.9.13.
chjj Jan 12, 2013
fce9172
update dependencies
chjj Feb 2, 2013
7af4aab
v0.2.9
chjj Feb 2, 2013
d379c6f
term.js: Consult application cursor (not keypad) mode for arrow keys
Feb 16, 2013
6411296
Merge pull request #66 from CyberShadow/fix-mc-arrow-keys
chjj Feb 19, 2013
417c74a
allow `\200 === \0`
chjj Feb 24, 2013
1a12eba
allow dynamic arguments.
chjj Mar 10, 2013
e94504a
allow custom socket.io options.
chjj Mar 10, 2013
bb77898
use pty.js v0.2.2.
chjj Mar 30, 2013
9c18dd3
v0.2.10
chjj Mar 30, 2013
30a7a41
allow everlasting sessions.
chjj Apr 3, 2013
52aa966
allow a custom escape key for browsers like dwb.
chjj Apr 3, 2013
b773681
potentially allow bubble canceling.
chjj Apr 3, 2013
fcd8c3d
make the code reverse-proxy friendly
May 24, 2013
696f4fa
relative path in example/index.html also
May 24, 2013
06bd66d
Merge pull request #88 from risacher/reverse-proxy-friendly
chjj May 24, 2013
fd25c83
misc
chjj Jun 15, 2013
e103c3a
rm static/term.js and use the term.js module.
chjj Aug 8, 2013
9d60d95
use term.js.
chjj Aug 8, 2013
011c56d
move example and tests to term.js.
chjj Aug 8, 2013
2c59710
refactor new tty.open code.
chjj Aug 8, 2013
6460138
v0.2.11
chjj Aug 8, 2013
f412c3a
move example to term.js repo.
chjj Aug 8, 2013
c873d4d
v0.2.12-1
chjj Aug 8, 2013
829834d
use term.js v0.0.2.
chjj Aug 8, 2013
f613deb
v0.2.12-2
chjj Aug 8, 2013
df55fc4
readme. package.json tags.
chjj Aug 8, 2013
165f708
remove unused code.
chjj Aug 11, 2013
217a449
do not pollute Terminal object.
chjj Aug 13, 2013
243f02d
hook into term.js's prefix mode keys.
chjj Aug 16, 2013
3f28d54
remove escapeKey option.
chjj Aug 18, 2013
95f756a
remove old window focus shortcuts.
chjj Aug 18, 2013
1af09c7
v0.2.13
chjj Aug 25, 2013
11aea19
use express 3.4.4 and socket.io 0.9.16.
chjj Nov 8, 2013
8f518e1
add CLA to readme.
chjj Dec 4, 2013
2ef9e0b
fix CLA.
chjj Dec 4, 2013
0cee00a
misc. comments.
chjj Mar 3, 2014
dce1023
use pty.js v0.2.4.
chjj Mar 6, 2014
fd11e8e
use updated pty.js and term.js.
chjj Mar 29, 2015
df25b1d
v0.2.14
chjj Mar 29, 2015
83a516c
Fix issue with pty.js 0.2.7 having been removed from npm.
Page- Apr 1, 2015
212f767
Merge pull request #141 from Page-/fix-pty-version
chjj Apr 1, 2015
aa25ee4
v0.2.14-1
chjj Apr 1, 2015
44d39b2
package: license.
chjj Aug 6, 2015
383d439
update pty.js and term.js. fixes #146.
chjj Aug 6, 2015
1996ff6
v0.2.15
chjj Aug 6, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.git*
build/
.lock-wscript
out/
Makefile.gyp
*.Makefile
*.target.gyp.mk
node_modules/
img/
test/
*.node
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2011-2012, Christopher Jeffrey (https://github.com/chjj/)
Copyright (c) 2012-2013, Christopher Jeffrey (https://github.com/chjj/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
67 changes: 49 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
A terminal in your browser using node.js and socket.io. Based on Fabrice
Bellard's vt100 for [jslinux](http://bellard.org/jslinux/).

For the standalone web terminal, see
[**term.js**](https://github.com/chjj/term.js).

For the lowlevel terminal spawner, see
[**pty.js**](https://github.com/chjj/pty.js).

## Screenshots

### irssi
Expand All @@ -23,13 +29,37 @@ Bellard's vt100 for [jslinux](http://bellard.org/jslinux/).
- Screen/Tmux-like keys (optional)
- Ability to efficiently render programs: vim, mc, irssi, vifm, etc.
- Support for xterm mouse events
- 256 color support
- Persistent sessions

## Install

``` bash
$ npm install tty.js
```

## Usage

tty.js is an app, but it's also possible to hook into it programatically.

``` js
var tty = require('tty.js');

var app = tty.createServer({
shell: 'bash',
users: {
foo: 'bar'
},
port: 8000
});

app.get('/foo', function(req, res, next) {
res.send('bar');
});

app.listen();
```

## Configuration

Configuration is stored in `~/.tty.js/config.json` or `~/.tty.js` as a single
Expand All @@ -51,11 +81,16 @@ JSON file. An example configuration file looks like:
"static": "./static",
"limitGlobal": 10000,
"limitPerUser": 1000,
"hooks": "./hooks.js",
"localOnly": false,
"cwd": ".",
"syncSession": false,
"sessionTimeout": 600000,
"log": true,
"io": { "log": false },
"debug": false,
"term": {
"termName": "xterm",
"geometry": [80, 30],
"geometry": [80, 24],
"scrollback": 1000,
"visualBell": false,
"popOnBell": false,
Expand All @@ -69,36 +104,26 @@ JSON file. An example configuration file looks like:
"#3465a4",
"#75507b",
"#06989a",
"#d3d7cf"
"#d3d7cf",
"#555753",
"#ef2929",
"#8ae234",
"#fce94f",
"#729fcf",
"#ad7fa8",
"#34e2e2",
"#eeeeec",
"#000000",
"#f0f0f0"
"#eeeeec"
]
}
}
```

Usernames and passwords can be plaintext or sha1 hashes.

### Example Hooks File

``` js
var db = require('./db');
### 256 colors

module.exports = {
auth: function(user, pass, next) {
// Do database auth
next(null, pass === password);
}
};
```
If tty.js fails to check your terminfo properly, you can force your `TERM`
to `xterm-256color` by setting `"termName": "xterm-256color"` in your config.

## Security

Expand Down Expand Up @@ -138,8 +163,14 @@ The distance to go before full xterm compatibility.
- Origin Mode, Insert Mode
- Proper Tab Setting

## Contribution and License Agreement

If you contribute code to this project, you are implicitly allowing your code
to be distributed under the MIT license. You are also implicitly verifying that
all code is your original work. `</legalese>`

## License

Copyright (c) 2012, Christopher Jeffrey (MIT License)
Copyright (c) 2012-2014, Christopher Jeffrey (MIT License)

[1]: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#Mouse%20Tracking
41 changes: 11 additions & 30 deletions bin/tty.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,15 @@
#!/bin/bash
#!/usr/bin/env node

f=$0
while test -L "$f"; do
f=$(readlink "$f")
done
dir="$(dirname "$f")/.."
/**
* tty.js
* Copyright (c) 2012-2014, Christopher Jeffrey (MIT License)
*/

node=$(which node 2>/dev/null)
if test -z "$node"; then
node="/usr/local/bin/node"
if test ! -f "$node"; then
echo "Node not found."
exit 1
fi
fi
process.title = 'tty.js';

for arg in "$@"; do
case "$arg" in
-d | --daemonize | production | --production)
daemonize=1
break
;;
-h | --help)
exec man "$dir/man/tty.js.1"
;;
esac
done
var tty = require('../');

if test -n "$daemonize"; then
(setsid "$node" "$dir/index.js" $@ > /dev/null 2>&1 &)
else
exec "$node" "$dir/index.js" $@
fi
var conf = tty.config.readConfig()
, app = tty.createServer(conf);

app.listen();
Loading