diff --git a/RAA.md b/RAA.md index c99bf9f..0c82649 100644 --- a/RAA.md +++ b/RAA.md @@ -60,6 +60,8 @@ Database settings: - `vk_poster_header_text` / `vk_poster_footer_text` - `max_poster_header_text` / `max_poster_footer_text` Empty header/footer settings add nothing. + MAX sends wrapper text as HTML. For clickable text use: + `Link text`. ## Workers diff --git a/STATE.md b/STATE.md index e9d78bf..9130ffb 100644 --- a/STATE.md +++ b/STATE.md @@ -92,6 +92,8 @@ canonical git repository as FN-8. Code work for both projects must happen in `tg_poster_header_text`, `tg_poster_footer_text`, `vk_poster_header_text`, `vk_poster_footer_text`, `max_poster_header_text`, `max_poster_footer_text`. +- MAX header/footer text is sent as HTML. For clickable text use: + `Link text`. - The editor textarea must show only clean editable text. - The list preview in `/editor` should show the publication preview, including composed hashtags. - `build_publication_text()` in `src/vk_parser_app/text_utils.py` is display/composition helper only. Do not use it before writing `final_text` to DB. diff --git a/db/migrations/043_platform_header_footer_text.sql b/db/migrations/043_platform_header_footer_text.sql index e5fba9c..e3af4ab 100644 --- a/db/migrations/043_platform_header_footer_text.sql +++ b/db/migrations/043_platform_header_footer_text.sql @@ -21,7 +21,7 @@ VALUES '""'::jsonb, 'text', 'MAX текст в начале поста', - 'Текст, который добавляется перед постом только для MAX. Если пусто, ничего не добавляется.', + 'Текст, который добавляется перед постом только для MAX. Если пусто, ничего не добавляется. Поддерживается HTML-разметка ссылок: Текст.', 'MAX Poster' ), ( @@ -29,7 +29,7 @@ VALUES '""'::jsonb, 'text', 'MAX текст перед хэштегами', - 'Текст, который добавляется после поста и перед хэштегами только для MAX.', + 'Текст, который добавляется после поста и перед хэштегами только для MAX. Поддерживается HTML-разметка ссылок: Текст.', 'MAX Poster' ) ON CONFLICT (key) DO NOTHING; diff --git a/db/migrations/044_max_poster_html_footer_help.sql b/db/migrations/044_max_poster_html_footer_help.sql new file mode 100644 index 0000000..241b28f --- /dev/null +++ b/db/migrations/044_max_poster_html_footer_help.sql @@ -0,0 +1,7 @@ +UPDATE app_settings +SET description = 'Текст, который добавляется перед постом только для MAX. Если пусто, ничего не добавляется. Поддерживается HTML-разметка ссылок: Текст.' +WHERE key = 'max_poster_header_text'; + +UPDATE app_settings +SET description = 'Текст, который добавляется после поста и перед хэштегами только для MAX. Поддерживается HTML-разметка ссылок: Текст.' +WHERE key = 'max_poster_footer_text'; diff --git a/src/vk_parser_app/workers/max_poster.py b/src/vk_parser_app/workers/max_poster.py index 7c82ad4..127af90 100644 --- a/src/vk_parser_app/workers/max_poster.py +++ b/src/vk_parser_app/workers/max_poster.py @@ -156,7 +156,7 @@ class MAXAPIClient: raise RuntimeError(last_error or "MAX API request failed") async def send_message(self, chat_id: int, text: str, attachments: list[dict[str, Any]] | None = None) -> dict[str, Any]: - payload: dict[str, Any] = {"text": text, "notify": True} + payload: dict[str, Any] = {"text": text, "notify": True, "format": "html"} if attachments: payload["attachments"] = attachments return await self.request("POST", f"/messages?chat_id={chat_id}", json=payload) @@ -384,6 +384,7 @@ class MAXPoster: self.common_tags, self.footer_text, self.header_text, + parse_mode="html", ) async def download_media_to_temp(self, session: aiohttp.ClientSession, item: dict[str, Any]) -> Path | None: