mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-07 03:11:15 +03:00
Various Tweaks (#22609)
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
* Mark items as reviewed as a group with keyboard * Improve handling of half model regions * update viewport meta tag to prevent user scaling fixes https://github.com/blakeblackshear/frigate/issues/22017 * add small animation to collapsible shadcn elements * add proxy auth env var tests * Improve search effect * Fix mobile back navigation losing overlay state on classification page * undo historyBack changes * fix classification history navigation --------- Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
This commit is contained in:
co-authored by
Josh Hawkins
parent
334245bd3c
commit
4b42039568
@@ -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}")
|
||||
|
||||
+9
-10
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user