Restrict card_id characters.

This commit is contained in:
Dermot Duffy
2023-03-13 21:41:54 -07:00
parent 292a8083d7
commit b0528d94f9
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -895,7 +895,7 @@ type: custom:frigate-card
| Option | Default | Overridable | Description |
| - | - | - | - |
| `card_id` | | :heavy_multiplication_x: | **Advanced users only**: An optional ID to uniquely identify this card. For use when actions are being sent to card(s) via the [query string](#query-string-actions).|
| `card_id` | | :heavy_multiplication_x: | **Advanced users only**: An optional ID to uniquely identify this card. For use when actions are being sent to card(s) via the [query string](#query-string-actions). Must exclusively consist of these characters: `[a-zA-Z0-9_]`.|
<a name="webrtc"></a>
+6 -2
View File
@@ -1319,8 +1319,12 @@ export const frigateCardConfigSchema = z.object({
// Support for card_mod (https://github.com/thomasloven/lovelace-card-mod).
card_mod: z.unknown(),
// Card ID (used for query string commands).
card_id: z.string().optional(),
// Card ID (used for query string commands). Restrict contents to only values
// that be easily used in a URL.
card_id: z
.string()
.regex(/^\w+$/)
.optional(),
// Stock lovelace card config.
type: z.string(),