From 0e02343da9437b6f6572459a604b45cbcef6c106 Mon Sep 17 00:00:00 2001 From: Giulio Date: Sun, 12 Dec 2021 15:50:58 +0100 Subject: [PATCH] better --- backend/__init__.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/backend/__init__.py b/backend/__init__.py index 47df408..20ee22e 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -15,22 +15,8 @@ import sys sys.setrecursionlimit(10**6) # this should prevents bots from stopping sio = socketio.Server(cors_allowed_origins="*") -if "UseRobots" in os.environ and os.environ['UseRobots'].upper() == "TRUE": - static_files={ - '/': {'content_type': 'text/html', 'filename': 'index.html'}, - '/game': {'content_type': 'text/html', 'filename': 'index.html'}, - '/help': {'content_type': 'text/html', 'filename': 'index.html'}, - '/status': {'content_type': 'text/html', 'filename': 'index.html'}, - '/robots.txt': {'content_type': 'text/html', 'filename': 'robots.txt'}, - '/favicon.ico': {'filename': 'favicon.ico'}, - '/img/icons': './img/icons', - '/manifest.json': {'filename': 'manifest.json'}, - '/css': './css', - '/media': './media', - '/js': './js', - } -else: - static_files={ + +static_files={ '/': {'content_type': 'text/html', 'filename': 'index.html'}, '/game': {'content_type': 'text/html', 'filename': 'index.html'}, '/help': {'content_type': 'text/html', 'filename': 'index.html'}, @@ -43,6 +29,8 @@ else: '/media': './media', '/js': './js', } +if "UseRobots" in os.environ and os.environ['UseRobots'].upper() == "TRUE": + static_files['/robots.txt'] = {'content_type': 'text/html', 'filename': 'robots.txt'} for file in [f for f in os.listdir('.') if '.js' in f or '.map' in f or '.html' in f]: static_files[f'/{file}'] = f'./{file}'