From ccd3513c463a3174f3e8a3a51982806040a651ad Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Sat, 3 Apr 2021 14:00:05 +1300 Subject: [PATCH] Add robots.txt --- index.py | 7 ++++++- root/robots.txt | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 root/robots.txt diff --git a/index.py b/index.py index facee1a..2e8f098 100644 --- a/index.py +++ b/index.py @@ -1,5 +1,6 @@ import cherrypy import json +import pathlib import requests import youtube_dlc from extractors.video import extract_video @@ -129,10 +130,14 @@ class NewLeaf(object): bind_port = getattr(configuration, "bind_port", 3000) bind_host = getattr(configuration, "bind_host", "0.0.0.0") +server_root = pathlib.Path(__file__).parent.joinpath("root") cherrypy.config.update({"server.socket_port": bind_port, "server.socket_host": bind_host}) cherrypy.quickstart(NewLeaf(), "/", { "/": { - "tools.custom_headers.on": True + "tools.custom_headers.on": True, + "tools.staticdir.on": True, + "tools.staticdir.dir": str(server_root.absolute()), + "tools.staticdir.index": "index.html" } }) diff --git a/root/robots.txt b/root/robots.txt new file mode 100644 index 0000000..c6742d8 --- /dev/null +++ b/root/robots.txt @@ -0,0 +1,2 @@ +User-Agent: * +Disallow: /