This commit is contained in:
yumoqing 2023-07-04 12:02:13 +08:00
parent 5e4a158f11
commit adc467d04a
4 changed files with 13 additions and 9 deletions

View File

@ -15,6 +15,9 @@ class AuthAPI(AppLogger):
super().__init__()
self.conf = getConfig()
async def checkUserPermission(self, user, path):
return True
def getPrivateKey(self):
if not hasattr(self,'rsaEngine'):
self.rsaEngine = RSA()
@ -64,10 +67,6 @@ class AuthAPI(AppLogger):
print(f'**{user=}, {path} forbidden**')
raise web.HTTPForbidden()
async def checkUserPermission(self, user, path):
raise Exception('checkUserPermission()')
return False
async def needAuth(self,path):
return False

View File

@ -58,6 +58,9 @@ class BaseProcessor(AppLogger):
}
self.content = ''
async def be_call(self, request, params={}):
return await self.path_call(request, params=params)
async def set_run_env(self, request):
if self.env_set:
return

View File

@ -116,7 +116,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
if request.query:
return multiDict2Dict(request.query)
ns = multiDict2Dict(md)
print(f'{ns=} reader is None, {request.query=}')
# print(f'{ns=} reader is None, {request.query=}')
return ns
ns = {}
while 1:
@ -147,7 +147,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
print('-----------except out ------------')
break;
# showcallstack()
print(f'getPostData():{ns=}')
# print(f'getPostData():{ns=}')
return ns
async def _handle(self,request:Request) -> StreamResponse:
@ -329,8 +329,8 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
def url2processor(self, request, url, fpath):
config = getConfig()
url = self.entireUrl(request, url)
host = '/'.join(str(request.url).split('/')[:3])
path = request.path
host = '/'.join(url.split('/')[:3])
path = '/' + '/'.join(url.split('/')[3:])
real_path = self.abspath(request, path)
if config.website.startswiths:
for a in config.website.startswiths:
@ -365,5 +365,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
url = self.entireUrl(request, path)
fpath = self.url2file(url)
processor = self.url2processor(request, url, fpath)
return await processor.path_call(request, params=params)
new_request = request.clone(rel_url=url)
# new_request.path = path
return await processor.be_call(new_request, params=params)

0
change.log Normal file → Executable file
View File