From 994d34c776a486c69acf8451bef21a8acdfe1512 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Fri, 8 Mar 2024 13:30:31 +0100 Subject: [PATCH] Adding CORS module - Solves Chrome extension API connectivity (#2236) --- changedetectionio/flask_app.py | 4 ++++ requirements.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/changedetectionio/flask_app.py b/changedetectionio/flask_app.py index 9a54a33d..550a57e7 100644 --- a/changedetectionio/flask_app.py +++ b/changedetectionio/flask_app.py @@ -30,6 +30,7 @@ from flask_compress import Compress as FlaskCompress from flask_login import current_user from flask_paginate import Pagination, get_page_parameter from flask_restful import abort, Api +from flask_cors import CORS from flask_wtf import CSRFProtect from loguru import logger @@ -53,6 +54,9 @@ app = Flask(__name__, static_folder="static", template_folder="templates") +# Enable CORS, especially useful for the Chrome extension to operate from anywhere +CORS(app) + # Super handy for compressing large BrowserSteps responses and others FlaskCompress(app) diff --git a/requirements.txt b/requirements.txt index 79c63b63..e5177c9d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,6 +9,7 @@ flask-login>=0.6.3 flask-paginate flask_expects_json~=1.7 flask_restful +flask_cors # For the Chrome extension to operate flask_wtf~=1.2 flask~=2.3 inscriptis~=2.2