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

View File

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

View File

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