Harden docker callback parsing and remove duplicate /openwrt handler

This commit is contained in:
2026-02-15 01:12:45 +03:00
parent 5099ae4fe2
commit 6d5fb9c258
2 changed files with 9 additions and 9 deletions

View File

@@ -15,8 +15,15 @@ async def docker_callback(cb: CallbackQuery):
if cb.from_user.id != ADMIN_ID:
return
_, action, alias = cb.data.split(":", 2)
real = DOCKER_MAP[alias]
try:
_, action, alias = cb.data.split(":", 2)
except ValueError:
await cb.answer("Bad request")
return
real = DOCKER_MAP.get(alias)
if not real:
await cb.answer("Container not found")
return
if action == "restart":
await cb.answer("Restarting…")

View File

@@ -223,13 +223,6 @@ async def openwrt_status(msg: Message):
asyncio.create_task(worker())
@dp.message(F.text == "/openwrt")
async def openwrt_cmd(msg: Message):
if not is_admin_msg(msg):
return
await openwrt_status(msg)
@dp.message(F.text == "/openwrt_wan")
async def openwrt_wan(msg: Message):
if not is_admin_msg(msg):