mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-11-21 16:26:21 +03:00
change condition statuscode
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
This commit is contained in:
parent
c3918c3d35
commit
c801396953
1 changed files with 4 additions and 5 deletions
|
@ -16,9 +16,8 @@ async def today_wallpaper(request: Request):
|
||||||
date = datetime.today().strftime('%Y-%m-%d')
|
date = datetime.today().strftime('%Y-%m-%d')
|
||||||
res = requests.get(f'https://api.starlio.space/last')
|
res = requests.get(f'https://api.starlio.space/last')
|
||||||
|
|
||||||
if not HTTPStatus(res.status_code).is_redirection or \
|
if HTTPStatus(res.status_code).is_server_error or \
|
||||||
not HTTPStatus(res.status_code).is_success:
|
HTTPStatus(res.status_code).is_client_error:
|
||||||
|
|
||||||
return FileResponse('./src/web/html/error/404.html')
|
return FileResponse('./src/web/html/error/404.html')
|
||||||
|
|
||||||
return RedirectResponse(f'/wallpaper/{date}')
|
return RedirectResponse(f'/wallpaper/{date}')
|
||||||
|
@ -28,8 +27,8 @@ async def today_wallpaper(request: Request):
|
||||||
async def wallpaper(request: Request, day):
|
async def wallpaper(request: Request, day):
|
||||||
res = requests.get(f'https://api.starlio.space/wallpaper/{day}')
|
res = requests.get(f'https://api.starlio.space/wallpaper/{day}')
|
||||||
|
|
||||||
if not HTTPStatus(res.status_code).is_redirection or \
|
if HTTPStatus(res.status_code).is_server_error or \
|
||||||
not HTTPStatus(res.status_code).is_success:
|
HTTPStatus(res.status_code).is_client_error:
|
||||||
return FileResponse('./src/web/html/error/404.html')
|
return FileResponse('./src/web/html/error/404.html')
|
||||||
|
|
||||||
return template.TemplateResponse(
|
return template.TemplateResponse(
|
||||||
|
|
Loading…
Add table
Reference in a new issue