bugfix
This commit is contained in:
parent
4e66ec52c3
commit
2a8d945470
@ -18,6 +18,7 @@ from appPublic.dictObject import DictObject
|
|||||||
from appPublic.Singleton import GlobalEnv
|
from appPublic.Singleton import GlobalEnv
|
||||||
from appPublic.argsConvert import ArgsConvert
|
from appPublic.argsConvert import ArgsConvert
|
||||||
from appPublic.timeUtils import str2Date,str2Datetime,curDatetime,getCurrentTimeStamp,curDateString, curTimeString
|
from appPublic.timeUtils import str2Date,str2Datetime,curDatetime,getCurrentTimeStamp,curDateString, curTimeString
|
||||||
|
from appPublic.dataencoder import quotedstr
|
||||||
from appPublic.folderUtils import folderInfo
|
from appPublic.folderUtils import folderInfo
|
||||||
from appPublic.uniqueID import setNode,getID
|
from appPublic.uniqueID import setNode,getID
|
||||||
from appPublic.unicoding import unicoding,uDict,uObject
|
from appPublic.unicoding import unicoding,uDict,uObject
|
||||||
@ -191,6 +192,7 @@ def initEnv():
|
|||||||
g.get_definition = get_definition
|
g.get_definition = get_definition
|
||||||
g.DictObject = DictObject
|
g.DictObject = DictObject
|
||||||
g.async_sleep = asyncio.sleep
|
g.async_sleep = asyncio.sleep
|
||||||
|
g.quotedstr = quotedstr
|
||||||
|
|
||||||
def set_builtins():
|
def set_builtins():
|
||||||
all_builtins = [ i for i in dir(builtins) if not i.startswith('_')]
|
all_builtins = [ i for i in dir(builtins) if not i.startswith('_')]
|
||||||
|
@ -9,7 +9,7 @@ from traceback import print_exc
|
|||||||
from appPublic.sshx import SSHNode
|
from appPublic.sshx import SSHNode
|
||||||
from .baseProcessor import BaseProcessor, PythonScriptProcessor
|
from .baseProcessor import BaseProcessor, PythonScriptProcessor
|
||||||
|
|
||||||
class XtermProcessor(BaseProcessor):
|
class XtermProcessor(PythonScriptProcessor):
|
||||||
@classmethod
|
@classmethod
|
||||||
def isMe(self,name):
|
def isMe(self,name):
|
||||||
return name=='xterm'
|
return name=='xterm'
|
||||||
@ -31,13 +31,15 @@ class XtermProcessor(BaseProcessor):
|
|||||||
await self.path_call(request)
|
await self.path_call(request)
|
||||||
|
|
||||||
async def path_call(self, request, params={}):
|
async def path_call(self, request, params={}):
|
||||||
await self.set_run_env(request)
|
#
|
||||||
lenv = self.run_ns.copy()
|
# xterm file is a python script as dspy file
|
||||||
lenv.update(params)
|
# it must return a DictObject with sshnode information
|
||||||
del lenv['request']
|
# parameters: nodeid
|
||||||
|
#
|
||||||
|
login_info = super().path_call(request, params=params)
|
||||||
ws = web.WebSocketResponse()
|
ws = web.WebSocketResponse()
|
||||||
await ws.prepare(request)
|
await ws.prepare(request)
|
||||||
await self.create_process()
|
await self.create_process(login_info)
|
||||||
self.ws_sendstr(ws, 'Welcom to sshclient')
|
self.ws_sendstr(ws, 'Welcom to sshclient')
|
||||||
r1 = self.ws_2_process(ws)
|
r1 = self.ws_2_process(ws)
|
||||||
r2 = self.process_2_ws(ws)
|
r2 = self.process_2_ws(ws)
|
||||||
@ -51,9 +53,8 @@ class XtermProcessor(BaseProcessor):
|
|||||||
self.login_info = json.loads(txt)
|
self.login_info = json.loads(txt)
|
||||||
# print(f'{self.login_info=}')
|
# print(f'{self.login_info=}')
|
||||||
|
|
||||||
async def create_process(self):
|
async def create_process(self, lgoin_info):
|
||||||
# id = lenv['params_kw'].get('termid')
|
# id = lenv['params_kw'].get('termid')
|
||||||
await self.get_login_info()
|
|
||||||
host = self.login_info['host']
|
host = self.login_info['host']
|
||||||
port = self.login_info.get('port', 22)
|
port = self.login_info.get('port', 22)
|
||||||
username = self.login_info.get('username', 'root')
|
username = self.login_info.get('username', 'root')
|
||||||
|
Loading…
Reference in New Issue
Block a user