web-console-rails3 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +1 -1
  3. data/Rakefile +1 -1
  4. data/app/assets/javascripts/web_console/application.js +0 -1
  5. data/app/assets/javascripts/web_console/console_sessions.js +177 -3
  6. data/app/assets/stylesheets/web_console/application.css +0 -1
  7. data/app/assets/stylesheets/web_console/console_sessions.css.erb +6 -0
  8. data/app/controllers/web_console/application_controller.rb +1 -6
  9. data/app/views/web_console/console_sessions/index.html.erb +11 -5
  10. data/lib/{web_console/backport/active_model.rb → active_model/model.rb} +0 -0
  11. data/lib/assets/javascripts/web_console.js +22 -183
  12. data/lib/web_console.rb +1 -9
  13. data/lib/web_console/colors.rb +86 -0
  14. data/lib/web_console/colors/light.rb +24 -0
  15. data/lib/web_console/colors/solarized.rb +47 -0
  16. data/lib/web_console/colors/tango.rb +24 -0
  17. data/lib/web_console/colors/xterm.rb +24 -0
  18. data/lib/web_console/engine.rb +34 -12
  19. data/lib/web_console/engine.rb.orig +75 -0
  20. data/lib/web_console/slave.rb +19 -1
  21. data/lib/web_console/version.rb +1 -1
  22. data/test/dummy/config/application.rb +13 -0
  23. data/test/dummy/db/development.sqlite3 +0 -0
  24. data/test/dummy/log/development.log +275 -29309
  25. data/test/dummy/log/test.log +16 -2337
  26. data/test/dummy/tmp/cache/assets/C3D/0C0/sprockets%2Fb01666017530b122ba58894b59b1551b +0 -0
  27. data/test/dummy/tmp/cache/assets/C5D/870/sprockets%2F9695d21699b362bcc13260e71b679474 +0 -0
  28. data/test/dummy/tmp/cache/assets/C79/7C0/sprockets%2F831cb415f919c0a15d95e148020953f2 +0 -0
  29. data/test/dummy/tmp/cache/assets/CB7/870/sprockets%2F5358761e3329e2a4655ee7c0fd2609b5 +0 -0
  30. data/test/dummy/tmp/cache/assets/CD0/9A0/sprockets%2F61b95b7833a131f56a2096a3d2ba0c94 +0 -0
  31. data/test/dummy/tmp/cache/assets/CDA/480/sprockets%2F26eb073018913d788d2ee3f5151eea04 +0 -0
  32. data/test/dummy/tmp/cache/assets/CE1/850/sprockets%2Fb962434bbb22f17db956b8091c975f30 +0 -0
  33. data/test/dummy/tmp/cache/assets/D0C/EE0/sprockets%2F3fdf5762c392175ad2cba21454e5b972 +0 -0
  34. data/test/dummy/tmp/cache/assets/D42/180/sprockets%2F4af57a79abba3d4790ba1e7157f41939 +0 -0
  35. data/test/dummy/tmp/cache/assets/D54/E60/sprockets%2F8abf0788cb7dc878ea82239456149bed +0 -0
  36. data/test/dummy/tmp/cache/assets/D5F/7E0/sprockets%2F26c1c2c6ba96ba84abf150e402d677c3 +0 -0
  37. data/test/dummy/tmp/cache/assets/D66/680/sprockets%2Fe0ba18d897f0c45f5e66b003c5ebd061 +0 -0
  38. data/test/dummy/tmp/cache/assets/D66/AE0/sprockets%2F25c91de251a8ab43652dc2ef55e2a29d +0 -0
  39. data/test/dummy/tmp/cache/assets/DA7/470/sprockets%2F65bb61bf1edac19c0666e89b667d23ff +0 -0
  40. data/test/dummy/tmp/cache/assets/DA9/F60/sprockets%2Fa95e444e8dca0e1a586dcef972b623f7 +0 -0
  41. data/test/dummy/tmp/cache/assets/DAC/A90/sprockets%2F2015f79881b518e9cdcdaf8dfb3e46c5 +0 -0
  42. data/test/web_console/colors_test.rb +58 -0
  43. data/vendor/assets/javascripts/term.js +5726 -0
  44. metadata +110 -117
  45. data/app/assets/stylesheets/web_console/console_sessions.css +0 -0
  46. data/test/dummy/config/application.rb.orig +0 -58
  47. data/test/dummy/tmp/cache/assets/C9E/AD0/sprockets%2F4a42d8916f3fa47867445f696497a92c +0 -0
  48. data/test/dummy/tmp/cache/assets/CA7/D70/sprockets%2F3e9e32bbc8c81a93002555265a36a852 +0 -0
  49. data/test/dummy/tmp/cache/assets/CBD/6E0/sprockets%2F3293dfc0984076f0e8371a9e7640f4a8 +0 -0
  50. data/test/dummy/tmp/cache/assets/CD0/FC0/sprockets%2Fbb2777627d42a216f3d9ced4322040b3 +0 -0
  51. data/test/dummy/tmp/cache/assets/CFA/E30/sprockets%2F35be1d26565dc0310c29f1a5e2f62f10 +0 -0
  52. data/test/dummy/tmp/cache/assets/D1D/FD0/sprockets%2Fa4a5ffe670666ce3d8d59179905201ef +0 -0
  53. data/test/dummy/tmp/cache/assets/D21/6B0/sprockets%2F9e242803fe56d6305274ff7e6487deda +0 -0
  54. data/test/dummy/tmp/cache/assets/D22/980/sprockets%2Fce6aa94ad2bc107104c0540f62c5128c +0 -0
  55. data/test/dummy/tmp/cache/assets/D29/380/sprockets%2F92f1a0450bc4bea3364a07be42b4f645 +0 -0
  56. data/test/dummy/tmp/cache/assets/D3E/380/sprockets%2F434d98c8380bb9daf43810155aaf68ba +0 -0
  57. data/test/dummy/tmp/cache/assets/D66/940/sprockets%2F6151175b6ad4f9bab0c7e2b508e7b70f +0 -0
  58. data/test/dummy/tmp/cache/assets/D69/670/sprockets%2Fc6b4a05846fd1b98fe9252ecdd1601c0 +0 -0
  59. data/test/dummy/tmp/cache/assets/D69/710/sprockets%2Ff67078d4b979a58c97feede196f6b385 +0 -0
  60. data/test/dummy/tmp/cache/assets/D90/B30/sprockets%2Fe03fe93eb7fe888c9d21ee62816596ff +0 -0
  61. data/test/dummy/tmp/cache/assets/D95/C40/sprockets%2F09cb0a274209abf0391cbfce6ee67b82 +0 -0
  62. data/test/dummy/tmp/cache/assets/D9B/A30/sprockets%2Fc3436b3fe5da7c2456f26e2ae36da6c5 +0 -0
  63. data/test/dummy/tmp/cache/assets/D9F/400/sprockets%2F7f60332f86073dc8ed80b4c2a9dfcbe1 +0 -0
  64. data/test/dummy/tmp/cache/assets/DAE/8C0/sprockets%2Fa9b8f7bc5ca2efe658a13d7f4609c729 +0 -0
  65. data/test/dummy/tmp/cache/assets/DB3/0C0/sprockets%2F689fb998e2a7add3e00db88df254c87a +0 -0
  66. data/test/dummy/tmp/cache/assets/DD4/440/sprockets%2Fa33d646ac00d8bc87a4a496af6eed96f +0 -0
  67. data/test/dummy/tmp/cache/assets/DDB/890/sprockets%2F5ed566ca9fafd1b82373ffea2a8d8681 +0 -0
  68. data/test/dummy/tmp/cache/assets/E5A/C40/sprockets%2F164cfa0fd9eb1ec1acdfaa278c83e9c5 +0 -0
  69. data/vendor/assets/javascripts/vt100.js +0 -4408
  70. data/vendor/assets/stylesheets/vt100.css +0 -272
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4556090d4990261a3b9cbdfa3e9eb35bc50772ca
4
- data.tar.gz: f73bd7ae863f2aa237be9160efd7dbb4bd33b4b5
3
+ metadata.gz: dbc0a729da56cc72ec280e4c61dff38133b54626
4
+ data.tar.gz: 3a3879f62b9fe309ce47a160d9d978ebc7c184d5
5
5
  SHA512:
