From 9c32404e91b028bbcb37243ba1ce249db428b00c Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Sat, 20 May 2023 09:18:37 -0600 Subject: [PATCH] Add dir to nginx --- docker/rootfs/usr/local/nginx/conf/nginx.conf | 21 +++++++++++++++++++ frigate/record/export.py | 2 -- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docker/rootfs/usr/local/nginx/conf/nginx.conf b/docker/rootfs/usr/local/nginx/conf/nginx.conf index a6b50e317..35703fb2c 100644 --- a/docker/rootfs/usr/local/nginx/conf/nginx.conf +++ b/docker/rootfs/usr/local/nginx/conf/nginx.conf @@ -172,6 +172,27 @@ http { root /media/frigate; } + location /exports/ { + add_header 'Access-Control-Allow-Origin' "$http_origin" always; + add_header 'Access-Control-Allow-Credentials' 'true'; + add_header 'Access-Control-Expose-Headers' 'Content-Length'; + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' "$http_origin"; + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain charset=UTF-8'; + add_header 'Content-Length' 0; + return 204; + } + + types { + video/mp4 mp4; + } + + autoindex on; + autoindex_format json; + root /media/frigate; + } + location /ws { proxy_pass http://mqtt_ws/; proxy_http_version 1.1; diff --git a/frigate/record/export.py b/frigate/record/export.py index 6713de55a..ea93e9965 100644 --- a/frigate/record/export.py +++ b/frigate/record/export.py @@ -88,8 +88,6 @@ class RecordingExporter(threading.Thread): p = sp.run( ffmpeg_cmd, input="\n".join(playlist_lines) - if len(playlist_lines) > 1 - else playlist_lines, encoding="ascii", capture_output=True, )