bugfix
This commit is contained in:
parent
d60505e355
commit
cc76182a35
@ -19,9 +19,15 @@ class XtermProcessor(PythonScriptProcessor):
|
|||||||
async def ws_2_process(self, ws):
|
async def ws_2_process(self, ws):
|
||||||
async for msg in ws:
|
async for msg in ws:
|
||||||
if msg.type == aiohttp.WSMsgType.TEXT:
|
if msg.type == aiohttp.WSMsgType.TEXT:
|
||||||
if msg.data == '_#_heartbeat_#_':
|
resize_pattern = '_#_resize_#_'
|
||||||
await ws_send(ws, '_#_heartbeat_#_')
|
heartbeat_pattern = '_#_heartbeat_#_'
|
||||||
else:
|
if msg.data.startswith(resize_pattern):
|
||||||
|
row, col = [ int(i) for i in msg.data[len(resize_pattern):].split(',')]
|
||||||
|
await self.p_obj.set_terminal_size(row, col)
|
||||||
|
continue
|
||||||
|
if msg.data == heartbeat_pattern:
|
||||||
|
await ws_send(ws, heartbeat_pattern)
|
||||||
|
continue
|
||||||
self.p_obj.stdin.write(msg.data)
|
self.p_obj.stdin.write(msg.data)
|
||||||
elif msg.type == aiohttp.WSMsgType.ERROR:
|
elif msg.type == aiohttp.WSMsgType.ERROR:
|
||||||
# print('ws connection closed with exception %s' % ws.exception())
|
# print('ws connection closed with exception %s' % ws.exception())
|
||||||
@ -61,6 +67,7 @@ class XtermProcessor(PythonScriptProcessor):
|
|||||||
# id = lenv['params_kw'].get('termid')
|
# id = lenv['params_kw'].get('termid')
|
||||||
host = login_info['host']
|
host = login_info['host']
|
||||||
port = login_info.get('port', 22)
|
port = login_info.get('port', 22)
|
||||||
|
commandline = login_info.get('commandline', 'bash')
|
||||||
username = login_info.get('username', 'root')
|
username = login_info.get('username', 'root')
|
||||||
password = login_info.get('password',None)
|
password = login_info.get('password',None)
|
||||||
jumpers = login_info.get('jumpers', [])
|
jumpers = login_info.get('jumpers', [])
|
||||||
@ -69,9 +76,9 @@ class XtermProcessor(PythonScriptProcessor):
|
|||||||
port=port,
|
port=port,
|
||||||
jumpers=jumpers)
|
jumpers=jumpers)
|
||||||
await self.sshnode.connect()
|
await self.sshnode.connect()
|
||||||
self.p_obj = await self.sshnode._process('bash',
|
self.p_obj = await self.sshnode._process(commandline,
|
||||||
term_type='vt100',
|
term_type='xterm-256color',
|
||||||
term_size=(80, 24),
|
term_size=(24, 80),
|
||||||
encoding='utf-8')
|
encoding='utf-8')
|
||||||
self.running = True
|
self.running = True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user