6
- metadata.gz: edd0352d444bf3e257e43c0943a6e551e37448b2ac3bd9f1b2d135db93763ee2df5ddf4840bfe3077d23045d70775bde0908e7faf2e2990e57fc1adc7922577d
7
- data.tar.gz: 15d85727b97fd2b305faeb24e75002a0023807afdcb93455b43376b4b059c4314fab6fdc883e284a3da1a61ec7ff69d354bdb3bed5d37294e63af905bbda9828
6
+ metadata.gz: 9f6d3fcc41bcb977ea4a45e5c1d8efa71d4c6af467c3f6b16105f2a6e8d69ce1fa3db0a72fe384b3811ed5c06ae7ea805e0f6722df3f28ae32938fc7211fe4a1
7
+ data.tar.gz: 94dcde582093e9ea37ef3999949acdb6a683122063fec5b97c3476de66dd8c32bfe5d94c973dae82a8881cad940b66a514119807d664f70265205eeb61850f4f
data/README.markdown CHANGED
@@ -21,7 +21,7 @@ To install it in your current application, add the following to your `Gemfile`.
21
21
 
22
22
  ```ruby
23
23
  group :development do
24
- gem 'web-console-rails3', '~> 0.3.0'
24
+ gem 'web-console-rails3', '~> 0.4.1'
25
25
  end
26
26
  ```
