Browse Source
* add babel for backwards compatible * wrong pre-commit * wrong pre-commit * fix code-climate errors * fix utf error * re add mobile support * use classes * testing * move #!pull/126/head
Cian Butler
8 years ago
committed by
GitHub
15 changed files with 3103 additions and 16585 deletions
@ -0,0 +1,11 @@ |
|||
{ |
|||
"presets": [ |
|||
[ |
|||
"es2015", |
|||
{ |
|||
"modules": false |
|||
} |
|||
] |
|||
], |
|||
"compact": true, |
|||
} |
@ -1,47 +1,73 @@ |
|||
{ |
|||
"extends": "standard", |
|||
"env": { |
|||
"es6": true, |
|||
"jest": true, |
|||
"node": true |
|||
'env': { |
|||
'es6' : true, |
|||
'node' : true, |
|||
}, |
|||
"globals": { |
|||
"GENTLY": true |
|||
}, |
|||
"rules": { |
|||
"no-multi-spaces": 0, |
|||
"comma-dangle": [ |
|||
"error", |
|||
"always-multiline" |
|||
], |
|||
"key-spacing": [ |
|||
"error", |
|||
"extends": [ |
|||
'eslint:recommended' |
|||
], |
|||
'rules' : { |
|||
'indent': [ |
|||
'error', |
|||
2, |
|||
], |
|||
'linebreak-style': [ |
|||
'error', |
|||
'unix', |
|||
], |
|||
'quotes': [ |
|||
'error', |
|||
'single', |
|||
], |
|||
'semi': [ |
|||
'error', |
|||
'always', |
|||
], |
|||
'comma-dangle': [ |
|||
'error', |
|||
'always-multiline', |
|||
], |
|||
'key-spacing': [ |
|||
'error', |
|||
{ |
|||
"multiLine": { |
|||
"beforeColon": false, |
|||
"afterColon": true |
|||
'multiLine': { |
|||
'beforeColon': false, |
|||
'afterColon' : true, |
|||
}, |
|||
"align": { |
|||
"beforeColon": false, |
|||
"afterColon": true, |
|||
"on": "colon", |
|||
"mode": "strict" |
|||
} |
|||
} |
|||
'align': { |
|||
'beforeColon': false, |
|||
'afterColon' : true, |
|||
'on' : 'colon', |
|||
'mode' : 'strict', |
|||
}, |
|||
}, |
|||
], |
|||
"semi": [ |
|||
"error", |
|||
"always" |
|||
'no-var': [ |
|||
'error', |
|||
], |
|||
"no-var": [ |
|||
"error" |
|||
'no-console': [ |
|||
'error', |
|||
{ |
|||
'allow': [ |
|||
'warn', |
|||
'trace', |
|||
'log', |
|||
'error' |
|||
] |
|||
} |
|||
], |
|||
"prefer-const": [ |
|||
"error", |
|||
'prefer-arrow-callback': [ |
|||
'error', |
|||
{ |
|||
"destructuring": "any", |
|||
"ignoreReadBeforeAssign": false |
|||
'allowNamedFunctions': true |
|||
} |
|||
] |
|||
} |
|||
], |
|||
'prefer-const': [ |
|||
'error', |
|||
{ |
|||
'destructuring' : 'any', |
|||
'ignoreReadBeforeAssign': false, |
|||
}, |
|||
], |
|||
}, |
|||
} |
|||
|
@ -1,36 +0,0 @@ |
|||
module.exports = grunt => { |
|||
require('load-grunt-tasks')(grunt); |
|||
|
|||
const config = { |
|||
mkdir: { |
|||
tmp: { |
|||
options: { |
|||
create: ['tmp'], |
|||
}, |
|||
}, |
|||
}, |
|||
gitclone: { |
|||
hterm: { |
|||
options: { |
|||
cwd : './tmp', |
|||
repository: 'https://chromium.googlesource.com/apps/libapps', |
|||
}, |
|||
}, |
|||
}, |
|||
shell: { |
|||
build_hterm: { |
|||
command: 'LIBDOT_SEARCH_PATH=$(pwd) ./libdot/bin/concat.sh -i ./hterm/concat/hterm_all.concat -o ../../public/wetty/hterm_all.js', |
|||
options: { |
|||
execOptions: { |
|||
cwd: './tmp/libapps', |
|||
}, |
|||
}, |
|||
}, |
|||
}, |
|||
clean: ['./tmp'], |
|||
}; |
|||
|
|||
grunt.initConfig(config); |
|||
|
|||
grunt.registerTask('default', ['mkdir:tmp', 'gitclone:hterm', 'shell:build_hterm', 'clean']); |
|||
}; |
@ -1,3 +0,0 @@ |
|||
#!/usr/bin/env node
|
|||
|
|||
require('../app'); |
@ -0,0 +1,37 @@ |
|||
const gulp = require('gulp'); |
|||
const concat = require('gulp-concat'); |
|||
const minify = require('gulp-minify'); |
|||
const babel = require('gulp-babel'); |
|||
const shell = require('gulp-shell'); |
|||
const del = require('del'); |
|||
|
|||
gulp.task('compress', ['hterm'], () => gulp |
|||
.src([ |
|||
'./libapps/hterm_all.js', |
|||
'./src/wetty.js', |
|||
]) |
|||
.pipe(concat('wetty.js')) |
|||
.pipe(babel()) |
|||
.pipe( |
|||
minify({ |
|||
ext: { |
|||
min: '.min.js', |
|||
}, |
|||
exclude : ['tasks'], |
|||
noSource : true, |
|||
ignoreFiles: ['.combo.js', '*.min.js'], |
|||
}) |
|||
) |
|||
.pipe(gulp.dest('./public/wetty'))); |
|||
|
|||
gulp.task('hterm', |
|||
shell.task([ |
|||
'git clone https://chromium.googlesource.com/apps/libapps', |
|||
'LIBDOT_SEARCH_PATH=$(pwd)/libapps ./libapps/libdot/bin/concat.sh -i ./libapps/hterm/concat/hterm_all.concat -o ./libapps/hterm_all.js', |
|||
], { |
|||
verbose: true, |
|||
})); |
|||
|
|||
gulp.task('default', ['compress'], () => { |
|||
return del(['./libapps']); |
|||
}); |
File diff suppressed because it is too large
@ -1,76 +0,0 @@ |
|||
var term; |
|||
var socket = io(location.origin, {path: '/wetty/socket.io'}) |
|||
var buf = ''; |
|||
|
|||
function Wetty(argv) { |
|||
this.argv_ = argv; |
|||
this.io = null; |
|||
this.pid_ = -1; |
|||
} |
|||
|
|||
Wetty.prototype.run = function() { |
|||
this.io = this.argv_.io.push(); |
|||
|
|||
this.io.onVTKeystroke = this.sendString_.bind(this); |
|||
this.io.sendString = this.sendString_.bind(this); |
|||
this.io.onTerminalResize = this.onTerminalResize.bind(this); |
|||
} |
|||
|
|||
Wetty.prototype.sendString_ = function(str) { |
|||
socket.emit('input', str); |
|||
}; |
|||
|
|||
Wetty.prototype.onTerminalResize = function(col, row) { |
|||
socket.emit('resize', { col: col, row: row }); |
|||
}; |
|||
|
|||
socket.on('connect', function() { |
|||
document.getElementById("overlay").style.display = "none"; |
|||
window.addEventListener('beforeunload', handler, false); |
|||
lib.init(function() { |
|||
hterm.defaultStorage = new lib.Storage.Local(); |
|||
term = new hterm.Terminal(); |
|||
window.term = term; |
|||
term.decorate(document.getElementById('terminal')); |
|||
|
|||
term.setCursorPosition(0, 0); |
|||
term.setCursorVisible(true); |
|||
term.prefs_.set('ctrl-c-copy', true); |
|||
term.prefs_.set('ctrl-v-paste', true); |
|||
term.prefs_.set('use-default-window-copy', true); |
|||
|
|||
term.runCommandClass(Wetty, document.location.hash.substr(1)); |
|||
socket.emit('resize', { |
|||
col: term.screenSize.width, |
|||
row: term.screenSize.height |
|||
}); |
|||
|
|||
if (buf && buf != '') { |
|||
term.io.writeUTF16(buf); |
|||
buf = ''; |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
socket.on('output', function(data) { |
|||
if (!term) { |
|||
buf += data; |
|||
return; |
|||
} |
|||
term.io.writeUTF16(data); |
|||
}); |
|||
|
|||
socket.on('logout', function(data) { |
|||
document.getElementById("overlay").style.display = "block"; |
|||
window.removeEventListener('beforeunload', handler, false); |
|||
}); |
|||
|
|||
socket.on('disconnect', function() { |
|||
document.getElementById("overlay").style.display = "block"; |
|||
window.removeEventListener('beforeunload', handler, false); |
|||
}); |
|||
|
|||
function handler (e) { |
|||
e.returnValue = "Are you sure?"; |
|||
return e.returnValue; |
|||
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,67 @@ |
|||
{ |
|||
'env': { |
|||
'es6' : true, |
|||
'browser': true, |
|||
}, |
|||
'globals': { |
|||
'hterm': true, |
|||
'lib': true, |
|||
'io': true |
|||
}, |
|||
"extends": [ |
|||
'eslint:recommended' |
|||
], |
|||
'rules' : { |
|||
'indent': [ |
|||
'error', |
|||
2, |
|||
], |
|||
'linebreak-style': [ |
|||
'error', |
|||
'unix', |
|||
], |
|||
'quotes': [ |
|||
'error', |
|||
'single', |
|||
], |
|||
'semi': [ |
|||
'error', |
|||
'always', |
|||
], |
|||
'comma-dangle': [ |
|||
'error', |
|||
'always-multiline', |
|||
], |
|||
'key-spacing': [ |
|||
'error', |
|||
{ |
|||
'multiLine': { |
|||
'beforeColon': false, |
|||
'afterColon' : true, |
|||
}, |
|||
'align': { |
|||
'beforeColon': false, |
|||
'afterColon' : true, |
|||
'on' : 'colon', |
|||
'mode' : 'strict', |
|||
}, |
|||
}, |
|||
], |
|||
'no-var': [ |
|||
'error', |
|||
], |
|||
'prefer-arrow-callback': [ |
|||
'error', |
|||
{ |
|||
'allowNamedFunctions': true |
|||
} |
|||
], |
|||
'prefer-const': [ |
|||
'error', |
|||
{ |
|||
'destructuring' : 'any', |
|||
'ignoreReadBeforeAssign': false, |
|||
}, |
|||
], |
|||
}, |
|||
} |
@ -0,0 +1,83 @@ |
|||
const socket = io(location.origin, {path: '/wetty/socket.io'}); |
|||
let term; |
|||
let buf = ''; |
|||
|
|||
class Wetty { |
|||
constructor(argv) { |
|||
this.argv_ = argv; |
|||
this.io = null; |
|||
this.pid_ = -1; |
|||
} |
|||
|
|||
run() { |
|||
this.io = this.argv_.io.push(); |
|||
this.io.onVTKeystroke = this.sendString_.bind(this); |
|||
this.io.sendString = this.sendString_.bind(this); |
|||
this.io.onTerminalResize = this.onTerminalResize.bind(this); |
|||
} |
|||
|
|||
sendString_(str) { |
|||
socket.emit('input', str); |
|||
} |
|||
|
|||
onTerminalResize(col, row) { |
|||
socket.emit('resize', { col, row }); |
|||
} |
|||
} |
|||
|
|||
socket.on('connect', () => { |
|||
document.getElementById('overlay').style.display = 'none'; |
|||
window.addEventListener('beforeunload', handler, false); |
|||
lib.init(() => { |
|||
hterm.defaultStorage = new lib.Storage.Local(); |
|||
term = new hterm.Terminal(); |
|||
window.term = term; |
|||
term.decorate(document.getElementById('terminal')); |
|||
|
|||
term.setCursorPosition(0, 0); |
|||
term.setCursorVisible(true); |
|||
term.prefs_.set('ctrl-c-copy', true); |
|||
term.prefs_.set('ctrl-v-paste', true); |
|||
term.prefs_.set('use-default-window-copy', true); |
|||
term.prefs_.set('send-encoding', 'raw'); |
|||
term.prefs_.set('receive-encoding', 'raw'); |
|||
term.scrollPort_.screen_.setAttribute('spellcheck', 'false'); |
|||
term.scrollPort_.screen_.setAttribute('autocorrect', 'false'); |
|||
term.scrollPort_.screen_.setAttribute('autocomplete', 'false'); |
|||
term.scrollPort_.screen_.setAttribute('contenteditable', 'true'); |
|||
|
|||
term.runCommandClass(Wetty, document.location.hash.substr(1)); |
|||
socket.emit('resize', { |
|||
col: term.screenSize.width, |
|||
row: term.screenSize.height, |
|||
}); |
|||
|
|||
if (buf && buf !== '') { |
|||
term.io.writeUTF8(buf); |
|||
buf = ''; |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
socket.on('output', (data) => { |
|||
if (!term) { |
|||
buf += data; |
|||
return; |
|||
} |
|||
term.io.writeUTF8(data); |
|||
}); |
|||
|
|||
socket.on('logout', () => { |
|||
document.getElementById('overlay').style.display = 'block'; |
|||
window.removeEventListener('beforeunload', handler, false); |
|||
}); |
|||
|
|||
socket.on('disconnect', () => { |
|||
document.getElementById('overlay').style.display = 'block'; |
|||
window.removeEventListener('beforeunload', handler, false); |
|||
}); |
|||
|
|||
function handler (event) { |
|||
event.returnValue = 'Are you sure?'; |
|||
return event.returnValue; |
|||
} |
File diff suppressed because it is too large
Loading…
Reference in new issue