diff --git a/client/public/version.js b/client/public/version.js index 3f681a6..5546dec 100644 --- a/client/public/version.js +++ b/client/public/version.js @@ -1,5 +1,5 @@ // Maintainer-controlled web client version. // Format: YYYY.MM.DD Rn (example: 2026.02.20 R2) -window.CHGRID_WEB_VERSION = "2026.02.22 R145"; +window.CHGRID_WEB_VERSION = "2026.02.22 R146"; // Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid. window.CHGRID_TIME_ZONE = "America/Detroit"; diff --git a/server/app/item_catalog.py b/server/app/item_catalog.py index f183e51..877a296 100644 --- a/server/app/item_catalog.py +++ b/server/app/item_catalog.py @@ -86,8 +86,16 @@ ITEM_TYPE_TOOLTIPS: dict[ItemType, str] = { } GLOBAL_ITEM_PROPERTY_METADATA: dict[str, dict[str, object]] = { - "useSound": {"valueType": "sound", "tooltip": "One-shot sound played when this item is used successfully."}, - "emitSound": {"valueType": "sound", "tooltip": "Looping sound emitted from this item on the grid."}, + "useSound": { + "valueType": "sound", + "tooltip": "One-shot sound played when this item is used successfully.", + "maxLength": 2048, + }, + "emitSound": { + "valueType": "sound", + "tooltip": "Looping sound emitted from this item on the grid.", + "maxLength": 2048, + }, "useCooldownMs": {"valueType": "number", "tooltip": "Global cooldown in milliseconds between uses for this item type."}, "emitRange": {"valueType": "number", "tooltip": "Maximum distance in squares where emitted audio can be heard."}, "directional": {"valueType": "boolean", "tooltip": "Whether emitted audio favors the item's facing direction."}, diff --git a/server/app/items/radio.py b/server/app/items/radio.py index 39c16e2..22def72 100644 --- a/server/app/items/radio.py +++ b/server/app/items/radio.py @@ -44,7 +44,7 @@ EFFECT_OPTIONS: tuple[str, ...] = ("reverb", "echo", "flanger", "high_pass", "lo PROPERTY_METADATA: dict[str, dict[str, object]] = { "title": {"valueType": "text", "tooltip": "Display name spoken and shown for this item.", "maxLength": 80}, - "streamUrl": {"valueType": "text", "tooltip": "Audio stream URL used by this radio."}, + "streamUrl": {"valueType": "text", "tooltip": "Audio stream URL used by this radio.", "maxLength": 2048}, "enabled": {"valueType": "boolean", "tooltip": "Turns playback on or off for this radio."}, "mediaVolume": { "valueType": "number", @@ -75,6 +75,8 @@ def validate_update(item: WorldItem, next_params: dict) -> dict: """Validate and normalize radio params.""" stream_url = str(next_params.get("streamUrl", "")).strip() + if len(stream_url) > 2048: + raise ValueError("streamUrl must be 2048 characters or less.") previous_stream_url = str(item.params.get("streamUrl", "")).strip() next_params["streamUrl"] = stream_url diff --git a/server/app/items/widget.py b/server/app/items/widget.py index 981aa26..e30e1ed 100644 --- a/server/app/items/widget.py +++ b/server/app/items/widget.py @@ -81,8 +81,16 @@ PROPERTY_METADATA: dict[str, dict[str, object]] = { "tooltip": "Amount for emit effect.", "range": {"min": 0, "max": 100, "step": 0.1}, }, - "useSound": {"valueType": "sound", "tooltip": "Sound played on use. Filename assumes sounds folder, or use full URL."}, - "emitSound": {"valueType": "sound", "tooltip": "Looping emitted sound. Filename assumes sounds folder, or use full URL."}, + "useSound": { + "valueType": "sound", + "tooltip": "Sound played on use. Filename assumes sounds folder, or use full URL.", + "maxLength": 2048, + }, + "emitSound": { + "valueType": "sound", + "tooltip": "Looping emitted sound. Filename assumes sounds folder, or use full URL.", + "maxLength": 2048, + }, } @@ -169,6 +177,10 @@ def validate_update(item: WorldItem, next_params: dict) -> dict: next_params["useSound"] = _normalize_sound_value(next_params.get("useSound", item.params.get("useSound", ""))) next_params["emitSound"] = _normalize_sound_value(next_params.get("emitSound", item.params.get("emitSound", ""))) + if len(next_params["useSound"]) > 2048: + raise ValueError("useSound must be 2048 characters or less.") + if len(next_params["emitSound"]) > 2048: + raise ValueError("emitSound must be 2048 characters or less.") return next_params