27
27
 
data/Rakefile CHANGED
@@ -25,7 +25,7 @@ Bundler::GemHelper.install_tasks if defined? Bundler::GemHelper
25
25
  namespace :docker do
26
26
  task :sync do
27
27
  Dir.chdir(EXPANDED_CWD) do
28
- sh "git fetch && git reset --hard origin/master", verbose: false
28
+ sh 'git fetch && git reset --hard origin/master', verbose: false
29
29
  end
30
30
  end
31
31
 
@@ -1,2 +1 @@
1
- //= require web_console
2
1
  //= require_tree .
@@ -1,3 +1,177 @@
1
- window.onload = function() {
2
- window.terminal = new WebConsole.Terminal(TerminalSettings);
3
- };
1
+ //= require web-console
2
+
3
+ var AJAXTransport = (function(WebConsole) {
4
+
5
+ var inherits = WebConsole.inherits;
6
+ var EventEmitter = WebConsole.EventEmitter;
7
+
8
+ // Use an IE friendly implementation of XMLHttpRequest.
9
+ XHR = (function() {
10
+ try {
11
+ return XMLHttpRequest;
12
+ } catch (e) {
13
+ return function() {
14
+ return new ActiveXObject('Microsoft.XMLHTTP');
15
+ };
16
+ }
17
+ }).call(this);
18
+
19
+ var AJAXTransport = function(options) {
20
+ EventEmitter.call(this);
21
+ options || (options = {});
22
+
23
+ this.url = (typeof options.url === 'string') ? {
24
+ input: options.url,
25
+ pendingOutput: options.url,
26
+ configuration: options.url
27
+ } : options.url;
28
+
29
+ this.pendingInput = '';
30
+
31
+ this.on('input', this.sendInput);
32
+ this.on('configuration', this.sendConfiguration);
33
+ this.once('initialization', function(cols, rows) {
34
+ this.emit('configuration', cols, rows);
35
+ this.pollForPendingOutput();
36
+ });
37
+ };
38
+
39
+ inherits(AJAXTransport, EventEmitter);
40
+
41
+ // Shorthand for creating XHR requests.
42
+ AJAXTransport.prototype.createRequest = function(method, url, options) {
43
+ options || (options = {});
44
+
45
+ var request = new XHR();
46
+ request.open(method, url);
47
+
48
+ if (typeof options.form === 'object') {
49
+ var content = [], form = options.form;
50
+
51
+ for (var key in form) {
52
+ var value = form[key];
53
+ content.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
54
+ }
55
+
56
+ var formMimeType = 'application/x-www-form-urlencoded; charset=utf-8';
57
+ request.setRequestHeader('Content-Type', formMimeType);
58
+ request.data = content.join('&');
59
+ }
60
+
61
+ return request;
62
+ };
63
+
64
+ AJAXTransport.prototype.pollForPendingOutput = function() {
65
+ var request = this.createRequest('GET', this.url.pendingOutput);
66
+
67
+ var self = this;
68
+ request.onreadystatechange = function() {
69
+ if (request.readyState === 4) {
70
+ if (request.status === 200) {
71
+ self.emit('pendingOutput', request.responseText);
72
+ self.pollForPendingOutput();
73
+ } else {
74
+ self.emit('disconnect', request);
75
+ }
76
+ }
77
+ };
78
+
79
+ request.send(null);
80
+ };
81
+
82
+ // Send the input to the server.
83
+ //
84
+ // Each key press is encoded to an intermediate format, before it is sent to
85
+ // the server.
86
+ //
87
+ // WebConsole#keysPressed is an alias for WebConsole#sendInput.
88
+ AJAXTransport.prototype.sendInput = function(input) {
89
+ input || (input = '');
90
+
91
+ if (this.disconnected) return;
92
+ if (this.sendingInput) return this.pendingInput += input;
93
+
94
+ // Indicate that we are starting to send input.
95
+ this.sendingInput = true;
96
+
97
+ var request = this.createRequest('PUT', this.url.input, {
98
+ form: { input: this.pendingInput + input }
99
+ });
100
+
101
+ // Clear the pending input.
102
+ this.pendingInput = '';
103
+
104
+ var self = this;
105
+ request.onreadystatechange = function() {
106
+ if (request.readyState === 4) {
107
+ self.sendingInput = false;
108
+ if (self.pendingInput) self.sendInput();
109
+ }
110
+ };
111
+
112
+ request.send(request.data);
113
+ };
114
+
115
+ // Send the terminal configuration to the server.
116
+ //
117
+ // Right now by configuration, we understand the terminal widht and terminal
118
+ // height.
119
+ //
120
+ // WebConsole#resized is an alias for WebConsole#sendconfiguration.
121
+ AJAXTransport.prototype.sendConfiguration = function(cols, rows) {
122
+ if (this.disconnected) return;
123
+
124
+ var request = this.createRequest('PUT', this.url.configuration, {
125
+ form: { width: cols, height: rows }
126
+ });
127
+
128
+ // Just send the configuration and don't care about any output.
129
+ request.send(request.data);
130
+ };
131
+
132
+ return AJAXTransport;
133
+
134
+ }).call(this, WebConsole);
135
+
136
+ window.addEventListener('load', function() {
137
+ var geometry = calculateFitScreenGeometry();
138
+ config.terminal.cols = geometry[0];
139
+ config.terminal.rows = geometry[1];
140
+
141
+ var terminal = window.terminal = new WebConsole.Terminal(config.terminal);
142
+
143
+ terminal.on('data', function(data) {
144
+ transport.emit('input', data);
145
+ });
146
+
147
+ var transport = new AJAXTransport(config.transport);
148
+
149
+ transport.on('pendingOutput', function(response) {
150
+ var json = JSON.parse(response);
151
+ if (json.output) terminal.write(json.output);
152
+ });
153
+
154
+ transport.on('disconnect', function() {
155
+ terminal.destroy();
156
+ });
157
+
158
+ transport.emit('initialization', terminal.cols, terminal.rows);
159
+
160
+ // Utilities
161
+ // ---------
162
+
163
+ function calculateFitScreenGeometry() {
164
+ // Currently, resizing term.js is broken. E.g. opening vi causes it to go
165
+ // back to 80x24 and fail with off-by-one error. Other stuff, like chip8
166
+ // are rendered incorrectly and so on.
167
+ //
168
+ // To work around it, create a temporary terminal, just so we can get the
169
+ // best dimensions for the screen.
170
+ var temporary = new WebConsole.Terminal;
171
+ try {
172
+ return temporary.fitScreen();
173
+ } finally {
174
+ temporary.destroy();
175
+ }
176
+ }
177
+ });
@@ -8,7 +8,6 @@
8
8
  * You're free to add application-wide styles to this file and they'll appear at the top of the
