Обновить публичные ссылки и аватары каналов

This commit is contained in:
AidarKC
2026-10-28 20:03:34 +03:00
parent 8bb7d39c76
commit d2b2876a79
12 changed files with 174 additions and 28 deletions
+11
View File
@@ -106,6 +106,12 @@ export function parseRouteFromPath(pathname = '') {
};
const isLikelyBlockNumber = (value) => /^[0-9]+$/.test(String(value || '').trim());
// Прямая публичная ссылка на профиль, в отличие от адреса канала.
if (segments.length === 3 && segments[0].toLowerCase() === 'shine' && segments[1].toLowerCase() === 'prof') {
const profileLogin = decodePart(segments[2]);
if (profileLogin) return { pageId: 'user', params: { login: profileLogin, fromPage: 'messages-list', section: 'profile' } };
}
const shineRoute = parseShineRouteParts(segments);
if (shineRoute?.entity) {
const shineLogin = shineRoute.entity;
@@ -531,6 +537,11 @@ export function toPrettyPath(path) {
if (!segments.length) return '';
const [head, ...tail] = segments;
const prettyHead = PRETTY_PATHS.get(head) || head;
// Старые вызовы навигации могут передавать %40 через encodeURIComponent.
// Для публичных SHiNE-путей оставляем @ видимым, сохраняя остальные escape-коды.
if (prettyHead.toLowerCase() === 'shine') {
return [prettyHead, ...tail.map((segment) => segment.replace(/%40/gi, '@'))].join('/');
}
return [prettyHead, ...tail].join('/');
}