diff --git a/frigate/test/test_proxy_auth.py b/frigate/test/test_proxy_auth.py
index 2ffad957c..e4d2c9ce9 100644
--- a/frigate/test/test_proxy_auth.py
+++ b/frigate/test/test_proxy_auth.py
@@ -2,6 +2,7 @@ import unittest
from frigate.api.auth import resolve_role
from frigate.config import HeaderMappingConfig, ProxyConfig
+from frigate.config.env import FRIGATE_ENV_VARS
class TestProxyRoleResolution(unittest.TestCase):
@@ -91,3 +92,39 @@ class TestProxyRoleResolution(unittest.TestCase):
headers = {"x-remote-role": "group_unknown"}
role = resolve_role(headers, self.proxy_config, self.config_roles)
self.assertEqual(role, self.proxy_config.default_role)
+
+
+class TestProxyAuthSecretEnvString(unittest.TestCase):
+ def setUp(self):
+ self._original_env_vars = dict(FRIGATE_ENV_VARS)
+
+ def tearDown(self):
+ FRIGATE_ENV_VARS.clear()
+ FRIGATE_ENV_VARS.update(self._original_env_vars)
+
+ def test_auth_secret_env_substitution(self):
+ """auth_secret resolves FRIGATE_ env vars via EnvString."""
+ FRIGATE_ENV_VARS["FRIGATE_PROXY_SECRET"] = "my_secret_value"
+ config = ProxyConfig(auth_secret="{FRIGATE_PROXY_SECRET}")
+ self.assertEqual(config.auth_secret, "my_secret_value")
+
+ def test_auth_secret_env_embedded_in_string(self):
+ """auth_secret resolves env vars embedded in a larger string."""
+ FRIGATE_ENV_VARS["FRIGATE_SECRET_PART"] = "abc123"
+ config = ProxyConfig(auth_secret="prefix-{FRIGATE_SECRET_PART}-suffix")
+ self.assertEqual(config.auth_secret, "prefix-abc123-suffix")
+
+ def test_auth_secret_plain_string(self):
+ """auth_secret accepts a plain string without substitution."""
+ config = ProxyConfig(auth_secret="literal_secret")
+ self.assertEqual(config.auth_secret, "literal_secret")
+
+ def test_auth_secret_none(self):
+ """auth_secret defaults to None."""
+ config = ProxyConfig()
+ self.assertIsNone(config.auth_secret)
+
+ def test_auth_secret_unknown_var_raises(self):
+ """auth_secret raises KeyError for unknown env var references."""
+ with self.assertRaises(Exception):
+ ProxyConfig(auth_secret="{FRIGATE_NONEXISTENT_VAR}")
diff --git a/frigate/util/object.py b/frigate/util/object.py
index 021150132..7f38438f4 100644
--- a/frigate/util/object.py
+++ b/frigate/util/object.py
@@ -271,18 +271,17 @@ def get_min_region_size(model_config: ModelConfig) -> int:
"""Get the min region size."""
largest_dimension = max(model_config.height, model_config.width)
- if largest_dimension > 320:
- # We originally tested allowing any model to have a region down to half of the model size
- # but this led to many false positives. In this case we specifically target larger models
- # which can benefit from a smaller region in some cases to detect smaller objects.
- half = int(largest_dimension / 2)
+ # return largest dimension for smaller models, but make sure the dimension is normalized
+ if largest_dimension < 320:
+ if largest_dimension % 4 == 0:
+ return largest_dimension
- if half % 4 == 0:
- return half
+ return int((largest_dimension + 3) / 4) * 4
- return int((half + 3) / 4) * 4
-
- return largest_dimension
+ # Any model that is 320 or larger should have a minimum region size of 320
+ # this allows larger models to use smaller regions to detect smaller objects
+ # in the case that the motion area is smaller so that it can be upscaled.
+ return 320
def create_tensor_input(frame, model_config: ModelConfig, region):
diff --git a/web/index.html b/web/index.html
index 0805deca3..be6b302f5 100644
--- a/web/index.html
+++ b/web/index.html
@@ -3,7 +3,7 @@