feat(bot): Коммит — навигация по дереву репозитория загрузок
- UploadsRepo: локальный клон, fetch не чаще fetch_interval, ls-tree -z (пробелы/кириллица), cat-file, последний коммит по пути; git без shell, ssh с -F /dev/null (без конфига хоста) - «📝 Коммит»: папки/файлы с размерами, ⬆️ Вверх, страницы по 20, карточка файла с последним коммитом, «👁 Показать» (<pre> или документом); в кнопках только индексы - ключ для контейнера: GIT_SSH_KEY_B64 → временный файл 0600 (смонтированный файл хоста контейнерному uid не прочитать); volume /data для клона - тесты на настоящем bare-репозитории во временной папке Refs #8 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -64,6 +64,22 @@ class SourceCraftSettings(BaseSettings):
|
||||
max_attempts: int = Field(default=5, ge=1)
|
||||
|
||||
|
||||
class GitSettings(BaseSettings):
|
||||
model_config = SettingsConfigDict(**_ENV, env_prefix="GIT_")
|
||||
|
||||
# The bot's own deploy key with write access to tgit-uploads only (#7)
|
||||
uploads_url: str = "git@ssh.sourcecraft.dev:rogachevegorushka/tgit-uploads.git"
|
||||
ssh_key_path: Path | None = None
|
||||
# Alternative for containers: the private key itself, base64 — a mounted host file is unreadable for the
|
||||
# container user (uid 10001 vs the owner's 0600). Written to a private temp file at startup.
|
||||
ssh_key_b64: SecretStr | None = None
|
||||
branch: str = "main"
|
||||
clone_dir: Path = Path("data/uploads")
|
||||
# Browsing re-fetches at most this often; a push always fetches first (#9)
|
||||
fetch_interval: float = Field(default=10.0, ge=0)
|
||||
timeout: float = Field(default=60.0, gt=0)
|
||||
|
||||
|
||||
class RuntimeSettings(BaseSettings):
|
||||
model_config = _ENV
|
||||
|
||||
@@ -84,4 +100,5 @@ class Settings(BaseSettings):
|
||||
database: DatabaseSettings = Field(default_factory=DatabaseSettings)
|
||||
llm: LLMSettings = Field(default_factory=LLMSettings)
|
||||
sourcecraft: SourceCraftSettings = Field(default_factory=SourceCraftSettings)
|
||||
git: GitSettings = Field(default_factory=GitSettings)
|
||||
runtime: RuntimeSettings = Field(default_factory=RuntimeSettings)
|
||||
|
||||
Reference in New Issue
Block a user