mirror of https://github.com/jumpserver/jumpserver
Merge pull request #139 from jumpserver/issue_52_bugfix
Issue 52 bugfix: 修复录像播放,web terminal hang住bugpull/140/head
commit
fcb3fd7186
|
@ -14,4 +14,4 @@ ansible==1.9.4
|
|||
pyinotify==0.9.6
|
||||
passlib==1.6.5
|
||||
argparse==1.4.0
|
||||
django_crontab==0.6.0
|
||||
django_crontab==0.6.0
|
||||
|
|
|
@ -10,7 +10,6 @@ import os.path
|
|||
import threading
|
||||
import re
|
||||
import functools
|
||||
|
||||
from django.core.signals import request_started, request_finished
|
||||
|
||||
import tornado.ioloop
|
||||
|
@ -371,9 +370,10 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
|
|||
vim_data = self.term.deal_command(self.term.vim_data)[0:200]
|
||||
if len(data) > 0:
|
||||
TtyLog(log=self.log, datetime=datetime.datetime.now(), cmd=vim_data).save()
|
||||
|
||||
TtyLog(log=self.log, datetime=datetime.datetime.now(),
|
||||
cmd=self.term.deal_command(self.term.data)[0:200]).save()
|
||||
vim_data = self.term.deal_command(self.term.vim_data)[0:200]
|
||||
if len(vim_data) > 0:
|
||||
TtyLog(log=self.log, datetime=datetime.datetime.now(),
|
||||
cmd=vim_data).save()
|
||||
self.term.vim_data = ''
|
||||
self.term.data = ''
|
||||
self.term.input_mode = False
|
||||
|
@ -412,7 +412,7 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
|
|||
if self.term.vim_flag:
|
||||
self.term.vim_data += recv
|
||||
try:
|
||||
self.write_message(json.dumps({'data': data}))
|
||||
self.write_message(data.decode('utf-8', 'replace'))
|
||||
now_timestamp = time.time()
|
||||
self.log_time_f.write('%s %s\n' % (round(now_timestamp-pre_timestamp, 4), len(data)))
|
||||
self.log_file_f.write(data)
|
||||
|
@ -460,7 +460,7 @@ def main():
|
|||
}
|
||||
tornado_app = tornado.web.Application(
|
||||
[
|
||||
(r'/monitor', MonitorHandler),
|
||||
(r'/ws/monitor', MonitorHandler),
|
||||
(r'/ws/terminal', WebTerminalHandler),
|
||||
(r'/kill', WebTerminalKillHandler),
|
||||
(r'/ws/exec', ExecHandler),
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/**
|
||||
* Created by liuzheng on 3/3/16.
|
||||
*/
|
||||
|
@ -35,13 +36,12 @@ WSSHClient.prototype.connect = function (options) {
|
|||
};
|
||||
|
||||
this._connection.onmessage = function (evt) {
|
||||
var data = JSON.parse(evt.data.toString());
|
||||
if (data.error !== undefined) {
|
||||
try{
|
||||
options.onData(evt.data);
|
||||
} catch (e) {
|
||||
var data = JSON.parse(evt.data.toString());
|
||||
options.onError(data.error);
|
||||
}
|
||||
else {
|
||||
options.onData(data.data);
|
||||
}
|
||||
};
|
||||
|
||||
this._connection.onclose = function (evt) {
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
var protocol = 'ws://';
|
||||
}
|
||||
|
||||
var endpoint = protocol + document.URL.match(RegExp('//(.*?)/'))[1] + '/monitor';
|
||||
var endpoint = protocol + document.URL.match(RegExp('//(.*?)/'))[1] + '/ws/monitor';
|
||||
var file_path = obj.attr('file_path');
|
||||
var socket = new WebSocket(endpoint + '?file_path=' + file_path);
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue