mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-09 23:15:28 +03:00
Compare commits
No commits in common. "4b42039568169e0364422b9f7da6b4de0c0de19a" and "de593c8e3f2d97ab4dae6384d72498b81466ddb7" have entirely different histories.
4b42039568
...
de593c8e3f
@ -46,7 +46,6 @@ from frigate.record.export import (
|
|||||||
DEFAULT_TIME_LAPSE_FFMPEG_ARGS,
|
DEFAULT_TIME_LAPSE_FFMPEG_ARGS,
|
||||||
PlaybackSourceEnum,
|
PlaybackSourceEnum,
|
||||||
RecordingExporter,
|
RecordingExporter,
|
||||||
validate_ffmpeg_args,
|
|
||||||
)
|
)
|
||||||
from frigate.util.time import is_current_hour
|
from frigate.util.time import is_current_hour
|
||||||
|
|
||||||
@ -548,24 +547,6 @@ def export_recording_custom(
|
|||||||
|
|
||||||
export_id = f"{camera_name}_{''.join(random.choices(string.ascii_lowercase + string.digits, k=6))}"
|
export_id = f"{camera_name}_{''.join(random.choices(string.ascii_lowercase + string.digits, k=6))}"
|
||||||
|
|
||||||
# Validate user-provided ffmpeg args to prevent injection
|
|
||||||
for args_label, args_value in [
|
|
||||||
("input", ffmpeg_input_args),
|
|
||||||
("output", ffmpeg_output_args),
|
|
||||||
]:
|
|
||||||
if args_value is not None:
|
|
||||||
valid, message = validate_ffmpeg_args(args_value)
|
|
||||||
if not valid:
|
|
||||||
return JSONResponse(
|
|
||||||
content=(
|
|
||||||
{
|
|
||||||
"success": False,
|
|
||||||
"message": f"Invalid ffmpeg {args_label} arguments: {message}",
|
|
||||||
}
|
|
||||||
),
|
|
||||||
status_code=400,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Set default values if not provided (timelapse defaults)
|
# Set default values if not provided (timelapse defaults)
|
||||||
if ffmpeg_input_args is None:
|
if ffmpeg_input_args is None:
|
||||||
ffmpeg_input_args = ""
|
ffmpeg_input_args = ""
|
||||||
|
|||||||
@ -36,54 +36,6 @@ logger = logging.getLogger(__name__)
|
|||||||
DEFAULT_TIME_LAPSE_FFMPEG_ARGS = "-vf setpts=0.04*PTS -r 30"
|
DEFAULT_TIME_LAPSE_FFMPEG_ARGS = "-vf setpts=0.04*PTS -r 30"
|
||||||
TIMELAPSE_DATA_INPUT_ARGS = "-an -skip_frame nokey"
|
TIMELAPSE_DATA_INPUT_ARGS = "-an -skip_frame nokey"
|
||||||
|
|
||||||
# ffmpeg flags that can read from or write to arbitrary files
|
|
||||||
BLOCKED_FFMPEG_ARGS = frozenset(
|
|
||||||
{
|
|
||||||
"-i",
|
|
||||||
"-filter_script",
|
|
||||||
"-vstats_file",
|
|
||||||
"-passlogfile",
|
|
||||||
"-sdp_file",
|
|
||||||
"-dump_attachment",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def validate_ffmpeg_args(args: str) -> tuple[bool, str]:
|
|
||||||
"""Validate that user-provided ffmpeg args don't allow input/output injection.
|
|
||||||
|
|
||||||
Blocks:
|
|
||||||
- The -i flag and other flags that read/write arbitrary files
|
|
||||||
- Absolute/relative file paths (potential extra outputs)
|
|
||||||
- URLs and ffmpeg protocol references (data exfiltration)
|
|
||||||
"""
|
|
||||||
if not args or not args.strip():
|
|
||||||
return True, ""
|
|
||||||
|
|
||||||
tokens = args.split()
|
|
||||||
for token in tokens:
|
|
||||||
# Block flags that could inject inputs or write to arbitrary files
|
|
||||||
if token.lower() in BLOCKED_FFMPEG_ARGS:
|
|
||||||
return False, f"Forbidden ffmpeg argument: {token}"
|
|
||||||
|
|
||||||
# Block tokens that look like file paths (potential output injection)
|
|
||||||
if (
|
|
||||||
token.startswith("/")
|
|
||||||
or token.startswith("./")
|
|
||||||
or token.startswith("../")
|
|
||||||
or token.startswith("~")
|
|
||||||
):
|
|
||||||
return False, "File paths are not allowed in custom ffmpeg arguments"
|
|
||||||
|
|
||||||
# Block URLs and ffmpeg protocol references (e.g. http://, tcp://, pipe:, file:)
|
|
||||||
if "://" in token or token.startswith("pipe:") or token.startswith("file:"):
|
|
||||||
return (
|
|
||||||
False,
|
|
||||||
"Protocol references are not allowed in custom ffmpeg arguments",
|
|
||||||
)
|
|
||||||
|
|
||||||
return True, ""
|
|
||||||
|
|
||||||
|
|
||||||
def lower_priority():
|
def lower_priority():
|
||||||
os.nice(PROCESS_PRIORITY_LOW)
|
os.nice(PROCESS_PRIORITY_LOW)
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import unittest
|
|||||||
|
|
||||||
from frigate.api.auth import resolve_role
|
from frigate.api.auth import resolve_role
|
||||||
from frigate.config import HeaderMappingConfig, ProxyConfig
|
from frigate.config import HeaderMappingConfig, ProxyConfig
|
||||||
from frigate.config.env import FRIGATE_ENV_VARS
|
|
||||||
|
|
||||||
|
|
||||||
class TestProxyRoleResolution(unittest.TestCase):
|
class TestProxyRoleResolution(unittest.TestCase):
|
||||||
@ -92,39 +91,3 @@ class TestProxyRoleResolution(unittest.TestCase):
|
|||||||
headers = {"x-remote-role": "group_unknown"}
|
headers = {"x-remote-role": "group_unknown"}
|
||||||
role = resolve_role(headers, self.proxy_config, self.config_roles)
|
role = resolve_role(headers, self.proxy_config, self.config_roles)
|
||||||
self.assertEqual(role, self.proxy_config.default_role)
|
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}")
|
|
||||||
|
|||||||
@ -271,18 +271,19 @@ def get_min_region_size(model_config: ModelConfig) -> int:
|
|||||||
"""Get the min region size."""
|
"""Get the min region size."""
|
||||||
largest_dimension = max(model_config.height, model_config.width)
|
largest_dimension = max(model_config.height, model_config.width)
|
||||||
|
|
||||||
# return largest dimension for smaller models, but make sure the dimension is normalized
|
if largest_dimension > 320:
|
||||||
if largest_dimension < 320:
|
# We originally tested allowing any model to have a region down to half of the model size
|
||||||
if largest_dimension % 4 == 0:
|
# 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)
|
||||||
|
|
||||||
|
if half % 4 == 0:
|
||||||
|
return half
|
||||||
|
|
||||||
|
return int((half + 3) / 4) * 4
|
||||||
|
|
||||||
return largest_dimension
|
return largest_dimension
|
||||||
|
|
||||||
return int((largest_dimension + 3) / 4) * 4
|
|
||||||
|
|
||||||
# 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):
|
def create_tensor_input(frame, model_config: ModelConfig, region):
|
||||||
if model_config.input_pixel_format == PixelFormatEnum.rgb:
|
if model_config.input_pixel_format == PixelFormatEnum.rgb:
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="/images/branding/favicon.ico" />
|
<link rel="icon" href="/images/branding/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Frigate</title>
|
<title>Frigate</title>
|
||||||
<link
|
<link
|
||||||
rel="apple-touch-icon"
|
rel="apple-touch-icon"
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import {
|
|||||||
ClassificationThreshold,
|
ClassificationThreshold,
|
||||||
ClassifiedEvent,
|
ClassifiedEvent,
|
||||||
} from "@/types/classification";
|
} from "@/types/classification";
|
||||||
import { forwardRef, useEffect, useMemo, useRef, useState } from "react";
|
import { forwardRef, useMemo, useRef, useState } from "react";
|
||||||
import { isDesktop, isIOS, isMobile, isMobileOnly } from "react-device-detect";
|
import { isDesktop, isIOS, isMobile, isMobileOnly } from "react-device-detect";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import TimeAgo from "../dynamic/TimeAgo";
|
import TimeAgo from "../dynamic/TimeAgo";
|
||||||
@ -216,25 +216,6 @@ export function GroupedClassificationCard({
|
|||||||
const { t } = useTranslation(["views/explore", i18nLibrary]);
|
const { t } = useTranslation(["views/explore", i18nLibrary]);
|
||||||
const [detailOpen, setDetailOpen] = useState(false);
|
const [detailOpen, setDetailOpen] = useState(false);
|
||||||
|
|
||||||
// If the component unmounts while the detail overlay is open, we need to
|
|
||||||
// pop the history state that was pushed by useHistoryBack, otherwise it
|
|
||||||
// leaves a stale entry that breaks back navigation.
|
|
||||||
const detailOpenRef = useRef(detailOpen);
|
|
||||||
useEffect(() => {
|
|
||||||
detailOpenRef.current = detailOpen;
|
|
||||||
}, [detailOpen]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
return () => {
|
|
||||||
// Only pop the state if we are still sitting on the overlayOpen history entry.
|
|
||||||
// This prevents the unmount from undoing cross-page routing if the unmount
|
|
||||||
// was caused by navigating away to a different view.
|
|
||||||
if (detailOpenRef.current && window.history.state?.overlayOpen) {
|
|
||||||
window.history.back();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
// data
|
// data
|
||||||
|
|
||||||
const bestItem = useMemo<ClassificationItemData | undefined>(() => {
|
const bestItem = useMemo<ClassificationItemData | undefined>(() => {
|
||||||
|
|||||||
@ -1,28 +1,9 @@
|
|||||||
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
|
||||||
import * as React from "react";
|
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
const Collapsible = CollapsiblePrimitive.Root
|
||||||
|
|
||||||
const Collapsible = CollapsiblePrimitive.Root;
|
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
|
||||||
|
|
||||||
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
|
||||||
|
|
||||||
const CollapsibleContent = React.forwardRef<
|
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
||||||
React.ComponentRef<typeof CollapsiblePrimitive.CollapsibleContent>,
|
|
||||||
React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.CollapsibleContent>
|
|
||||||
>(({ className, children, ...props }, ref) => (
|
|
||||||
<CollapsiblePrimitive.CollapsibleContent
|
|
||||||
ref={ref}
|
|
||||||
className={cn(
|
|
||||||
"overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",
|
|
||||||
className,
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</CollapsiblePrimitive.CollapsibleContent>
|
|
||||||
));
|
|
||||||
CollapsibleContent.displayName =
|
|
||||||
CollapsiblePrimitive.CollapsibleContent.displayName;
|
|
||||||
|
|
||||||
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
||||||
|
|||||||
@ -1,11 +1,4 @@
|
|||||||
import {
|
import { useCallback, useContext, useEffect, useMemo, useRef } from "react";
|
||||||
useCallback,
|
|
||||||
useContext,
|
|
||||||
useEffect,
|
|
||||||
useMemo,
|
|
||||||
useRef,
|
|
||||||
useState,
|
|
||||||
} from "react";
|
|
||||||
import { useLocation, useNavigate, useSearchParams } from "react-router-dom";
|
import { useLocation, useNavigate, useSearchParams } from "react-router-dom";
|
||||||
import { usePersistence } from "./use-persistence";
|
import { usePersistence } from "./use-persistence";
|
||||||
import { useUserPersistence } from "./use-user-persistence";
|
import { useUserPersistence } from "./use-user-persistence";
|
||||||
@ -207,51 +200,36 @@ export function useSearchEffect(
|
|||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const [pendingRemoval, setPendingRemoval] = useState(false);
|
|
||||||
const processedRef = useRef<string | null>(null);
|
|
||||||
|
|
||||||
const currentParam = searchParams.get(key);
|
const param = useMemo(() => {
|
||||||
|
const param = searchParams.get(key);
|
||||||
|
|
||||||
|
if (!param) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [key, decodeURIComponent(param)];
|
||||||
|
}, [searchParams, key]);
|
||||||
|
|
||||||
// Process the param via callback (once per unique param value)
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (currentParam == null || currentParam === processedRef.current) {
|
if (!param) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const decoded = decodeURIComponent(currentParam);
|
const remove = callback(param[1]);
|
||||||
const shouldRemove = callback(decoded);
|
|
||||||
|
|
||||||
if (shouldRemove) {
|
if (remove) {
|
||||||
processedRef.current = currentParam;
|
|
||||||
setPendingRemoval(true);
|
|
||||||
}
|
|
||||||
}, [currentParam, callback, key]);
|
|
||||||
|
|
||||||
// Remove the search param in a separate render cycle so that any state
|
|
||||||
// changes from the callback (e.g., overlay state navigations) are already
|
|
||||||
// reflected in location.state before we navigate to strip the param.
|
|
||||||
useEffect(() => {
|
|
||||||
if (!pendingRemoval) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setPendingRemoval(false);
|
|
||||||
navigate(location.pathname + location.hash, {
|
navigate(location.pathname + location.hash, {
|
||||||
state: location.state,
|
state: location.state,
|
||||||
replace: true,
|
replace: true,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}, [
|
}, [
|
||||||
pendingRemoval,
|
param,
|
||||||
navigate,
|
location.state,
|
||||||
location.pathname,
|
location.pathname,
|
||||||
location.hash,
|
location.hash,
|
||||||
location.state,
|
callback,
|
||||||
|
navigate,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Reset tracking when param is removed from the URL
|
|
||||||
useEffect(() => {
|
|
||||||
if (currentParam == null) {
|
|
||||||
processedRef.current = null;
|
|
||||||
}
|
|
||||||
}, [currentParam]);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -409,11 +409,8 @@ export default function Events() {
|
|||||||
|
|
||||||
// review status
|
// review status
|
||||||
|
|
||||||
const markItemsAsReviewed = useCallback(
|
const markAllItemsAsReviewed = useCallback(
|
||||||
async (
|
async (currentItems: ReviewSegment[]) => {
|
||||||
currentItems: ReviewSegment[],
|
|
||||||
itemsToMarkReviewed: ReviewSegment[] | undefined = undefined,
|
|
||||||
) => {
|
|
||||||
if (currentItems.length == 0) {
|
if (currentItems.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -438,14 +435,13 @@ export default function Events() {
|
|||||||
{ revalidate: false, populateCache: true },
|
{ revalidate: false, populateCache: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
const reviewList =
|
const itemsToMarkReviewed = currentItems
|
||||||
itemsToMarkReviewed?.map((seg) => seg.id) ||
|
?.filter((seg) => seg.end_time)
|
||||||
currentItems?.filter((seg) => seg.end_time)?.map((seg) => seg.id) ||
|
?.map((seg) => seg.id);
|
||||||
[];
|
|
||||||
|
|
||||||
if (reviewList.length > 0) {
|
if (itemsToMarkReviewed.length > 0) {
|
||||||
await axios.post(`reviews/viewed`, {
|
await axios.post(`reviews/viewed`, {
|
||||||
ids: reviewList,
|
ids: itemsToMarkReviewed,
|
||||||
reviewed: true,
|
reviewed: true,
|
||||||
});
|
});
|
||||||
reloadData();
|
reloadData();
|
||||||
@ -615,7 +611,7 @@ export default function Events() {
|
|||||||
setShowReviewed={setShowReviewed}
|
setShowReviewed={setShowReviewed}
|
||||||
setSeverity={setSeverity}
|
setSeverity={setSeverity}
|
||||||
markItemAsReviewed={markItemAsReviewed}
|
markItemAsReviewed={markItemAsReviewed}
|
||||||
markItemsAsReviewed={markItemsAsReviewed}
|
markAllItemsAsReviewed={markAllItemsAsReviewed}
|
||||||
onOpenRecording={setRecording}
|
onOpenRecording={setRecording}
|
||||||
motionPreviewsCamera={motionPreviewsCamera ?? null}
|
motionPreviewsCamera={motionPreviewsCamera ?? null}
|
||||||
setMotionPreviewsCamera={(camera) =>
|
setMotionPreviewsCamera={(camera) =>
|
||||||
|
|||||||
@ -110,10 +110,7 @@ type EventViewProps = {
|
|||||||
setShowReviewed: (show: boolean) => void;
|
setShowReviewed: (show: boolean) => void;
|
||||||
setSeverity: (severity: ReviewSeverity) => void;
|
setSeverity: (severity: ReviewSeverity) => void;
|
||||||
markItemAsReviewed: (review: ReviewSegment) => void;
|
markItemAsReviewed: (review: ReviewSegment) => void;
|
||||||
markItemsAsReviewed: (
|
markAllItemsAsReviewed: (currentItems: ReviewSegment[]) => void;
|
||||||
currentItems: ReviewSegment[],
|
|
||||||
itemsToMarkReviewed?: ReviewSegment[] | undefined,
|
|
||||||
) => void;
|
|
||||||
onOpenRecording: (recordingInfo: RecordingStartingPoint) => void;
|
onOpenRecording: (recordingInfo: RecordingStartingPoint) => void;
|
||||||
motionPreviewsCamera: string | null;
|
motionPreviewsCamera: string | null;
|
||||||
setMotionPreviewsCamera: (camera: string | null) => void;
|
setMotionPreviewsCamera: (camera: string | null) => void;
|
||||||
@ -135,7 +132,7 @@ export default function EventView({
|
|||||||
setShowReviewed,
|
setShowReviewed,
|
||||||
setSeverity,
|
setSeverity,
|
||||||
markItemAsReviewed,
|
markItemAsReviewed,
|
||||||
markItemsAsReviewed,
|
markAllItemsAsReviewed,
|
||||||
onOpenRecording,
|
onOpenRecording,
|
||||||
motionPreviewsCamera,
|
motionPreviewsCamera,
|
||||||
setMotionPreviewsCamera,
|
setMotionPreviewsCamera,
|
||||||
@ -501,7 +498,7 @@ export default function EventView({
|
|||||||
loading={severity != severityToggle}
|
loading={severity != severityToggle}
|
||||||
emptyCardData={emptyCardData}
|
emptyCardData={emptyCardData}
|
||||||
markItemAsReviewed={markItemAsReviewed}
|
markItemAsReviewed={markItemAsReviewed}
|
||||||
markItemsAsReviewed={markItemsAsReviewed}
|
markAllItemsAsReviewed={markAllItemsAsReviewed}
|
||||||
onSelectReview={onSelectReview}
|
onSelectReview={onSelectReview}
|
||||||
onSelectAllReviews={onSelectAllReviews}
|
onSelectAllReviews={onSelectAllReviews}
|
||||||
setSelectedReviews={setSelectedReviews}
|
setSelectedReviews={setSelectedReviews}
|
||||||
@ -552,10 +549,7 @@ type DetectionReviewProps = {
|
|||||||
loading: boolean;
|
loading: boolean;
|
||||||
emptyCardData: EmptyCardData;
|
emptyCardData: EmptyCardData;
|
||||||
markItemAsReviewed: (review: ReviewSegment) => void;
|
markItemAsReviewed: (review: ReviewSegment) => void;
|
||||||
markItemsAsReviewed: (
|
markAllItemsAsReviewed: (currentItems: ReviewSegment[]) => void;
|
||||||
currentItems: ReviewSegment[],
|
|
||||||
itemsToMarkReviewed?: ReviewSegment[] | undefined,
|
|
||||||
) => void;
|
|
||||||
onSelectReview: (
|
onSelectReview: (
|
||||||
review: ReviewSegment,
|
review: ReviewSegment,
|
||||||
ctrl: boolean,
|
ctrl: boolean,
|
||||||
@ -579,7 +573,7 @@ function DetectionReview({
|
|||||||
loading,
|
loading,
|
||||||
emptyCardData,
|
emptyCardData,
|
||||||
markItemAsReviewed,
|
markItemAsReviewed,
|
||||||
markItemsAsReviewed,
|
markAllItemsAsReviewed,
|
||||||
onSelectReview,
|
onSelectReview,
|
||||||
onSelectAllReviews,
|
onSelectAllReviews,
|
||||||
setSelectedReviews,
|
setSelectedReviews,
|
||||||
@ -794,7 +788,12 @@ function DetectionReview({
|
|||||||
break;
|
break;
|
||||||
case "r":
|
case "r":
|
||||||
if (selectedReviews.length > 0 && !modifiers.repeat) {
|
if (selectedReviews.length > 0 && !modifiers.repeat) {
|
||||||
markItemsAsReviewed(currentItems || [], selectedReviews);
|
currentItems?.forEach((item) => {
|
||||||
|
if (selectedReviews.some((r) => r.id === item.id)) {
|
||||||
|
item.has_been_reviewed = true;
|
||||||
|
markItemAsReviewed(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
setSelectedReviews([]);
|
setSelectedReviews([]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -904,7 +903,7 @@ function DetectionReview({
|
|||||||
variant="select"
|
variant="select"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSelectedReviews([]);
|
setSelectedReviews([]);
|
||||||
markItemsAsReviewed(currentItems ?? []);
|
markAllItemsAsReviewed(currentItems ?? []);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("markTheseItemsAsReviewed")}
|
{t("markTheseItemsAsReviewed")}
|
||||||
|
|||||||
@ -40,8 +40,6 @@ module.exports = {
|
|||||||
animation: {
|
animation: {
|
||||||
"accordion-down": "accordion-down 0.2s ease-out",
|
"accordion-down": "accordion-down 0.2s ease-out",
|
||||||
"accordion-up": "accordion-up 0.2s ease-out",
|
"accordion-up": "accordion-up 0.2s ease-out",
|
||||||
"collapsible-down": "collapsible-down 0.2s ease-out",
|
|
||||||
"collapsible-up": "collapsible-up 0.2s ease-out",
|
|
||||||
move: "move 3s ease-in-out infinite",
|
move: "move 3s ease-in-out infinite",
|
||||||
scale1: "scale1 3s ease-in-out infinite",
|
scale1: "scale1 3s ease-in-out infinite",
|
||||||
scale2: "scale2 3s ease-in-out infinite",
|
scale2: "scale2 3s ease-in-out infinite",
|
||||||
@ -150,14 +148,6 @@ module.exports = {
|
|||||||
from: { height: "var(--radix-accordion-content-height)" },
|
from: { height: "var(--radix-accordion-content-height)" },
|
||||||
to: { height: 0 },
|
to: { height: 0 },
|
||||||
},
|
},
|
||||||
"collapsible-down": {
|
|
||||||
from: { height: "0px" },
|
|
||||||
to: { height: "var(--radix-collapsible-content-height)" },
|
|
||||||
},
|
|
||||||
"collapsible-up": {
|
|
||||||
from: { height: "var(--radix-collapsible-content-height)" },
|
|
||||||
to: { height: "0px" },
|
|
||||||
},
|
|
||||||
move: {
|
move: {
|
||||||
"50%": { left: "calc(100% - 7px)" },
|
"50%": { left: "calc(100% - 7px)" },
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user