mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-28 14:49:01 +03:00
feat: add zones friendly_name
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { isValidCameraName } from "./cameraUtil.ts";
|
||||
import { generateFixedHash } from "./stringUtil.ts";
|
||||
|
||||
export function processZoneName(userInput: string): {
|
||||
finalZoneName: string;
|
||||
friendlyName?: string;
|
||||
} {
|
||||
const normalizedInput = userInput.replace(/\s+/g, "_").toLowerCase();
|
||||
|
||||
if (isValidCameraName(normalizedInput)) {
|
||||
return {
|
||||
finalZoneName: normalizedInput,
|
||||
friendlyName: userInput.includes(" ") ? userInput : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
finalZoneName: generateFixedHash(userInput, "zone"),
|
||||
friendlyName: userInput,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user