Skip to content

Commit

Permalink
feat: Disallow all web crawlers (#111)
Browse files Browse the repository at this point in the history
* feat: Disallow all web crawlers

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
oSumAtrIX and pre-commit-ci[bot] authored Oct 20, 2023
1 parent d61ddcc commit b69acfa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 11 additions & 1 deletion api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@
from api.donations import donations
from api.announcements import announcements
from api.login import login
from api.robots import robots

api = Blueprint.group(
login, ping, github, info, socials, donations, announcements, compat, url_prefix="/"
login,
ping,
github,
info,
socials,
donations,
announcements,
compat,
robots,
url_prefix="/",
)
10 changes: 10 additions & 0 deletions api/robots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from sanic import Blueprint
from sanic.response import text


robots: Blueprint = Blueprint("robots")


@robots.get("/robots.txt")
async def robots_txt(request):
return text("User-agent: *\nDisallow: /", content_type="text/plain")

Check warning on line 10 in api/robots.py

View check run for this annotation

Codecov / codecov/patch

api/robots.py#L10

Added line #L10 was not covered by tests

0 comments on commit b69acfa

Please sign in to comment.