Files
drhider/History/upload-integration/2026-09-15-upload-platform-v022-integration-report.md
Repinoid 49bb4d70d8
Deploy drhider / validate (push) Canceled after 0s
feat: integrate upload-platform v0.2.2 into drhider (v0.0.78)
- Update upload/ module to v0.2.2 with modular Layer 1 (FilePicker) and Layer 2 (Streaming transit upload)
- Replace legacy manual file table in site/templates/index.html with FilePicker.initFilePicker
- Wire uploadViaVM with per-file status updates and abort signal support
- Add dist bundles to dist/ and site/static/dist/ with routes in site/routes/main_bp.py
- Add test_hardening.py and test_safe_name.py from upload-platform
- Bump version to 0.0.78 in site/app.py
- Document integration plan and report in History/upload-integration/
2026-09-15 12:23:31 +03:00

47 lines
4.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 2026-09-15: Интеграция upload-platform v0.2.2 в drhider
## 1. Цель и контекст
Интеграция протестированного модульного релиза `upload-platform` v0.2.2 в сервис `drhider`.
Версия сервиса повышена: `v0.0.77` $\rightarrow$ `v0.0.78`.
## 2. Выполненные изменения
### Ядро модуля `upload/`
- **Слой 1 (Frontend)**: переход на модульный `initFilePicker` с распаковкой ZIP через `fflate`, древовидным представлением папок и архивов, встроенным сворачиванием/разворачиванием групп и дедупликацией. Устаревшие ручные парсеры удалены.
- **Слой 2 (Transit Upload)**:
- **Frontend**: пофайловый стриминговый транзит `uploadViaVM` (PUT на ВМ $\rightarrow$ POST `/api/upload_refs` $\rightarrow$ исходящий pull $\rightarrow$ DELETE из буфера $\rightarrow$ повтор для следующего файла).
- **Backend**: обновлён Blueprint `create_upload_refs_blueprint`: добавлена поддержка локальных путей/mock-буфера (`is_path_only_prefix`), кастомного `httpxTransport` для безопасного тестирования, возвращение параметра `added`.
- **Session**: in-memory хранилище сессий с потокобезопасным TTL и проверкой лимитов.
### Приложение Flask и маршруты
- В [site/routes/main_bp.py](site/routes/main_bp.py) добавлены маршруты раздачи бандлов: `/file-picker/<path:filename>` и `/dist/<path:filename>`.
- Бандлы `file-picker.iife.js` и `file-picker.esm.js` размещены в `dist/` и `site/static/dist/`.
### Пользовательский интерфейс ([site/templates/index.html](site/templates/index.html))
- Вёрстка выбора файлов заменена контейнером `#filePicker`.
- Инициализирован `FilePicker.initFilePicker` с разрешёнными расширениями (`.pdf`, `.doc`, `.docx`, `.txt`, `.md`).
- Логика кнопки «🛡️ Обфусцировать» переведена на `FilePicker.uploadViaVM` с поддержкой отмены (`AbortController`) и пофайловым отображением статусов.
- Сохранён и адаптирован этап 2 обработки (SSE `/api/process_stream/<sid>`, тикеры времени, статистика LLM, выгрузка ZIP и CSV).
### Тесты
- Скопированы и адаптированы тесты:
- [tests/test_hardening.py](tests/test_hardening.py) (проверка устойчивости, malformed requests, SSRF, traversal).
- [tests/test_safe_name.py](tests/test_safe_name.py) (санитизация путей).
- Обновлён [tests/test_upload.py](tests/test_upload.py) (длина сессии `uuid4().hex` = 32 символа).
## 3. Проверки и верификация
- `pytest tests/`: **39 passed** в 4 тестовых файлах.
- `python3 tests/test_builder.py`: **20/20 PASS**.
- `python3 tests/test_extractor.py`: **10/10 PASS**.
- `python3 tests/test_replacer.py`: **10/10 PASS**.
- `python3 tests/test_scanner.py`: **20/20 PASS**.
- `python3 tests/test_zip.py`: **28/28 PASS**.
- Проверка синтаксиса `py_compile` по всем `.py` файлам проекта: **ALL PY FILES COMPILED OK**.
- Проверка импортов ядра: `from drhider import obfuscate_files, LLMClient` $\rightarrow$ **OK**.
- Проверка HTTP:
- `GET /` $\rightarrow$ **HTTP 200**, HTML отрендерен (28571 байт).
- `GET /health` $\rightarrow$ **HTTP 200**, `{"ok":true,"version":"0.0.78"}`.
- `GET /file-picker/file-picker.iife.js` $\rightarrow$ **HTTP 200** (44465 байт).