enh(): Adds configurable CORS #14

Merged
elia merged 1 commit from cors into main 2024-12-24 00:39:08 +00:00
2 changed files with 4 additions and 1 deletions
Showing only changes of commit 35c8dfd21a - Show all commits

View file

@ -1,6 +1,7 @@
Server:
host: 127.0.0.1
port: 8000
cors: False
Web:
host: 127.0.0.1

View file

@ -23,7 +23,9 @@ class Web:
def init(self):
self.app = Flask(__name__)
self.setup_routes()
CORS(self.app)
if server_config and server_config.get("cors", False):
self.logger.debug("Enabling CORS...")
CORS(self.app)
def setup_routes(self):
self.app.add_url_rule("/", "/", self.handler.index, methods=["GET"])