feat: add zones friendly_name

This commit is contained in:
ZhaiSoul
2025-10-22 07:07:39 +00:00
parent c5fec3271f
commit 36b2043518
31 changed files with 198 additions and 76 deletions
+21
View File
@@ -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,
};
}