diff --git a/jlog/views.py b/jlog/views.py index 41da9fe83..69716bda2 100644 --- a/jlog/views.py +++ b/jlog/views.py @@ -183,7 +183,7 @@ class TermLogRecorder(object): self.user = None self.recoderStartTime = time.time() self.__init_screen_stream() - self.recoder = True + self.recoder = False self.commands = [] self._lists = None self.file = None diff --git a/run_server.py b/run_server.py index 1f2a191da..e19bc1df2 100755 --- a/run_server.py +++ b/run_server.py @@ -35,10 +35,12 @@ except ImportError: os.environ['DJANGO_SETTINGS_MODULE'] = 'jumpserver.settings' from jumpserver.settings import IP, PORT + define("port", default=PORT, help="run on the given port", type=int) define("host", default=IP, help="run port on given host", type=str) from jlog.views import TermLogRecorder + def django_request_support(func): @functools.wraps(func) def _deco(*args, **kwargs): @@ -46,6 +48,7 @@ def django_request_support(func): response = func(*args, **kwargs) request_finished.send_robust(func) return response + return _deco @@ -83,6 +86,7 @@ def require_auth(role='user'): logger.warning('Websocket: Request auth failed.') return _deco2 + return _deco @@ -340,6 +344,7 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler): self.term.remote_ip = self.request.remote_ip self.ssh = self.term.get_connection() self.channel = self.ssh.invoke_shell(term='xterm') + self.channel.resize_pty(80, 24) WebTerminalHandler.tasks.append(MyThread(target=self.forward_outbound)) WebTerminalHandler.clients.append(self) @@ -421,7 +426,7 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler): self.termlog.write(data) self.termlog.recoder = False now_timestamp = time.time() - self.log_time_f.write('%s %s\n' % (round(now_timestamp-pre_timestamp, 4), len(data))) + self.log_time_f.write('%s %s\n' % (round(now_timestamp - pre_timestamp, 4), len(data))) self.log_file_f.write(data) pre_timestamp = now_timestamp self.log_file_f.flush() @@ -481,6 +486,7 @@ def main(): tornado.ioloop.IOLoop.instance().start() + if __name__ == '__main__': # tornado.options.parse_command_line() # app = Application() diff --git a/static/js/webterminal.js b/static/js/webterminal.js index e5ea997f2..50e21276f 100644 --- a/static/js/webterminal.js +++ b/static/js/webterminal.js @@ -104,13 +104,13 @@ $(document).ready(function () { $('#ssh').show(); var term_client = openTerminal(options); console.log(rowHeight); - - window.onresize = function () { - var geom = resize(); - console.log(geom); - term_client.term.resize(geom.cols, geom.rows); - term_client.client.send({'resize': {'rows': geom.rows, 'cols': geom.cols}}); - $('#ssh').show(); - } + // by liuzheng712 because it will bring record bug + //window.onresize = function () { + // var geom = resize(); + // console.log(geom); + // term_client.term.resize(geom.cols, geom.rows); + // term_client.client.send({'resize': {'rows': geom.rows, 'cols': geom.cols}}); + // $('#ssh').show(); + //} }); \ No newline at end of file