Промежуточно: синхронизировать регистр логинов

This commit is contained in:
AidarKC
2026-10-29 13:10:12 +03:00
parent d2b2876a79
commit 395aa62bda
23 changed files with 312 additions and 42 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ function renderAvatarPreview(slot, avatar, title) {
}
function buildAbsoluteChannelUrl({ ownerBlockchainName = '', channelName = '' } = {}) {
const route = makeShineChannelShortRoute({ ownerBlockchainName, channelName });
const route = makeShineChannelShortRoute({ ownerLogin: state.session.login, ownerBlockchainName, channelName });
if (!route) return '';
try {
return new URL(`/${route}`, window.location.origin).toString();
+2 -1
View File
@@ -251,7 +251,7 @@ function buildSelectorFromRoute(route, channelId) {
function buildThreadRoute(post, selector) {
const messageRef = post?.messageRef;
if (!messageRef || !selector) return '';
const ownerLogin = extractLoginFromBlockchainName(selector.ownerBlockchainName);
const ownerLogin = String(selector.ownerLogin || extractLoginFromBlockchainName(selector.ownerBlockchainName)).trim();
return makeShineMessageRoute({
ownerLogin,
messageBlockchainName: messageRef.blockchainName,
@@ -1503,6 +1503,7 @@ async function loadFromApi(route, channelId) {
const channelTypeCode = Number(payload.channel?.channelTypeCode ?? 1);
// Channel-publication URLs are only unambiguous for public channels, not merged private chats.
selector.channelName = String(payload.channel?.channelName || selector.channelName || '').trim();
selector.ownerLogin = ownerLogin; // для человекочитаемых ссылок сохраняем регистр регистрации
selector.publicOrdinalUrlsAllowed = channelTypeCode !== CHANNEL_TYPE_STORIES && channelTypeCode !== CHANNEL_TYPE_PERSONAL;
if (channelTypeCode === CHANNEL_TYPE_STORIES) {
throw new Error('Канал stories скрыт из пользовательского интерфейса.');
+2
View File
@@ -100,6 +100,7 @@ function buildChannelRouteFromSummary(summary, fallbackId) {
const ownerLogin = String(summary?.channel?.ownerLogin || '').trim();
const channelName = String(summary?.channel?.channelName || '').trim();
return makeShineChannelShortRoute({
ownerLogin,
ownerBlockchainName: ownerBch,
channelName: channelName || fallbackId || ownerLogin,
});
@@ -606,6 +607,7 @@ function mapDeletedOwnedChannels(payload, notificationsState = {}) {
id: rowId,
sourceBucket: 'ownDeleted',
route: makeShineChannelShortRoute({
ownerLogin,
ownerBlockchainName: String(item?.ownerBlockchainName || '').trim(),
channelName,
}),
+3 -2
View File
@@ -22,11 +22,12 @@ export function render({ navigate, chrome }) {
// Ссылка на свой профиль – самое частое «поделиться» в соцсети.
const shareProfile = () => {
const url = new URL(window.location.href);
url.pathname = `/${makeSharedProfileRoute(login)}`;
url.pathname = `/${makeSharedProfileRoute(card?.login || login)}`;
url.search = '';
url.hash = '';
const name = [card?.firstName, card?.lastName].map((part) => String(part || '').trim()).filter(Boolean).join(' ');
openShareSheet({ title: 'Поделиться профилем', kicker: name ? `${name} · ${login}` : login, text: 'Профиль в Сиянии', url: url.toString() });
const displayLogin = String(card?.login || login).trim();
openShareSheet({ title: 'Поделиться профилем', kicker: name ? `${name} · ${displayLogin}` : displayLogin, text: 'Профиль в Сиянии', url: url.toString() });
};
const topbar = createTopBar({
title: 'Профиль',
+3 -1
View File
@@ -18,6 +18,8 @@ export function render({navigate}) {
local.autocomplete='off';local.spellcheck=false;local.autocapitalize='off';
local.value=String(state.registrationDraft.login || '').split('@')[0];
const full=document.createElement('p'); full.className='meta-muted';
const caseNotice=document.createElement('p'); caseNotice.className='meta-muted';
caseNotice.textContent='Регистр букв в логине сохранится навсегда. Например, AlexSmith@shine нельзя будет переименовать в alexsmith@shine. При входе и поиске регистр не важен.';
const password=document.createElement('input'); password.className='input';password.type='password';
password.autocomplete='new-password';password.maxLength=PASSWORD_MAX_LENGTH;
password.placeholder='Пароль';password.value=state.registrationDraft.password || '';
@@ -26,7 +28,7 @@ export function render({navigate}) {
const nsLabel=document.createElement('label');nsLabel.className='stack';nsLabel.textContent='Пространство имён'; nsLabel.append(namespace);
const methodLabel=document.createElement('label');methodLabel.className='stack'; methodLabel.textContent='Способ регистрации';methodLabel.append(method);
const pwLabel=document.createElement('label');pwLabel.className='stack';pwLabel.textContent='Пароль (ключи остаются только у вас)';pwLabel.append(password);
form.append(methodLabel,nsLabel,local,full,pwLabel,status,action);
form.append(methodLabel,nsLabel,local,full,caseNotice,pwLabel,status,action);
let namespaces=[]; let disposed=false; let inputRevision=0; let submission=0;
const feeToSol = fee => (Number(fee || '0')/1e9).toFixed(6);
function selected() { return namespaces.find(n=>n.name===namespace.value); }