Support new backend contracts: single-flight refresh, ad impression tokens, error handling

- apiFetch: proactive refresh, cross-tab single-flight via Web Locks, no logout on transient errors
- AuthContext: save tokens returned on own login change, revoke refresh on logout, sync tabs
- Ads: X-Session-Id, impressionToken in impression/click, IAB viewability, safe http(s) targetUrl
- STOMP: refresh before CONNECT, stop reconnect loop on dead session, /user/queue/errors behind flag
- Auth form: password 8 chars / 72 bytes; 429/413 messages via describeApiError
- My posts with auth + moderation badges; post form step validation and field limits
- Map: escape user text in Yandex hint/template

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SlimusMinus
2026-10-20 02:03:42 +03:00
parent 67de963d6d
commit db37befb8d
34 changed files with 1005 additions and 260 deletions

View File

@@ -3,6 +3,7 @@ import { useTranslation } from "react-i18next";
import { API_URL, getImageUrl } from "../config/authConstants";
import { useGeolocation, GEO_STATUS } from "../hooks/useGeolocation";
import { whenYmapsReady } from "../utils/ymapsApi";
import { escapeCssUrl, escapeHtml } from "../utils/escapeHtml";
const MARKER_COLORS = {
LOST: "#ff3b30",
@@ -12,7 +13,7 @@ const MARKER_COLORS = {
function createMarkerLayout(color, imageUrl) {
const bgStyle = imageUrl
? `background-image:url('${imageUrl}');background-size:cover;background-position:center;`
? `background-image:url('${escapeCssUrl(imageUrl)}');background-size:cover;background-position:center;`
: "";
return window.ymaps.templateLayoutFactory.createClass(
@@ -89,7 +90,9 @@ function createPostPlacemark(m) {
return new window.ymaps.Placemark(
[m.latitude, m.longitude],
{},
// hintContent — свойство метки (не опция) и рендерится как HTML:
// заголовок объявления — пользовательский текст, экранируем.
{ hintContent: escapeHtml(m.title || typeLabel) },
{
iconLayout,
iconImageSize: [40, 40],
@@ -104,7 +107,6 @@ function createPostPlacemark(m) {
},
hasBalloon: false,
hasHint: true,
hintContent: m.title || typeLabel,
}
);
}