mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-03-28 17:43:05 +01:00
Per https://buymeacoffee.com/ripplebiz/region-filtering: > After some discussions, and that there is some confusion around #channels and #regions, it's been decided to drop the requirement to have the '#' prefix. So, region names will just be plain alphanumeric (and '-'), with no # prefix. > For backwards compatibility, the names will internally have a '#' prepended, but for all client GUI's and command lines, you generally won't see mention of '#' prefixes. The next firmware release (v1.12.0) and subsequent Ripple firmware and Liam's app will have modified UI to remove the '#' requirement. So, silently add, but don't duplicate, for users who have already added hashmarks.
21 lines
628 B
Python
21 lines
628 B
Python
"""Helpers for normalizing MeshCore flood-scope / region names."""
|
|
|
|
|
|
def normalize_region_scope(scope: str | None) -> str:
|
|
"""Normalize a user-facing region scope into MeshCore's internal form.
|
|
|
|
Region names are now user-facing plain strings like ``Esperance``.
|
|
Internally, MeshCore still expects hashtag-style names like ``#Esperance``.
|
|
|
|
Backward compatibility:
|
|
- blank/None stays disabled (`""`)
|
|
- existing leading ``#`` is preserved
|
|
"""
|
|
|
|
stripped = (scope or "").strip()
|
|
if not stripped:
|
|
return ""
|
|
if stripped.startswith("#"):
|
|
return stripped
|
|
return f"#{stripped}"
|