9
9
  * compiled file, but it's generally better to create a new file per style scope.
10
10
  *
11
- *= require vt100
12
11
  *= require_self
13
12
  *= require_tree .
14
13
  */
@@ -0,0 +1,6 @@
1
+ <% WebConsole.config.style.instance_eval do %>
2
+ body { color: <%= colors.foreground %>; background: <%= colors.background %>; margin: 0; padding: 0; }
3
+
4
+ .terminal { float: left; overflow: hidden; font: <%= font %>; }
5
+ .terminal-cursor { color: <%= colors.background %>; background: <%= colors.foreground %>; }
6
+ <% end %>
@@ -1,11 +1,6 @@
1
1
  module WebConsole
2
2
  class ApplicationController < ActionController::Base
3
- class << self
4
- # Alias before_filter to before_action for Rails 3 compatibility.
5
- alias :before_action :before_filter unless defined?(before_filter)
6
- end
7
-
8
- before_action :prevent_unauthorized_requests!
3
+ before_filter :prevent_unauthorized_requests!
9
4
 
10
5
  private
11
6
 
@@ -1,9 +1,15 @@
1
1
  <script>
2
- var TerminalSettings = {
3
- url: {
4
- input: "<%= web_console.input_console_session_path(@console_session) %>",
5
- pendingOutput: "<%= web_console.pending_output_console_session_path(@console_session) %>",
6
- configuration: "<%= web_console.configuration_console_session_path(@console_session) %>"
2
+ var config = {
3
+ terminal: {
4
+ colors: <%= raw WebConsole.config.style.colors.to_json %>
5
+ },
6
+
7
+ transport: {
8
+ url: {
9
+ input: "<%= web_console.input_console_session_path(@console_session) %>",
10
+ pendingOutput: "<%= web_console.pending_output_console_session_path(@console_session) %>",
11
+ configuration: "<%= web_console.configuration_console_session_path(@console_session) %>"
12
+ }
7
13
  }
8
14
  };
9
15
  </script>
@@ -1,202 +1,41 @@
1
- //= require vt100
1
+ //= require term
2
2
 
3
- (function() {
4
-
5
- // Store utilities in an underscore-like object.
6
- var _ = {
7
- // Simple prototypical inheritence helper.
8
- //
9
- // Forces `cls` to inherit from `base` prototype.
10
- inherits: function(cls, base) {
11
- var constructor = _.noop();
12
- constructor.prototype = base.prototype;
13
- cls.prototype = new constructor();
14
- cls.prototype.constructor = cls;
15
- },
16
-
17
- // Factory for empty functions.
18
- noop: function() {
19
- return function() {};
20
- },
21
-
22
- // Binds a function to an explicit context.
23
- bind: Function.prototype.bind ? function(func, context) {
24
- return func.bind(context);
25
- } : function(func, context) {
26
- return function() {
27
- return func.apply(context, arguments);
28
- };
29
- }
30
- };
3
+ ;(function(BaseTerminal) {
31
4
 
32
5
  // Expose the main WebConsole namespace.
33
6
  var WebConsole = this.WebConsole = {};
34
7
 
35
- // Use an IE friendly implementation of XMLHttpRequest.
36
- WebConsole.XHR = (function() {
37
- try {
38
- return XMLHttpRequest;
39
- } catch (e) {
40
- var constructor = function() {
41
- return new ActiveXObject('Microsoft.XMLHTTP');
42
- };
8
+ // Follow term.js example and expose inherits and EventEmitter.
9
+ var inherits = WebConsole.inherits = BaseTerminal.inherits;
10
+ var EventEmitter = WebConsole.EventEmitter = BaseTerminal.EventEmitter;
43
11
 
44
- // Attach the XHR ready states as constants.
45
- constructor.UNSET = 0;
46
- constructor.OPENED = 1;
47
- constructor.HEADERS_RECEIVED = 2;
48
- constructor.LOADING = 3;
49
- constructor.DONE = 3;
50
- return constructor;
12
+ var Terminal = WebConsole.Terminal = function(options) {
13
+ if (typeof options === 'number') {
14
+ return BaseTerminal.apply(this, arguments);
51
15
  }
52
- }).call(this);
53
-
54
- WebConsole.Terminal = function(options) {
55
- options || (options = {});
56
-
57
- if (typeof options.url === 'string') {
58
- this.url = {
59
- input: options.url,
60
- pendingOutput: options.url,
61
- configuration: options.url
62
- };
63
- } else {
64
- this.url = options.url;
65
- }
66
-
67
- this.disableAudio = true;
68
16
 
69
- VT100.call(this);
17
+ BaseTerminal.call(this, options || (options = {}));
70
18
 
71
- this.requestPendingOutput();
72
- };
73
-
74
- // Inherit from VT100.
75
- _.inherits(WebConsole.Terminal, VT100);
76
-
77
- // Try to be minimalistic and disable the context menu.
78
- WebConsole.Terminal.prototype.showContextMenu = _.noop();
79
-
80
- // Don't show the current size on resize.
81
- WebConsole.Terminal.prototype.showCurrentSize = _.noop();
82
-
83
- // Shorthand for creating XHR requests.
84
- WebConsole.Terminal.prototype.createRequest = function(method, url, options) {
85
- options || (options = {});
19
+ this.open();
86
20
 
87
- var request = new WebConsole.XHR();
88
- request.open(method, url);
89
-
90
- if (typeof options.form === 'object') {
91
- var content = [], form = options.form;
92
-
93
- for (var key in form) {
94
- var value = form[key];
95
- content.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
96
- }
97
-
98
- var formMimeType = 'application/x-www-form-urlencoded; charset=utf-8';
99
- request.setRequestHeader('Content-Type', formMimeType);
100
- request.data = content.join('&');
21
+ if (!(options.rows || options.cols) || !options.geometry) {
22
+ this.fitScreen();
101
23
  }
102
-
103
- return request;
104
24
  };
105
25
 
106
- WebConsole.Terminal.prototype.clearPendingInput = function() {
107
- this.pendingInput = '';
108
- };
109
-
110
- WebConsole.Terminal.prototype.feedPendingInput = function(input) {
111
- (this.pendingInput === void 0) && (this.pendingInput = '');
112
- this.pendingInput += input;
113
- };
114
-
115
- WebConsole.Terminal.prototype.requestPendingOutput = function() {
116
- var request = this.createRequest('GET', this.url.pendingOutput);
117
-
118
- request.onreadystatechange = _.bind(function() {
119
- var response;
120
-
121
- if (request.readyState === WebConsole.XHR.DONE) {
122
- if (request.status === 200) {
123
- response = JSON.parse(request.responseText);
124
- if (response.output) {
125
- this.vt100(unescape(encodeURIComponent(response.output)));
126
- }
127
-
128
- this.requestPendingOutput();
129
- } else {
130
- try {
131
- // Try to parse the error if it is a JSON.
132
- response = JSON.parse(request.responseText);
133
- } catch(e) {
134
- // No luck with that, but it's not a big deal.
135
- }
136
- this.disconnect(response && response.error);
137
- }
138
- }
139
- }, this);
140
-
141
- request.send(null);
142
- };
26
+ // Make WebConsole.Terminal inherit from BaseTerminal (term.js).
27
+ inherits(Terminal, BaseTerminal);
143
28
 
144
- // Send the input to the server.
145
- //
146
- // Each key press is encoded to an intermediate format, before it is sent to
147
- // the server.
148
- //
149
- // WebConsole#keysPressed is an alias for WebConsole#sendInput.
150
- WebConsole.Terminal.prototype.sendInput =
151
- WebConsole.Terminal.prototype.keysPressed = function(input) {
152
- input || (input = '');
29
+ Terminal.prototype.fitScreen = function() {
30
+ var width = Math.floor(this.element.clientWidth / this.cols);
31
+ var height = Math.floor(this.element.clientHeight / this.rows);
153
32
 
154
- if (this.disconnected) return;
155
- if (this.sendingInput) return this.feedPendingInput(input);
33
+ var rows = Math.floor(window.innerHeight / height);
34
+ var cols = Math.floor(this.parent.clientWidth / width);
156
35
 
157
- // Indicate that we are starting to send input.
158
- this.sendingInput = true;
159
-
160
- var request = this.createRequest('PUT', this.url.input, {
161
- form: { input: (this.pendingInput || '') + input }
162
- });
163
-
164
- // Clear the pending input.
165
- this.clearPendingInput();
166
-
167
- request.onreadystatechange = _.bind(function() {
168
- if (request.readyState === WebConsole.XHR.DONE) {
169
- this.sendingInput = false;
170
- if (this.pendingInput) this.sendInput();
171
- }
172
- }, this);
173
-
174
- request.send(request.data);
175
- };
176
-
177
- // Send the terminal configuration to the server.
178
- //
179
- // Right now by configuration, we understand the terminal widht and terminal
180
- // height.
181
- //
182
- // WebConsole#resized is an alias for WebConsole#sendconfiguration.
183
- WebConsole.Terminal.prototype.sendConfiguration =
184
- WebConsole.Terminal.prototype.resized = function() {
185
- if (this.disconnected) return;
186
-
187
- var request = this.createRequest('PUT', this.url.configuration, {
188
- form: { width: this.terminalWidth, height: this.terminalHeight }
189
- });
190
-
191
- // Just send the configuration and don't care about any output.
192
- request.send(request.data);
193
- };
36
+ this.resize(cols, rows);
194
37
 
195
- // Don't send any more requests to the server.
196
- WebConsole.Terminal.prototype.disconnect = function(message) {
197
- this.disconnected = true;
198
- if (this.cursorX > 0) this.vt100('\r\n');
199
- this.vt100(message || 'Disconnected');
38
+ return [cols, rows];
200
39
  };
201
40
 
202
- }).call(this);
41
+ }).call(this, Terminal);