feat(logs): раздел «Логи» — хвост и свой grep (#16)
CI / ruff · mypy · pytest (pull_request) Successful in 9m40s
CI / ruff · mypy · pytest (pull_request) Successful in 9m40s
- app/logs/grep.py: подмножество grep (шаблон, -i -v -E -c -C N), разбор shlex без исполнения, BRE → regex, таймаут на строку и бюджет на поиск, лимиты 200 символов / 500 строк вывода - app/logs/journal.py: каждый поиск в log_queries (L-6) - бот: выбор контейнера, хвост 50/200 строк или 5 мин/1 ч/24 ч, свой grep по 24 ч, длинный результат — файлом .log (L-5) - логи Docker: не больше 50 000 строк и 5 МБ, сохраняются новейшие - fix: кнопки меню и /menu, /help больше не проглатываются шагами ввода (имя файла, содержимое, сообщение коммита, grep) — фильтр free_input Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@ from aiogram.fsm.state import State, StatesGroup
|
||||
from aiogram.types import BufferedInputFile, CallbackQuery, InlineKeyboardMarkup, Message
|
||||
from aiogram.utils.keyboard import InlineKeyboardBuilder
|
||||
|
||||
from app.bot.menu import Nav, NavAction
|
||||
from app.bot.menu import Nav, NavAction, free_input
|
||||
from app.db.models import ChangeOp, User
|
||||
from app.repo.drafts import DraftFull, DraftService, DraftView
|
||||
from app.repo.git import Entry, GitError, UploadsRepo
|
||||
@@ -520,7 +520,7 @@ def build_router(
|
||||
|
||||
# ---- text input --------------------------------------------------------------------------------------------
|
||||
|
||||
@router.message(Flow.file_name, F.text)
|
||||
@router.message(Flow.file_name, F.text, free_input(texts))
|
||||
async def got_file_name(message: Message, state: FSMContext, member: User) -> None:
|
||||
data = await state.get_data()
|
||||
directory = data.get("commit_path", "")
|
||||
@@ -541,7 +541,7 @@ def build_router(
|
||||
await state.update_data(commit_target=path, commit_op=ChangeOp.ADD.value)
|
||||
await message.answer(t.ask_content.format(path=path), reply_markup=to_dir_keyboard(texts))
|
||||
|
||||
@router.message(Flow.dir_name, F.text)
|
||||
@router.message(Flow.dir_name, F.text, free_input(texts))
|
||||
async def got_dir_name(message: Message, state: FSMContext, member: User) -> None:
|
||||
data = await state.get_data()
|
||||
directory = data.get("commit_path", "")
|
||||
@@ -562,7 +562,7 @@ def build_router(
|
||||
text, kb = await dir_screen(state, member.tg_id, path, 0)
|
||||
await message.answer(text, reply_markup=kb)
|
||||
|
||||
@router.message(Flow.message, F.text)
|
||||
@router.message(Flow.message, F.text, free_input(texts))
|
||||
async def got_message(message: Message, state: FSMContext, member: User) -> None:
|
||||
try:
|
||||
text = check_message(message.text or "")
|
||||
@@ -579,7 +579,7 @@ def build_router(
|
||||
screen, kb = await draft_screen(state, member.tg_id)
|
||||
await message.answer(screen, reply_markup=kb)
|
||||
|
||||
@router.message(Flow.content, F.text | F.document)
|
||||
@router.message(Flow.content, F.text | F.document, free_input(texts))
|
||||
async def got_content(message: Message, state: FSMContext, member: User, bot: Bot) -> None:
|
||||
data = await state.get_data()
|
||||
target: str = data["commit_target"]
|
||||
|
||||
Reference in New Issue
Block a user