Use Arcane up/down endpoints
This commit is contained in:
@@ -40,8 +40,8 @@ async def cmd_arcane_projects(msg: Message):
|
||||
if pid:
|
||||
rows.append([
|
||||
InlineKeyboardButton(text=f"🔄 {name}", callback_data=f"arcane:restart:{pid}"),
|
||||
InlineKeyboardButton(text="▶️", callback_data=f"arcane:start:{pid}"),
|
||||
InlineKeyboardButton(text="⏹", callback_data=f"arcane:stop:{pid}"),
|
||||
InlineKeyboardButton(text="▶️", callback_data=f"arcane:up:{pid}"),
|
||||
InlineKeyboardButton(text="⏹", callback_data=f"arcane:down:{pid}"),
|
||||
])
|
||||
|
||||
kb = InlineKeyboardMarkup(inline_keyboard=rows) if rows else arcane_kb
|
||||
@@ -81,8 +81,8 @@ async def arcane_restart(cb: CallbackQuery):
|
||||
await cb.message.answer(f"❌ Arcane restart failed: {info}", reply_markup=arcane_kb)
|
||||
|
||||
|
||||
@dp.callback_query(F.data.startswith("arcane:start:"))
|
||||
async def arcane_start(cb: CallbackQuery):
|
||||
@dp.callback_query(F.data.startswith("arcane:up:"))
|
||||
async def arcane_up(cb: CallbackQuery):
|
||||
if cb.from_user.id != cfg["telegram"]["admin_id"]:
|
||||
return
|
||||
|
||||
@@ -93,15 +93,15 @@ async def arcane_start(cb: CallbackQuery):
|
||||
return
|
||||
|
||||
await cb.answer("Starting…")
|
||||
ok, info = await asyncio.to_thread(set_project_state, base_url, api_key, env_id, pid, "start")
|
||||
ok, info = await asyncio.to_thread(set_project_state, base_url, api_key, env_id, pid, "up")
|
||||
if ok:
|
||||
await cb.message.answer("✅ Arcane start triggered", reply_markup=arcane_kb)
|
||||
await cb.message.answer("✅ Arcane up triggered", reply_markup=arcane_kb)
|
||||
else:
|
||||
await cb.message.answer(f"❌ Arcane start failed: {info}", reply_markup=arcane_kb)
|
||||
await cb.message.answer(f"❌ Arcane up failed: {info}", reply_markup=arcane_kb)
|
||||
|
||||
|
||||
@dp.callback_query(F.data.startswith("arcane:stop:"))
|
||||
async def arcane_stop(cb: CallbackQuery):
|
||||
@dp.callback_query(F.data.startswith("arcane:down:"))
|
||||
async def arcane_down(cb: CallbackQuery):
|
||||
if cb.from_user.id != cfg["telegram"]["admin_id"]:
|
||||
return
|
||||
|
||||
@@ -112,8 +112,8 @@ async def arcane_stop(cb: CallbackQuery):
|
||||
return
|
||||
|
||||
await cb.answer("Stopping…")
|
||||
ok, info = await asyncio.to_thread(set_project_state, base_url, api_key, env_id, pid, "stop")
|
||||
ok, info = await asyncio.to_thread(set_project_state, base_url, api_key, env_id, pid, "down")
|
||||
if ok:
|
||||
await cb.message.answer("✅ Arcane stop triggered", reply_markup=arcane_kb)
|
||||
await cb.message.answer("✅ Arcane down triggered", reply_markup=arcane_kb)
|
||||
else:
|
||||
await cb.message.answer(f"❌ Arcane stop failed: {info}", reply_markup=arcane_kb)
|
||||
await cb.message.answer(f"❌ Arcane down failed: {info}", reply_markup=arcane_kb)
|
||||
|
||||
Reference in New Issue
Block a user