Harden docker callback parsing and remove duplicate /openwrt handler
This commit is contained in:
@@ -15,8 +15,15 @@ async def docker_callback(cb: CallbackQuery):
|
||||
if cb.from_user.id != ADMIN_ID:
|
||||
return
|
||||
|
||||
try:
|
||||
_, action, alias = cb.data.split(":", 2)
|
||||
real = DOCKER_MAP[alias]
|
||||
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…")
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user