This commit is contained in:
yumoqing 2023-12-18 18:54:15 +08:00
parent 3382ffb1ba
commit ab9e41bb69
4 changed files with 18 additions and 18 deletions

View File

@ -64,7 +64,7 @@ class AuthAPI(AppLogger):
self.conf = getConfig()
async def checkUserPermission(self, user, path):
print('************* checkUserPermission() use default one ****************')
# print('************* checkUserPermission() use default one ****************')
return True
def getPrivateKey(self):
@ -105,7 +105,7 @@ class AuthAPI(AppLogger):
client_uuid = request.headers.get('client_uuid')
ip = self._get_ip(request)
valid_until = int(time.time()) + self._max_age
print(f'hack: my _new_ticket() called ...remote {ip=}, {client_uuid=}')
# print(f'hack: my _new_ticket() called ...remote {ip=}, {client_uuid=}')
return self._ticket.new(user_id,
valid_until=valid_until,
client_ip=ip,

View File

@ -12,7 +12,7 @@ def load_plugins(p_dir):
ef = ExecFile()
pdir = os.path.join(p_dir, 'plugins')
if not os.path.isdir(pdir):
print('load_plugins:%s not exists' % pdir)
# print('load_plugins:%s not exists' % pdir)
return
sys.path.append(pdir)
ef.set('sys',sys)
@ -22,8 +22,8 @@ def load_plugins(p_dir):
continue
if not m.endswith('.py'):
continue
print(f'{m=}')
# print(f'{m=}')
module = os.path.basename(m[:-3])
print('module=', module)
# print('module=', module)
__import__(module, locals(), globals())

View File

@ -51,11 +51,11 @@ class Url2File:
return real_path
if not os.path.isdir(os.path.dirname(real_path)):
print(f'url2file() return None, {real_path=}, {url=},{ourl=}, {self.path=}')
# print(f'url2file() return None, {real_path=}, {url=},{ourl=}, {self.path=}')
return None
if not self.inherit:
print(f'url2file() return None, self.inherit is false, {url:}, {self.path=}')
# print(f'url2file() return None, self.inherit is false, {url:}, {self.path=}')
return None
items = url.split('/')
@ -65,7 +65,7 @@ class Url2File:
url = '/'.join(items)
# print(f'{oldurl=}, {url=}')
return self.url2file(url)
print(f'url2file() return None finally, {items:}, {url=}, {ourl=}, {self.path=}')
# print(f'url2file() return None finally, {items:}, {url=}, {ourl=}, {self.path=}')
return None
def relatedurl(self,url: str, name: str) -> str:

View File

@ -18,7 +18,7 @@ class XtermProcessor(BaseProcessor):
if msg.type == aiohttp.WSMsgType.TEXT:
self.p_obj.stdin.write(msg.data)
elif msg.type == aiohttp.WSMsgType.ERROR:
print('ws connection closed with exception %s' % ws.exception())
# print('ws connection closed with exception %s' % ws.exception())
return
async def process_2_ws(self, ws):
@ -48,7 +48,7 @@ class XtermProcessor(BaseProcessor):
async with aiofiles.open(self.real_path, 'r', encoding='utf-8') as f:
txt = await f.read()
self.login_info = json.loads(txt)
print(f'{self.login_info=}')
# print(f'{self.login_info=}')
async def create_process(self):
# id = lenv['params_kw'].get('termid')
@ -91,32 +91,32 @@ class WebsocketProcessor(PythonScriptProcessor):
await ws.send_str(json.dumps(data))
async def path_call(self, request,params={}):
print('1----------------------------------')
# print('1----------------------------------')
await self.set_run_env(request)
lenv = self.run_ns.copy()
lenv.update(params)
del lenv['request']
print('2----------------------------------')
# print('2----------------------------------')
txt = self.loadScript(self.real_path)
exec(txt,lenv,lenv)
func = lenv['myfunc']
print('3----------------------------------')
# print('3----------------------------------')
ws = web.WebSocketResponse()
await ws.prepare(request)
print('4----------------------------------', aiohttp.WSMsgType.TEXT)
# print('4----------------------------------', aiohttp.WSMsgType.TEXT)
await self.ws_sendstr(ws, 'Welcome to websock')
async for msg in ws:
if msg.type == aiohttp.WSMsgType.TEXT:
print('msg=:', msg)
# print('msg=:', msg)
lenv['ws_data'] = msg.data
# resp = await func(request,**lenv)
await self.ws_sendstr(ws, msg.data)
print('msg.data=', msg.data)
# print('msg.data=', msg.data)
elif msg.type == aiohttp.WSMsgType.ERROR:
print('ws connection closed with exception %s' % ws.exception())
# print('ws connection closed with exception %s' % ws.exception())
else:
print('datatype error', msg.type)
print('5----------------------------------')
# print('5----------------------------------')
self.retResponse = ws
await ws.close()
return ws