Patch smome doc issues and do minor bug mop up (outgoing bot message flaggin, unprotected bot endpoint, contact filtering on scope selection, don't drop disabled but configured community endpoints

This commit is contained in:
Jack Kingsman
2026-03-05 21:56:10 -08:00
parent adfb4addb7
commit 7534f0cc54
8 changed files with 82 additions and 18 deletions
+6
View File
@@ -179,6 +179,12 @@ app/
- `POST /settings/blocked-names/toggle`
- `POST /settings/migrate`
### Fanout
- `GET /fanout` — list all fanout configs
- `POST /fanout` — create new fanout config
- `PATCH /fanout/{id}` — update fanout config (triggers module reload)
- `DELETE /fanout/{id}` — delete fanout config (stops module)
### Statistics
- `GET /statistics` — aggregated mesh network stats (entity counts, message/packet splits, activity windows, busiest channels)
+1 -1
View File
@@ -58,7 +58,7 @@ class BotModule(FanoutModule):
else:
conversation_key = data.get("conversation_key", "")
sender_key = None
is_outgoing = False
is_outgoing = bool(data.get("outgoing", False))
sender_name = data.get("sender_name")
channel_key = conversation_key
+17 -7
View File
@@ -2129,14 +2129,22 @@ async def _migrate_036_create_fanout_configs(conn: aiosqlite.Connection) -> None
sort_order += 1
logger.info("Migrated private MQTT settings to fanout_configs (enabled=%s)", enabled)
# 4. Migrate community MQTT if enabled
# 4. Migrate community MQTT if enabled OR configured (preserve disabled-but-configured)
community_enabled = bool(row["community_mqtt_enabled"])
if community_enabled:
community_iata = row["community_mqtt_iata"] or ""
community_host = row["community_mqtt_broker_host"] or ""
community_email = row["community_mqtt_email"] or ""
community_has_config = bool(
community_iata
or community_email
or (community_host and community_host != "mqtt-us-v1.letsmesh.net")
)
if community_enabled or community_has_config:
config = {
"broker_host": row["community_mqtt_broker_host"] or "mqtt-us-v1.letsmesh.net",
"broker_host": community_host or "mqtt-us-v1.letsmesh.net",
"broker_port": row["community_mqtt_broker_port"] or 443,
"iata": row["community_mqtt_iata"] or "",
"email": row["community_mqtt_email"] or "",
"iata": community_iata,
"email": community_email,
}
scope = {
@@ -2153,14 +2161,16 @@ async def _migrate_036_create_fanout_configs(conn: aiosqlite.Connection) -> None
str(uuid.uuid4()),
"mqtt_community",
"Community MQTT",
1,
1 if community_enabled else 0,
json.dumps(config),
json.dumps(scope),
sort_order,
now,
),
)
logger.info("Migrated community MQTT settings to fanout_configs")
logger.info(
"Migrated community MQTT settings to fanout_configs (enabled=%s)", community_enabled
)
await conn.commit()
+3
View File
@@ -167,6 +167,9 @@ async def update_fanout_config(config_id: str, body: FanoutConfigUpdate) -> dict
if existing is None:
raise HTTPException(status_code=404, detail="Fanout config not found")
if existing["type"] == "bot" and server_settings.disable_bots:
raise HTTPException(status_code=403, detail="Bot system disabled by server configuration")
kwargs = {}
if body.name is not None:
kwargs["name"] = body.name