From ad048806d313797e63a9e116bc3509807e969db8 Mon Sep 17 00:00:00 2001
From: yorffuoj <47420551+yorffuoj@users.noreply.github.com>
Date: Fri, 3 May 2024 23:22:50 +0200
Subject: [PATCH 1/2] Added a robot.txt that disallows indexing of the webiste
There is no interesting information to index in this website
---
yunodiagnoser.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/yunodiagnoser.py b/yunodiagnoser.py
index f9822d8..8f5f4ca 100644
--- a/yunodiagnoser.py
+++ b/yunodiagnoser.py
@@ -7,7 +7,7 @@ import socket
from sanic import Sanic
from sanic.log import logger
-from sanic.response import html, json as json_response
+from sanic.response import html, raw, json as json_response
from sanic.exceptions import InvalidUsage
app = Sanic(__name__)
@@ -389,6 +389,11 @@ async def check_smtp(request):
return json_response({'status': 'ok', 'helo': helo_domain})
+@app.route("/robots.txt")
+async def robots(request):
+ return raw("User-agent: *\nDisallow: /")
+
+
@app.route("/")
async def main(request):
return html("You aren't really supposed to use this website using your browser.
It's a small server with an API to check if a services running on YunoHost instance can be reached from 'the global internet'.")
From d39de7c86d9b1d101f59e409c2c3dad665a42d6b Mon Sep 17 00:00:00 2001
From: yorffuoj <47420551+yorffuoj@users.noreply.github.com>
Date: Sat, 4 May 2024 00:27:08 +0200
Subject: [PATCH 2/2] \n is not interpreteed in raw
---
yunodiagnoser.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/yunodiagnoser.py b/yunodiagnoser.py
index 8f5f4ca..e883fcb 100644
--- a/yunodiagnoser.py
+++ b/yunodiagnoser.py
@@ -391,7 +391,12 @@ async def check_smtp(request):
@app.route("/robots.txt")
async def robots(request):
- return raw("User-agent: *\nDisallow: /")
+ return raw(
+ """
+ User-agent: *
+ Disallow: /
+ """
+ )
@app.route("/")