Fix bug where toggling transport fails if reticulum config section is missing

Fixes #173

Signed-off-by: Andreev Kirill Andreevich <andreev.gh2017@yandex.ru>
This commit is contained in:
Andreev Kirill Andreevich 2026-10-06 21:52:10 +03:00
parent df5aea94ea
commit 3190f3e5a6

View file

@ -980,6 +980,10 @@ class ReticulumMeshChat:
@routes.post("/api/v1/reticulum/enable-transport")
async def index(request):
# ensure reticulum section exists
if "reticulum" not in self.reticulum.config:
self.reticulum.config["reticulum"] = {}
# enable transport mode
self.reticulum.config["reticulum"]["enable_transport"] = True
self.reticulum.config.write()
@ -992,6 +996,10 @@ class ReticulumMeshChat:
@routes.post("/api/v1/reticulum/disable-transport")
async def index(request):
# ensure reticulum section exists
if "reticulum" not in self.reticulum.config:
self.reticulum.config["reticulum"] = {}
# disable transport mode
self.reticulum.config["reticulum"]["enable_transport"] = False
self.reticulum.config.write()