From 9e3708f500c8d23397a7b750fadc89e1e205b7fc Mon Sep 17 00:00:00 2001 From: Santiago Grossi Date: Thu, 1 Aug 2024 03:58:05 -0300 Subject: [PATCH] sr test --- docker-compose.yml | 2 +- docker/main/requirements-wheels.txt | 1 + frigate/api/app.py | 10 +++------- frigate/api/media.py | 1 + frigate/test/test_config.py | 10 ++++------ 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a4d349194..b76f40e70 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,7 +26,7 @@ services: YOLO_MODELS: yolov7-320 devices: - /dev/bus/usb:/dev/bus/usb - # - /dev/dri:/dev/dri # for intel hwaccel, needs to be updated for your hardware + #- /dev/dri:/dev/dri # for intel hwaccel, needs to be updated for your hardware volumes: - .:/workspace/frigate:cached - ./web/dist:/opt/frigate/web:cached diff --git a/docker/main/requirements-wheels.txt b/docker/main/requirements-wheels.txt index 84c5a867c..7e3574616 100644 --- a/docker/main/requirements-wheels.txt +++ b/docker/main/requirements-wheels.txt @@ -30,3 +30,4 @@ ws4py == 0.5.* unidecode == 1.3.* onnxruntime == 1.18.* openvino == 2024.1.* +flask-cors == 1.10.* \ No newline at end of file diff --git a/frigate/api/app.py b/frigate/api/app.py index 139b10d5b..4c34a924c 100644 --- a/frigate/api/app.py +++ b/frigate/api/app.py @@ -36,6 +36,8 @@ from frigate.util.builtin import ( ) from frigate.util.services import ffprobe_stream, restart_frigate, vainfo_hwaccel from frigate.version import VERSION +from flask_cors import CORS, cross_origin +from flask_cors import CORS, cross_origin logger = logging.getLogger(__name__) @@ -60,13 +62,7 @@ def create_app( stats_emitter: StatsEmitter, ): app = Flask(__name__) - - @app.before_request - def check_csrf(): - if request.method in ["GET", "HEAD", "OPTIONS", "TRACE"]: - pass - if "origin" in request.headers and "x-csrf-token" not in request.headers: - return jsonify({"success": False, "message": "Missing CSRF header"}), 401 + CORS(app) @app.before_request def _db_connect(): diff --git a/frigate/api/media.py b/frigate/api/media.py index 98bb2f952..2e4851242 100644 --- a/frigate/api/media.py +++ b/frigate/api/media.py @@ -548,6 +548,7 @@ def vod_ts(camera_name, start_ts, end_ts): if 0 < duration < max_duration_ms: clip["keyFrameDurations"] = [duration] + clip["id"] = "san" clips.append(clip) durations.append(duration) else: diff --git a/frigate/test/test_config.py b/frigate/test/test_config.py index f5592be19..e45617a1f 100644 --- a/frigate/test/test_config.py +++ b/frigate/test/test_config.py @@ -21,14 +21,12 @@ class TestConfig(unittest.TestCase): "back": { "ffmpeg": { "inputs": [ - {"path": "rtsp://10.0.0.1:554/video", "roles": ["detect"]} + { + "path": "rtsp://admin:12publico34@elpinarfutbol.ddns.net:554/cam/realmonitor?channel=1&subtype=0", + "roles": ["record"], + } ] }, - "detect": { - "height": 1080, - "width": 1920, - "fps": 5, - }, } }, }