--
This commit is contained in:
@@ -94,13 +94,14 @@ async def fake_error_page(request: Request, code: str):
|
|||||||
|
|
||||||
@app.api_route("/{full_path:path}", methods=["GET", "POST", "HEAD"])
|
@app.api_route("/{full_path:path}", methods=["GET", "POST", "HEAD"])
|
||||||
async def default_response(request: Request, full_path: str) -> Response:
|
async def default_response(request: Request, full_path: str) -> Response:
|
||||||
if not full_path.endswith(".html"):
|
if not full_path.endswith(".html") or not full_path.endswith(".md"):
|
||||||
try:
|
try:
|
||||||
if static := resolve_static_file(full_path):
|
if static := resolve_static_file(full_path):
|
||||||
return FileResponse(static)
|
return FileResponse(static)
|
||||||
except PermissionError:
|
except PermissionError:
|
||||||
return error_page(templates, request, 403, "何をしてるんです?脆弱性報告のためならいいのですが、データ盗んで悪用するためなら今すぐにやめてくださいね?", "ディレクトリトラバーサルね、知ってる。公開してないところ覗きたいの?えっt")
|
return error_page(templates, request, 403, "何をしてるんです?脆弱性報告のためならいいのですが、データ盗んで悪用するためなら今すぐにやめてくださいね?", "ディレクトリトラバーサルね、知ってる。公開してないところ覗きたいの?えっt")
|
||||||
|
|
||||||
|
markdown_mode = False
|
||||||
if "curl" in request.headers.get("user-agent", "").lower():
|
if "curl" in request.headers.get("user-agent", "").lower():
|
||||||
markdown_mode = True
|
markdown_mode = True
|
||||||
elif full_path.endswith(".md"):
|
elif full_path.endswith(".md"):
|
||||||
|
|||||||
Reference in New Issue
Block a user