HEADER v3, primary аккаунты и подтверждения

This commit is contained in:
AidarKC
2026-11-27 12:29:24 +03:00
parent f9e7c4ef94
commit ae430e84c7
89 changed files with 1201 additions and 1596 deletions
+9 -2
View File
@@ -495,7 +495,14 @@ export function parseRouteFromPath(pathname = '') {
}
export function getRoute() {
return parseRouteFromPath(window.location.pathname || '');
const path = window.location.pathname || '';
// Нормализуем старые ссылки чатов также при прямом входе и Back/Forward.
const pretty = path.replace(/^(\/(?:chat|chat-view)\/)([^/]+)/i, (_, prefix, id) => prefix + id.replace(/%40/gi, '@'));
if (pretty !== path) {
window.history.replaceState(window.history.state, '', pretty + window.location.search + window.location.hash);
if (currentTrackedPath === path) currentTrackedPath = pretty;
}
return parseRouteFromPath(pretty);
}
export function navigate(path) {
@@ -557,7 +564,7 @@ export function toPrettyPath(path) {
const prettyHead = PRETTY_PATHS.get(head) || head;
// Старые вызовы навигации могут передавать %40 через encodeURIComponent.
// Для публичных SHiNE-путей оставляем @ видимым, сохраняя остальные escape-коды.
if (prettyHead.toLowerCase() === 'shine') {
if (['shine', 'chat'].includes(prettyHead.toLowerCase())) {
return [prettyHead, ...tail.map((segment) => segment.replace(/%40/gi, '@'))].join('/');
}
return [prettyHead, ...tail].join('/');