Separate basic endpoints
This commit is contained in:
1
core/scripts/webpanel/routers/basic/__init__.py
Normal file
1
core/scripts/webpanel/routers/basic/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from .basic import router
|
||||
16
core/scripts/webpanel/routers/basic/basic.py
Normal file
16
core/scripts/webpanel/routers/basic/basic.py
Normal file
@ -0,0 +1,16 @@
|
||||
from fastapi import APIRouter, Depends, Request
|
||||
from fastapi.templating import Jinja2Templates
|
||||
from fastapi.responses import PlainTextResponse
|
||||
from dependency import get_templates
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get('/')
|
||||
async def index(request: Request, templates: Jinja2Templates = Depends(get_templates)):
|
||||
return templates.TemplateResponse('index.html', {'request': request})
|
||||
|
||||
|
||||
@router.get('/robots.txt')
|
||||
async def robots_txt(request: Request):
|
||||
return PlainTextResponse('User-agent: *\nDisallow: /')
|
||||
Reference in New Issue
Block a user