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:
@@ -2,9 +2,11 @@
|
||||
|
||||
from enum import StrEnum
|
||||
|
||||
from aiogram import F
|
||||
from aiogram.filters.callback_data import CallbackData
|
||||
from aiogram.types import InlineKeyboardMarkup, ReplyKeyboardMarkup
|
||||
from aiogram.utils.keyboard import InlineKeyboardBuilder, ReplyKeyboardBuilder
|
||||
from magic_filter import MagicFilter
|
||||
|
||||
from app.texts import Texts
|
||||
|
||||
@@ -38,6 +40,12 @@ def section_by_button(texts: Texts) -> dict[str, Section]:
|
||||
}
|
||||
|
||||
|
||||
def free_input(texts: Texts) -> MagicFilter:
|
||||
"""Input for a dialog step — anything but a main-menu button or a bot command: those must work from any step,
|
||||
otherwise «🩺 Статус» pressed while the bot waits for a file name becomes the file name."""
|
||||
return ~F.text.in_(set(section_by_button(texts))) & ~F.text.regexp(r"^/(start|menu|help)(@\w+)?(\s|$)")
|
||||
|
||||
|
||||
def main_menu(texts: Texts, *, is_admin: bool) -> ReplyKeyboardMarkup:
|
||||
m = texts.menu
|
||||
kb = ReplyKeyboardBuilder()
|
||||
|
||||
Reference in New Issue
Block a user