Files
2026-10-23 19:14:52 +03:00

36 lines
1.2 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.
# liberta — конвертер документов Word
HTTP-сервис: принимает `.doc`, `.rtf`, `.odt` и возвращает `.docx`.
Конвертация — LibreOffice headless в контейнере; входные файлы не сохраняются.
Стек: Python 3.12, Flask, LibreOffice.
## Запуск
```bash
docker build -t liberta:1.0.2 .
docker run --rm -p 5000:5000 liberta:1.0.2
curl -s http://localhost:5000/health
# {"ok":true,"version":"1.0.2"}
```
Без Docker: `pip install -r requirements.txt && python3 app.py`
(нужен LibreOffice в `PATH`).
## API
| Метод | Путь | Назначение |
| --- | --- | --- |
| `POST` | `/convert` | `multipart/form-data`, поле `file` → бинарный `.docx` |
| `GET` | `/health` | `{"ok": true, "version": "..."}` |
| `GET` | `/` | HTML-форма конвертации |
Ошибки — `400`/`500` с JSON `{"ok": false, "error": "..."}`.
```bash
curl -X POST -F "file=@документ.doc" \
http://localhost:5000/convert -o результат.docx
```
Один файл за запрос; таймаут — 120 с; порт фиксирован (`5000`).