SHA256
Улучшить UI регистрации и связанные сценарии
This commit is contained in:
@@ -279,7 +279,7 @@ export function render({navigate, chrome}) {
|
||||
const listHint = document.createElement('p');
|
||||
listHint.className = 'meta-muted';
|
||||
listHint.textContent = sessionLogin
|
||||
? `Пользователь: @${sessionLogin}`
|
||||
? `Пользователь: ${sessionLogin}`
|
||||
: 'В текущей сессии не найден логин пользователя.';
|
||||
const listBody = document.createElement('div');
|
||||
listBody.className = 'stack';
|
||||
@@ -343,7 +343,7 @@ export function render({navigate, chrome}) {
|
||||
refreshAddButton();
|
||||
if (candidate) {
|
||||
addInput.value = candidate.login;
|
||||
addStatus.textContent = `Выбран сервер @${candidate.login}${candidate.url ? ` (${candidate.url})` : ''}`;
|
||||
addStatus.textContent = `Выбран сервер ${candidate.login}${candidate.url ? ` (${candidate.url})` : ''}`;
|
||||
} else {
|
||||
addStatus.textContent = 'Для смены сервера понадобится подтверждение главным ключом.';
|
||||
}
|
||||
@@ -363,7 +363,7 @@ export function render({navigate, chrome}) {
|
||||
const row = document.createElement('div');
|
||||
row.innerHTML = `
|
||||
<span style="display:block; text-align:left;">
|
||||
<strong>@${escapeHtml(server.login)}</strong>
|
||||
<strong>${escapeHtml(server.login)}</strong>
|
||||
<span class="meta-muted" style="display:block; margin-top:0.2rem;">${escapeHtml(server.url || 'URL не указан')}</span>
|
||||
</span>
|
||||
`;
|
||||
@@ -421,7 +421,7 @@ export function render({navigate, chrome}) {
|
||||
suggestEl.hidden = false;
|
||||
suggestEl.innerHTML = items.map((item) => (
|
||||
`<button type="button" class="ui-button profile-relative-suggest-item" data-login="${escapeHtml(item.login)}" data-url="${escapeHtml(item.url || '')}">
|
||||
@${escapeHtml(item.login)}
|
||||
${escapeHtml(item.login)}
|
||||
<span class="meta-muted" style="display:block; margin-top:0.2rem;">${escapeHtml(item.url || 'URL не указан')}</span>
|
||||
</button>`
|
||||
)).join('');
|
||||
@@ -595,7 +595,7 @@ export function render({navigate, chrome}) {
|
||||
return;
|
||||
}
|
||||
if (currentAccessServers.some((item) => item.login === login)) {
|
||||
addStatus.textContent = `Сервер @${login} уже выбран.`;
|
||||
addStatus.textContent = `Сервер ${login} уже выбран.`;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -603,7 +603,7 @@ export function render({navigate, chrome}) {
|
||||
const resolved = await resolveShineServerByServerLogin({ serverLogin: login, solanaEndpoint });
|
||||
confirmModal?.open({
|
||||
title: 'Сменить сервер доступа?',
|
||||
text: `Заменить текущий сервер доступа на @${resolved.serverLogin}?`,
|
||||
text: `Заменить текущий сервер доступа на ${resolved.serverLogin}?`,
|
||||
note: resolved.httpBase
|
||||
? `Адрес сервера: ${resolved.httpBase}\nПрежняя переписка и настройки автоматически не перенесутся. Изменение будет записано в записи аккаунта в Solana.`
|
||||
: 'Прежняя переписка и настройки автоматически не перенесутся. Изменение будет записано в записи аккаунта в Solana.',
|
||||
@@ -612,8 +612,8 @@ export function render({navigate, chrome}) {
|
||||
try {
|
||||
await updateAccessServers(nextList, {
|
||||
statusTarget: addStatus,
|
||||
successText: `Сервер доступа заменён на @${resolved.serverLogin}.`,
|
||||
inFlightText: `Обновляем запись аккаунта и меняем сервер на @${resolved.serverLogin}...`,
|
||||
successText: `Сервер доступа заменён на ${resolved.serverLogin}.`,
|
||||
inFlightText: `Обновляем запись аккаунта и меняем сервер на ${resolved.serverLogin}...`,
|
||||
});
|
||||
} catch {
|
||||
// Сообщение уже показано в статусе.
|
||||
|
||||
@@ -18,7 +18,7 @@ export const pageMeta = { id: 'add-channel-view', title: 'Создание ка
|
||||
|
||||
const CREATE_CHANNEL_FLASH_KEY = 'shine-channels-create-success';
|
||||
const CHANNEL_TYPE_PUBLIC = 1;
|
||||
const CHANNEL_LOGIN_HINT = 'Латиница, цифры, _ и -, от 3 до 32 символов, не только цифры.';
|
||||
const CHANNEL_LOGIN_HINT = 'Латиница, цифры, _ и -, от 4 до 32 символов, не только цифры.';
|
||||
const CHANNEL_LOGIN_DIGITS_ONLY_HINT = 'Имя канала не должно состоять только из цифр.';
|
||||
|
||||
function persistCreateSuccessFlash(message) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
makeProfileRoute,
|
||||
makeShineChannelShortRoute,
|
||||
makeShineChannelDonateRoute,
|
||||
formatChannelAddress,
|
||||
} from '../services/shine-routes.js';
|
||||
import { loadProfileSnapshot } from '../services/user-profile-params.js';
|
||||
import {
|
||||
@@ -269,7 +270,7 @@ function openSupportChannelModal({ ownerLogin, ownerUser, channelTitle }) {
|
||||
<div class="channel-support-modal-head">
|
||||
<div>
|
||||
<h3 class="modal-title">Донат автору</h3>
|
||||
<p class="meta-muted channel-support-subtitle">${escapeHtml(channelTitle || 'Канал')} · @${escapeHtml(ownerLogin)}</p>
|
||||
<p class="meta-muted channel-support-subtitle">${escapeHtml(channelTitle || 'Канал')} · ${escapeHtml(ownerLogin)}</p>
|
||||
</div>
|
||||
<button class="icon-btn channel-support-close" id="channel-support-close" type="button" aria-label="Закрыть" title="Закрыть">×</button>
|
||||
</div>
|
||||
@@ -594,7 +595,7 @@ export function render({ navigate, route, chrome }) {
|
||||
<div class="channel-about-hero">
|
||||
<div class="channel-about-avatar-slot" id="channel-about-avatar-slot"></div>
|
||||
<h2 class="channel-about-title">${escapeHtml(cleanName)}</h2>
|
||||
<div class="channel-about-subline">@${escapeHtml(channelName || ownerLogin)} · ${escapeHtml(statsText(subscribersCount))} ${escapeHtml(subscribersWord(subscribersCount))}</div>
|
||||
<div class="channel-about-subline">${escapeHtml(formatChannelAddress({ ownerLogin, channelName }))} · ${escapeHtml(statsText(subscribersCount))} ${escapeHtml(subscribersWord(subscribersCount))}</div>
|
||||
${isDeleted ? '<div class="status-line is-unavailable">Канал удалён владельцем. История остаётся доступной.</div>' : ''}
|
||||
</div>
|
||||
|
||||
@@ -617,7 +618,7 @@ export function render({ navigate, route, chrome }) {
|
||||
<span class="channel-about-owner-avatar" id="channel-about-owner-avatar"></span>
|
||||
<span class="channel-about-row-main">
|
||||
<strong>${escapeHtml(ownerName)}</strong>
|
||||
<span class="channel-about-row-label">Владелец · @${escapeHtml(ownerLogin)}</span>
|
||||
<span class="channel-about-row-label">Владелец · ${escapeHtml(ownerLogin)}</span>
|
||||
</span>
|
||||
<span class="channel-about-row-chevron">${iconHtml('chevron')}</span>
|
||||
</button>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
import { authService, state } from '../state.js';
|
||||
import { navigateBack } from '../router.js';
|
||||
import { extractLoginFromBlockchainName } from '../services/shine-routes.js';
|
||||
import { extractLoginFromBlockchainName, formatChannelAddress } from '../services/shine-routes.js';
|
||||
import {
|
||||
formatSol,
|
||||
getBalanceSol,
|
||||
@@ -146,7 +146,7 @@ export function render({ navigate, route, chrome }) {
|
||||
<div class="channel-donate-hero">
|
||||
<h2>Донат автору</h2>
|
||||
<strong>${escapeHtml(channelTitle)}</strong>
|
||||
<span>${escapeHtml(ownerLogin)}${channelName ? ` / ${escapeHtml(channelName)}` : ''}</span>
|
||||
<span>${escapeHtml(formatChannelAddress({ ownerLogin, channelName }))}</span>
|
||||
</div>
|
||||
|
||||
<section class="channel-donate-section">
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
parseMessageAttachments,
|
||||
} from '../services/attachment-format.js';
|
||||
import { loadProfileSnapshot } from '../services/user-profile-params.js';
|
||||
import { extractLoginFromBlockchainName, makeProfileRoute, makeShineChannelRoute, makeShineMessageRoute } from '../services/shine-routes.js';
|
||||
import { extractLoginFromBlockchainName, formatChannelAddress, makeProfileRoute, makeShineChannelRoute, makeShineMessageRoute } from '../services/shine-routes.js';
|
||||
import { parsePublicationOrdinal, publicationAtOrdinal, ordinalForPublication } from '../services/channel-message-ordinals.js';
|
||||
import { dropPageData, pageDataAge, readPageData, writePageData } from '../services/page-data-cache.js';
|
||||
import { scrollNodeIntoContainer } from '../services/scroll-utils.js';
|
||||
@@ -1870,7 +1870,7 @@ export function render({ navigate, route, chrome }) {
|
||||
const headerNumber = Number.isSafeInteger(number) && number > 0 ? ` · №${number}` : '';
|
||||
if (threadHeaderButton) {
|
||||
threadHeaderTitle.textContent = `${title}${headerNumber}`;
|
||||
threadHeaderChannel.textContent = `${visibleOwner ? `@${visibleOwner}` : ''}${visibleOwner && shortName ? ' / ' : ''}${shortName}`;
|
||||
threadHeaderChannel.textContent = formatChannelAddress({ ownerLogin: visibleOwner, channelName: shortName });
|
||||
threadHeaderButton.querySelector('.channel-thread-header-avatar')?.remove();
|
||||
const avatar = renderAvatar({
|
||||
initials: (title[0] || 'К').toUpperCase(),
|
||||
|
||||
@@ -53,6 +53,7 @@ import {
|
||||
makeShineChannelStreamRoute,
|
||||
makeShineChannelAboutRoute,
|
||||
makeShineChannelDonateRoute,
|
||||
formatChannelAddress,
|
||||
} from '../services/shine-routes.js';
|
||||
import { parseDmTechBlocks } from '../services/dm-tech-blocks.js';
|
||||
import { dropPageData, readPageData, writePageData } from '../services/page-data-cache.js';
|
||||
@@ -666,7 +667,7 @@ function openChannelMetaDetailsModal({
|
||||
const channelTitle = String(channel.displayTitle || channel.displayName || channel.name || '–').trim();
|
||||
const ownerLogin = String(channel.ownerLogin || channel.ownerName || extractLoginFromBlockchainName(channel.ownerBlockchainName) || '').trim();
|
||||
const channelSlug = String(channel.name || '').trim();
|
||||
const systemName = [ownerLogin, channelSlug].filter(Boolean).join('/') || '–';
|
||||
const systemName = formatChannelAddress({ ownerLogin, channelName: channelSlug }) || '–';
|
||||
const dateLabel = title === 'Канал создан' ? 'Дата создания' : 'Дата изменения';
|
||||
const root = document.getElementById('modal-root');
|
||||
root.innerHTML = `
|
||||
@@ -3003,7 +3004,7 @@ export function render({ navigate, route, chrome }) {
|
||||
titleNode.textContent = titleLabel;
|
||||
const subNode = document.createElement('span');
|
||||
subNode.className = 'topbar-identity__sub';
|
||||
subNode.textContent = apiData?.isDiary ? 'Только вам' : `${owner ? `@${owner}` : ''}${owner && slug ? ' / ' : ''}${slug}`;
|
||||
subNode.textContent = apiData?.isDiary ? 'Только вам' : formatChannelAddress({ ownerLogin: owner, channelName: slug });
|
||||
text.append(titleNode, subNode);
|
||||
channelHeaderButton.append(createChannelAvatarElement(apiData?.channel, 40), text);
|
||||
channelHeaderButton.setAttribute('aria-label', `${titleLabel}. О канале`);
|
||||
|
||||
@@ -14,8 +14,7 @@ import {
|
||||
softHaptic,
|
||||
writeChannelNotificationsState,
|
||||
} from '../services/channels-ux.js';
|
||||
import { makeShineChannelRoute } from '../services/shine-routes.js';
|
||||
import { makeShineChannelShortRoute } from '../services/shine-routes.js';
|
||||
import { formatChannelAddress, makeShineChannelRoute, makeShineChannelShortRoute } from '../services/shine-routes.js';
|
||||
import { renderAvatar } from '../components/avatar-image.js';
|
||||
import { createOverflowDots } from '../components/overflow-dots.js';
|
||||
import { createDropdownMenu } from '../components/dropdown-menu.js';
|
||||
@@ -243,7 +242,7 @@ function channelSuggestionsByInput(rawInput) {
|
||||
if (!owner || !channel) return null;
|
||||
return {
|
||||
key: `${owner.toLowerCase()}/${channel.toLowerCase()}`,
|
||||
label: `@${owner}/${channel}`,
|
||||
label: formatChannelAddress({ ownerLogin: owner, channelName: channel }),
|
||||
owner,
|
||||
channel,
|
||||
};
|
||||
@@ -252,8 +251,7 @@ function channelSuggestionsByInput(rawInput) {
|
||||
return uniqueBy(rows, (it) => it.key)
|
||||
.filter((it) => (
|
||||
it.channel.toLowerCase().includes(q) ||
|
||||
`${it.owner.toLowerCase()}/${it.channel.toLowerCase()}`.includes(q) ||
|
||||
`@${it.owner.toLowerCase()}/${it.channel.toLowerCase()}`.includes(q)
|
||||
formatChannelAddress({ ownerLogin: it.owner.toLowerCase(), channelName: it.channel.toLowerCase() }).includes(normalizeLoginInput(q))
|
||||
))
|
||||
.slice(0, 7)
|
||||
.map((it) => it.label);
|
||||
@@ -334,10 +332,10 @@ function isFollowedChannelVisible(target) {
|
||||
|
||||
function openSimpleSubscribeModal({ kind, kindLabel, submitLabel, unfollow = false, onSuccess }) {
|
||||
const targetHint = kind === 'channel'
|
||||
? '<p class="meta-muted">Канал: user/channel или имя канала.</p>'
|
||||
: '<p class="meta-muted">Автор: @login или login.</p>';
|
||||
? '<p class="meta-muted">Канал: Alice@free/channel или имя канала.</p>'
|
||||
: '<p class="meta-muted">Автор: Alice@free (старый ввод с @ тоже принимается).</p>';
|
||||
const submitText = submitLabel || (unfollow ? 'Отписаться' : 'Подписаться');
|
||||
const placeholder = kind === 'channel' ? '@owner/channel' : '@login';
|
||||
const placeholder = kind === 'channel' ? 'Alice@free/channel' : 'Alice@free';
|
||||
|
||||
const root = document.getElementById('modal-root');
|
||||
root.innerHTML = `
|
||||
@@ -401,7 +399,7 @@ function openSimpleSubscribeModal({ kind, kindLabel, submitLabel, unfollow = fal
|
||||
return;
|
||||
}
|
||||
const logins = await authService.searchUsers(prefix);
|
||||
const suggestions = (Array.isArray(logins) ? logins : []).slice(0, 8).map((login) => `@${login}`);
|
||||
const suggestions = (Array.isArray(logins) ? logins : []).slice(0, 8).map((login) => normalizeLoginInput(login));
|
||||
renderSuggestions(suggestEl, suggestions, applySuggestion);
|
||||
return;
|
||||
}
|
||||
@@ -564,7 +562,7 @@ function mapApiChannelRow(summary, bucketKey, idx, index, notificationsState) {
|
||||
const channelTypeVersion = Number(summary?.channel?.channelTypeVersion ?? 1);
|
||||
const isOwn = bucketKey === 'own';
|
||||
const title = displayTitle || channelName;
|
||||
const technicalLabel = `@${ownerLogin}/${channelName}`;
|
||||
const technicalLabel = formatChannelAddress({ ownerLogin, channelName });
|
||||
const lastMessage = resolveChannelLastMessage(summary);
|
||||
|
||||
return {
|
||||
@@ -619,7 +617,7 @@ function mapDeletedOwnedChannels(payload, notificationsState = {}) {
|
||||
avaAr: String(item?.avatarAr || '').trim(),
|
||||
avaSha256: String(item?.avatarSha256 || '').trim().toLowerCase(),
|
||||
title: displayTitle,
|
||||
technicalLabel: `@${ownerLogin}/${channelName}`,
|
||||
technicalLabel: formatChannelAddress({ ownerLogin, channelName }),
|
||||
channelName,
|
||||
displayTitle,
|
||||
channelDescription: '',
|
||||
@@ -854,8 +852,8 @@ function renderChannelMain(channel) {
|
||||
|
||||
const technical = document.createElement('p');
|
||||
technical.className = 'channel-row-technical';
|
||||
technical.textContent = `@${channel.ownerName || 'автор'}`;
|
||||
technical.hidden = !!channel.isOwnChannel;
|
||||
technical.textContent = channel.technicalLabel || formatChannelAddress({ ownerLogin: channel.ownerName || 'автор', channelName: channel.channelName });
|
||||
// Системный адрес одинаково виден в собственных и чужих каналах.
|
||||
|
||||
if (channel.channelDescription) {
|
||||
const desc = document.createElement('p');
|
||||
|
||||
@@ -146,7 +146,7 @@ function createChatHeaderParts(login, navigate) {
|
||||
const relation = chatRelationLabel(currentPeer?.relationType);
|
||||
// Статус аккаунта, а не «в сети»: присутствие сервер не сообщает, выдумывать его нельзя
|
||||
const shining = String(currentPeer?.shineStatus || '').toLowerCase() === 'shining' ? '✧ сияющий аккаунт' : '';
|
||||
metaEl.textContent = [fullName ? `@${cleanLogin}` : '', shining, relation].filter(Boolean).join(' · ');
|
||||
metaEl.textContent = [fullName ? cleanLogin : '', shining, relation].filter(Boolean).join(' · ');
|
||||
metaEl.hidden = !metaEl.textContent;
|
||||
const avatar = renderUserAvatar({
|
||||
login: cleanLogin,
|
||||
@@ -552,7 +552,7 @@ async function openForwardMessageDialog({ message, sourceChatId = '', onConfirm
|
||||
name.textContent = fullName || item.peerLogin;
|
||||
const login = document.createElement('span');
|
||||
login.className = 'meta-muted';
|
||||
login.textContent = `@${item.peerLogin}`;
|
||||
login.textContent = item.peerLogin;
|
||||
copy.append(name, login);
|
||||
const arrow = document.createElement('span');
|
||||
arrow.className = 'dm-forward-chat-arrow';
|
||||
@@ -577,7 +577,7 @@ async function openForwardMessageDialog({ message, sourceChatId = '', onConfirm
|
||||
recipientName.textContent = fullName || item.peerLogin;
|
||||
const recipientLogin = document.createElement('div');
|
||||
recipientLogin.className = 'meta-muted';
|
||||
recipientLogin.textContent = `@${item.peerLogin}`;
|
||||
recipientLogin.textContent = item.peerLogin;
|
||||
recipientCopy.append(recipientName, recipientLogin);
|
||||
recipient.append(recipientCopy);
|
||||
|
||||
@@ -610,7 +610,7 @@ async function openForwardMessageDialog({ message, sourceChatId = '', onConfirm
|
||||
try {
|
||||
await onConfirm?.(item.peerLogin);
|
||||
close();
|
||||
showToast(`Сообщение переслано в чат @${item.peerLogin}`, { timeoutMs: 1500 });
|
||||
showToast(`Сообщение переслано в чат ${item.peerLogin}`, { timeoutMs: 1500 });
|
||||
} catch (error) {
|
||||
confirm.disabled = false;
|
||||
back.disabled = false;
|
||||
@@ -809,7 +809,7 @@ function openConfirmContactModal(targetLogin = '') {
|
||||
<div class="modal" id="contact-confirm-modal">
|
||||
<div class="modal-card stack">
|
||||
<h3 class="modal-title">Добавить собеседника</h3>
|
||||
<p class="meta-muted">Добавить пользователя @${targetLogin} в контакты?</p>
|
||||
<p class="meta-muted">Добавить пользователя ${targetLogin} в контакты?</p>
|
||||
<div class="form-actions-grid">
|
||||
<button class="secondary-btn" type="button" id="contact-confirm-no">Нет</button>
|
||||
<button class="primary-btn" type="button" id="contact-confirm-yes">Да</button>
|
||||
|
||||
@@ -76,7 +76,7 @@ export function render({ navigate, chrome }) {
|
||||
if (ownShown.length) {
|
||||
frag.append(createListSection(query ? `Ваши связи · ${ownShown.length}` : 'Близкие и друзья'));
|
||||
ownShown.slice(0, query ? 50 : 40).forEach((person) => {
|
||||
const sub = [displayName(person) !== person.login ? `@${person.login}` : '', RELATION_TEXT[person.relationFlag] || ''].filter(Boolean).join(' · ');
|
||||
const sub = [displayName(person) !== person.login ? `${person.login}` : '', RELATION_TEXT[person.relationFlag] || ''].filter(Boolean).join(' · ');
|
||||
frag.append(personRow(person, sub));
|
||||
});
|
||||
}
|
||||
@@ -93,7 +93,7 @@ export function render({ navigate, chrome }) {
|
||||
} else {
|
||||
others.forEach((user) => {
|
||||
const person = { login: String(user.login || ''), displayName: user.displayName, avatarAr: user.avatarAr };
|
||||
frag.append(personRow(person, displayName(person) !== person.login ? `@${person.login}` : ''));
|
||||
frag.append(personRow(person, displayName(person) !== person.login ? `${person.login}` : ''));
|
||||
});
|
||||
}
|
||||
if (!ownShown.length && !remote.loading && !remote.error && !others.length) {
|
||||
|
||||
@@ -225,7 +225,7 @@ export function render({ navigate }) {
|
||||
state.loginDraft.login = resumed.login || session.login;
|
||||
state.loginDraft.password = '';
|
||||
await refreshSessions();
|
||||
setAuthInfo(`Вход по QR-коду выполнен для @${resumed.login || session.login}.`);
|
||||
setAuthInfo(`Вход по QR-коду выполнен для ${resumed.login || session.login}.`);
|
||||
navigate(consumeAuthReturnPage('profile-view'));
|
||||
} catch (error) {
|
||||
const message = toUserMessage(error, 'Не удалось войти по QR-коду.');
|
||||
|
||||
@@ -84,7 +84,7 @@ export function render({ navigate }) {
|
||||
startBtn.textContent = 'Получить код';
|
||||
|
||||
const loginInput = { value: String(state.loginDraft.login || '').trim() };
|
||||
who.textContent = loginInput.value ? `Вход для @${loginInput.value}` : '';
|
||||
who.textContent = loginInput.value ? `Вход для ${loginInput.value}` : '';
|
||||
const shortCodeEl = codeBlock.querySelector('#pairing-short-code');
|
||||
const timerFillEl = codeBlock.querySelector('#pairing-timer-fill');
|
||||
const timerTextEl = codeBlock.querySelector('#pairing-timer-text');
|
||||
@@ -170,8 +170,8 @@ export function render({ navigate }) {
|
||||
state.loginDraft.login = resumed.login || session.login;
|
||||
state.loginDraft.password = '';
|
||||
await refreshSessions();
|
||||
setAuthInfo(`Вход через другое устройство выполнен для @${resumed.login || session.login}.`);
|
||||
showToast(`Устройство подключено для @${resumed.login || session.login}`);
|
||||
setAuthInfo(`Вход через другое устройство выполнен для ${resumed.login || session.login}.`);
|
||||
showToast(`Устройство подключено для ${resumed.login || session.login}`);
|
||||
navigate(consumeAuthReturnPage('profile-view'));
|
||||
};
|
||||
|
||||
@@ -205,8 +205,8 @@ export function render({ navigate }) {
|
||||
state.loginDraft.login = resumed.login || login;
|
||||
state.loginDraft.password = '';
|
||||
await refreshSessions();
|
||||
setAuthInfo(`Session-only вход выполнен для @${resumed.login || login}.`);
|
||||
showToast(`Wallet-session подключена для @${resumed.login || login}`);
|
||||
setAuthInfo(`Session-only вход выполнен для ${resumed.login || login}.`);
|
||||
showToast(`Wallet-session подключена для ${resumed.login || login}`);
|
||||
navigate(consumeAuthReturnPage('profile-view'));
|
||||
};
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ export function render({ navigate }) {
|
||||
state.registrationDraft.pendingSessionMaterial = null;
|
||||
|
||||
await refreshSessions();
|
||||
setAuthInfo(`Вы вошли как @${result.login}.`);
|
||||
setAuthInfo(`Вы вошли как ${result.login}.`);
|
||||
navigate(consumeAuthReturnPage('profile-view'));
|
||||
} catch (error) {
|
||||
overlay.style.display = 'none';
|
||||
|
||||
@@ -22,7 +22,7 @@ function setStatus(statusEl, message, kind = 'error') {
|
||||
function setRemoteServer(remoteWrap, serverLoginEl, serverLinkEl, payload) {
|
||||
const serverLogin = String(payload?.accessServerLogin || '').trim();
|
||||
const serverUrl = String(payload?.accessServerUrl || '').trim();
|
||||
serverLoginEl.textContent = serverLogin ? `@${serverLogin}` : 'другой сервер доступа';
|
||||
serverLoginEl.textContent = serverLogin || 'другой сервер доступа';
|
||||
serverLinkEl.textContent = serverUrl || 'Открыть сервер';
|
||||
serverLinkEl.href = buildShineHttpUrlFromAddress(serverUrl);
|
||||
remoteWrap.style.display = '';
|
||||
|
||||
@@ -115,9 +115,9 @@ function targetText(target) {
|
||||
if (!target) return '';
|
||||
const login = String(target.toLogin || '').trim();
|
||||
const block = Number(target.toBlockNumber);
|
||||
if (login && Number.isInteger(block) && block >= 0) return `@${login} · блок #${block}`;
|
||||
if (login && Number.isInteger(block) && block >= 0) return `${login} · блок #${block}`;
|
||||
if (Number.isInteger(block) && block >= 0) return `блок #${block}`;
|
||||
return login ? `@${login}` : '';
|
||||
return login || '';
|
||||
}
|
||||
|
||||
function channelNameText(lineCode, channelNames) {
|
||||
@@ -157,7 +157,7 @@ function describeEntry(item, inspection, channelNames) {
|
||||
const subType = Number(frame.subType);
|
||||
|
||||
if (type === 0 && subType === 0) {
|
||||
return { title: 'Начало блокчейна', detailTitle: 'Начало блокчейна', text: body.login ? `Владелец: @${body.login}` : '', attachmentsCount: 0 };
|
||||
return { title: 'Начало блокчейна', detailTitle: 'Начало блокчейна', text: body.login ? `Владелец: ${body.login}` : '', attachmentsCount: 0 };
|
||||
}
|
||||
if (type === 0 && subType === 1) {
|
||||
const displayName = String(body.channelMeta?.title || body.channelName || '').trim() || `#${frame.blockNumber}`;
|
||||
@@ -352,7 +352,7 @@ function addDetailRow(container, label, value, { code = false } = {}) {
|
||||
function addTargetRows(container, target, fallbackLogin = '') {
|
||||
if (!target) return;
|
||||
const login = String(target.toLogin || fallbackLogin || '').trim();
|
||||
if (login) addDetailRow(container, 'Цель', `@${login}`);
|
||||
if (login) addDetailRow(container, 'Цель', login);
|
||||
if (Number.isInteger(Number(target.toForkNumber))) addDetailRow(container, 'Fork цели', target.toForkNumber);
|
||||
if (Number.isInteger(Number(target.toBlockNumber))) addDetailRow(container, 'Блок цели', `#${target.toBlockNumber}`);
|
||||
if (target.toBlockHash) addDetailRow(container, 'Хэш цели', target.toBlockHash, { code: true });
|
||||
|
||||
@@ -776,7 +776,7 @@ export function render({ navigate, route, chrome } = {}) {
|
||||
const meta = document.createElement('div');
|
||||
meta.className = 'net-card__meta';
|
||||
const parts = [];
|
||||
if (normKey(node.name) !== node.id) parts.push(`@${node.login}`);
|
||||
if (normKey(node.name) !== node.id) parts.push(node.login);
|
||||
if (isCenter) parts.push(isSelf ? 'это вы' : 'в центре карты');
|
||||
else parts.push(relationText(node));
|
||||
if (node.shining) parts.push('сияющий');
|
||||
@@ -2065,7 +2065,7 @@ export function render({ navigate, route, chrome } = {}) {
|
||||
function personRow(node, { onOpen = null, withType = false } = {}) {
|
||||
const note = notes.get(node.id);
|
||||
const sub = [];
|
||||
if (normKey(node.name) !== node.id) sub.push(`@${node.login}`);
|
||||
if (normKey(node.name) !== node.id) sub.push(node.login);
|
||||
if (node.tier > 1) {
|
||||
const via = map.byId.get(node.parentId);
|
||||
if (via) sub.push(`через ${via.name}`);
|
||||
@@ -2279,7 +2279,7 @@ export function render({ navigate, route, chrome } = {}) {
|
||||
login,
|
||||
name: name || login,
|
||||
avatar: user.avatarAr ? { ar: user.avatarAr } : null,
|
||||
sub: name && normKey(name) !== normKey(login) ? `@${login} · показать его связи` : 'показать его связи',
|
||||
sub: name && normKey(name) !== normKey(login) ? `${login} · показать его связи` : 'показать его связи',
|
||||
onClick: () => recenter(login),
|
||||
actions: [{ icon: 'profile', label: 'Профиль', onClick: () => { closeSearch(); navigate(profileRoute(login)); } }],
|
||||
}));
|
||||
|
||||
@@ -109,7 +109,7 @@ export function render({ navigate, chrome } = {}) {
|
||||
firstName: peer.firstName,
|
||||
lastName: peer.lastName,
|
||||
avatar: peer.avatar || null,
|
||||
sub: [fullName ? `@${login}` : '', until ? formatDmMuteUntil(until) : 'навсегда'].filter(Boolean).join(' · '),
|
||||
sub: [fullName ? login : '', until ? formatDmMuteUntil(until) : 'навсегда'].filter(Boolean).join(' · '),
|
||||
onClick: () => navigate(`chat/${encodeURIComponent(normalizeDmChatId(chatId))}`),
|
||||
actions: [{ icon: 'bell', label: 'Включить звук', onClick: () => setDmChatMuted(chatId, false) }],
|
||||
});
|
||||
|
||||
@@ -112,6 +112,7 @@ export function render({ navigate }) {
|
||||
if (revision !== inputRevision) throw new Error('Логин изменился. Нажмите «Продолжить» ещё раз.');
|
||||
if (!available.loginAvailable) throw new Error('Такой логин уже занят. Попробуйте другой.');
|
||||
if (Number(available.namespaceType) !== Number(ns.type)) throw new Error('Тип регистрации изменился. Вернитесь к выбору аккаунта.');
|
||||
if (Number(available.currencyCode ?? 1) !== 1 || Number(ns.currencyCode ?? 1) !== 1) throw new Error('Валюта регистрации пока не поддерживается.');
|
||||
if (draft.login !== login) {
|
||||
if (!confirmFundedWalletChange()) return;
|
||||
state.registrationPayment.walletAddress = '';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { getSolanaCluster } from '../services/solana-rpc-gateway.js';
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
import { createRegistrationStepper } from '../components/registration-stepper.js';
|
||||
import { iconHtml } from '../components/ui-icon.js';
|
||||
import {
|
||||
authService,
|
||||
authorizeSession,
|
||||
@@ -28,11 +27,10 @@ import {
|
||||
registerUserOnSolana,
|
||||
} from '../services/solana-register-service.js';
|
||||
import { defaultServerLogin } from '../deploy-config.js';
|
||||
import { normalizeFullLogin } from '../services/shine-namespace-service.js';
|
||||
import { getNamespace, normalizeFullLogin } from '../services/shine-namespace-service.js';
|
||||
import { calculateRegistrationFunding, USER_PDA_SPACE, solFromLamports } from '../services/registration-upgrade-helpers.js';
|
||||
|
||||
export const pageMeta = { id: 'registration-payment-view', title: 'Оплата регистрации', showAppChrome: false };
|
||||
const MIN_REQUIRED_SOL = 0.01;
|
||||
const RECOMMENDED_TOPUP_SOL = 0.02;
|
||||
const TEST_TOPUP_AMOUNT_SOL = 0.02;
|
||||
const DEVNET_ENDPOINT = 'https://api.devnet.solana.com';
|
||||
const TEST_TOPUP_SENDER_PRIVATE_32_BASE58 = '6xqAuKYvA8qrCdAkcw7Y8aMgvBnYk8JLxWLma5BzbAvu';
|
||||
@@ -147,7 +145,7 @@ export async function completeRegistrationLogin({ navigate, keyBundle }) {
|
||||
state.registrationPayment.balanceSOL = '0.0000';
|
||||
|
||||
await refreshSessions();
|
||||
setAuthInfo(`Регистрация завершена. Вы автоматически вошли как @${resumedLogin}.`);
|
||||
setAuthInfo(`Регистрация завершена. Вы автоматически вошли как ${resumedLogin}.`);
|
||||
|
||||
const nextHash = String(state.authReturnHash || '').trim();
|
||||
state.authReturnHash = '';
|
||||
@@ -163,7 +161,9 @@ export function render({ navigate }) {
|
||||
screen.className = 'stack';
|
||||
|
||||
const card = document.createElement('div');
|
||||
card.className = 'card stack';
|
||||
card.className = 'card stack registration-payment-card';
|
||||
let funding = null;
|
||||
let pricingValid = false;
|
||||
|
||||
const status = document.createElement('p');
|
||||
status.className = 'status-line is-unavailable';
|
||||
@@ -177,41 +177,50 @@ export function render({ navigate }) {
|
||||
walletValue.style.width = '100%';
|
||||
|
||||
const walletRow = document.createElement('div');
|
||||
walletRow.className = 'stack';
|
||||
walletRow.className = 'registration-payment-wallet';
|
||||
|
||||
const copyButton = document.createElement('button');
|
||||
copyButton.className = 'ghost-btn';
|
||||
copyButton.className = 'secondary-btn registration-payment-action registration-payment-copy-btn';
|
||||
copyButton.type = 'button';
|
||||
copyButton.textContent = 'Скопировать номер';
|
||||
copyButton.style.width = '100%';
|
||||
copyButton.textContent = 'Скопировать адрес';
|
||||
copyButton.addEventListener('click', async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(walletValue.value);
|
||||
copyButton.textContent = 'Скопировано';
|
||||
copyButton.textContent = '✓ Адрес скопирован';
|
||||
window.setTimeout(() => {
|
||||
copyButton.textContent = 'Скопировать номер';
|
||||
copyButton.textContent = 'Скопировать адрес';
|
||||
}, 1500);
|
||||
} catch {
|
||||
status.className = 'status-line is-unavailable';
|
||||
status.textContent = 'Не удалось скопировать номер кошелька.';
|
||||
status.textContent = 'Не удалось скопировать адрес кошелька.';
|
||||
status.style.display = '';
|
||||
}
|
||||
});
|
||||
|
||||
walletRow.append(walletValue, copyButton);
|
||||
const walletHeading = document.createElement('h4');
|
||||
walletHeading.className = 'registration-payment-wallet-heading';
|
||||
walletHeading.textContent = 'Ваш Solana-кошелёк в Сиянии';
|
||||
const walletHint = document.createElement('p');
|
||||
walletHint.className = 'meta-muted registration-payment-wallet-hint';
|
||||
walletHint.textContent = 'Для регистрации пополните этот Solana-кошелёк. Он уже создан из ваших ключей SHiNE.';
|
||||
const walletLabel = document.createElement('label');
|
||||
walletLabel.className = 'field-label';
|
||||
walletLabel.textContent = 'Адрес кошелька';
|
||||
walletRow.append(walletHeading, walletHint, walletLabel, walletValue, copyButton);
|
||||
|
||||
const balanceRow = document.createElement('div');
|
||||
balanceRow.className = 'row wrap-row';
|
||||
balanceRow.className = 'registration-payment-balance';
|
||||
|
||||
const balanceValue = document.createElement('strong');
|
||||
balanceValue.className = 'registration-payment-balance-value';
|
||||
balanceValue.setAttribute('aria-live', 'polite');
|
||||
balanceValue.textContent = `${formatSol(parseBalanceSol(state.registrationPayment.balanceSOL), 6)} SOL`;
|
||||
|
||||
const refreshButton = document.createElement('button');
|
||||
refreshButton.className = 'icon-btn payment-refresh-btn';
|
||||
refreshButton.className = 'secondary-btn registration-payment-action registration-payment-refresh-btn';
|
||||
refreshButton.type = 'button';
|
||||
refreshButton.innerHTML = iconHtml('refresh');
|
||||
refreshButton.title = 'Обновить баланс';
|
||||
refreshButton.setAttribute('aria-label', 'Обновить баланс');
|
||||
refreshButton.textContent = '↻ Обновить';
|
||||
refreshButton.title = 'Обновить баланс Solana';
|
||||
|
||||
// Коротко и по-человечески; технические подробности — во всплывающей подсказке.
|
||||
const showWalletError = (error, fallback) => {
|
||||
@@ -227,7 +236,7 @@ export function render({ navigate }) {
|
||||
const address = String(addressOverride || walletValue.value || '').trim();
|
||||
if (!address) return null;
|
||||
refreshButton.disabled = true;
|
||||
refreshButton.classList.add('is-loading');
|
||||
refreshButton.textContent = '↻ Обновляем…';
|
||||
try {
|
||||
const balance = await getBalanceSol({
|
||||
endpoint: state.entrySettings.solanaServer,
|
||||
@@ -235,13 +244,13 @@ export function render({ navigate }) {
|
||||
});
|
||||
state.registrationPayment.balanceSOL = String(balance.sol);
|
||||
balanceValue.textContent = `${formatSol(balance.sol, 6)} SOL`;
|
||||
return Number(balance.sol) || 0;
|
||||
return BigInt(balance.lamports);
|
||||
} catch (error) {
|
||||
if (showError) showWalletError(error, 'Не удалось обновить баланс. Проверьте связь и попробуйте ещё раз.');
|
||||
return null;
|
||||
} finally {
|
||||
refreshButton.disabled = false;
|
||||
refreshButton.classList.remove('is-loading');
|
||||
refreshButton.textContent = '↻ Обновить';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -263,17 +272,23 @@ export function render({ navigate }) {
|
||||
void refreshBalance();
|
||||
});
|
||||
|
||||
balanceRow.append(balanceValue, refreshButton);
|
||||
const balanceInfo = document.createElement('div');
|
||||
balanceInfo.className = 'registration-payment-balance-info';
|
||||
const balanceLabel = document.createElement('span');
|
||||
balanceLabel.className = 'registration-payment-balance-label';
|
||||
balanceLabel.textContent = 'Баланс';
|
||||
balanceInfo.append(balanceLabel, balanceValue);
|
||||
balanceRow.append(balanceInfo, refreshButton);
|
||||
|
||||
const isTestContour = isTestRegistrationContour();
|
||||
const topupButton = document.createElement('button');
|
||||
topupButton.className = 'ghost-btn';
|
||||
topupButton.className = 'secondary-btn registration-payment-action registration-payment-topup-btn';
|
||||
topupButton.type = 'button';
|
||||
topupButton.textContent = 'Тестовое пополнение (пока доступно в тестовом режиме)';
|
||||
topupButton.textContent = `Тестовое пополнение (+${TEST_TOPUP_AMOUNT_SOL} SOL)`;
|
||||
topupButton.addEventListener('click', async () => {
|
||||
status.style.display = 'none';
|
||||
topupButton.disabled = true;
|
||||
const defaultText = 'Тестовое пополнение (пока доступно в тестовом режиме)';
|
||||
const defaultText = `Тестовое пополнение (+${TEST_TOPUP_AMOUNT_SOL} SOL)`;
|
||||
topupButton.textContent = 'Пополняем...';
|
||||
try {
|
||||
const address = await deriveUserWalletAddress();
|
||||
@@ -320,20 +335,18 @@ export function render({ navigate }) {
|
||||
submitButton.disabled = true;
|
||||
submitButton.textContent = 'Регистрация...';
|
||||
|
||||
if (!pricingValid) throw new Error('Актуальная стоимость ещё не загружена. Проверьте соединение с Solana.');
|
||||
const walletAddress = await deriveUserWalletAddress();
|
||||
const currentBalance = await refreshBalance({ showError: true, addressOverride: walletAddress });
|
||||
if (currentBalance == null) return;
|
||||
const namespaceFeeSol = Number(state.registrationDraft.namespaceFeeLamports || 0) / 1e9;
|
||||
const requiredSol = Math.max(MIN_REQUIRED_SOL, namespaceFeeSol + 0.004);
|
||||
if (currentBalance < requiredSol) {
|
||||
// Получаем цену из namespace-PDA непосредственно перед отправкой, а не из черновика.
|
||||
funding = await loadFunding();
|
||||
if (currentBalance < funding.requiredLamports) {
|
||||
const shortage = funding.requiredLamports - currentBalance;
|
||||
status.className = 'status-line is-unavailable';
|
||||
status.textContent = isTestContour
|
||||
? `Для регистрации нужно минимум ${requiredSol.toFixed(6)} SOL. Рекомендуем пополнить кошелёк примерно на ${Math.max(RECOMMENDED_TOPUP_SOL, namespaceFeeSol + 0.004).toFixed(6)} SOL. Сейчас на кошельке ${formatSol(currentBalance, 6)} SOL.`
|
||||
: `Для регистрации пополните этот кошелёк соланами примерно на ${Math.max(RECOMMENDED_TOPUP_SOL, namespaceFeeSol + 0.004).toFixed(6)} SOL. Сейчас на кошельке ${formatSol(currentBalance, 6)} SOL. Минимум для продолжения: ${requiredSol.toFixed(6)} SOL.`;
|
||||
status.textContent = `Для регистрации пополните кошелёк минимум на ${solFromLamports(shortage)} SOL. Цена namespace ${solFromLamports(funding.namespaceFee)} SOL уже включает депозит PDA; фактическая комиссия сети оплачивается отдельно.`;
|
||||
if (isTestContour) status.textContent += ` В devnet можно использовать «Тестовое пополнение».`;
|
||||
status.style.display = '';
|
||||
if (isTestContour) {
|
||||
status.textContent += ` Нажмите «Тестовое пополнение», чтобы сразу добавить ${TEST_TOPUP_AMOUNT_SOL} SOL без перехода на другой экран.`;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -387,20 +400,38 @@ export function render({ navigate }) {
|
||||
}
|
||||
});
|
||||
|
||||
const namespaceFeeSol = Number(state.registrationDraft.namespaceFeeLamports || 0) / 1e9;
|
||||
const displayTopupSol = Math.max(RECOMMENDED_TOPUP_SOL, namespaceFeeSol + 0.004);
|
||||
card.innerHTML = `
|
||||
<h1 class="signup-title">Создание аккаунта в Solana</h1>
|
||||
<p class="auth-copy">В блокчейне Solana для вас будет создана личная запись (PDA), которая не зависит от одного сервера Сияния. Разовая регистрация в namespace: ${formatSol(namespaceFeeSol, 6)} SOL. Пополните кошелёк примерно на ${formatSol(displayTopupSol, 6)} SOL с учётом сетевых расходов.</p>
|
||||
<label class="stack"><span class="field-label">Номер кошелька</span></label>
|
||||
<div class="stack">
|
||||
<span class="field-label">Баланс (Solana)</span>
|
||||
</div>
|
||||
<p class="auth-copy">В Solana будет создана ваша независимая запись (PDA). Депозит PDA включён в стоимость namespace. Сетевая комиссия Solana оплачивается отдельно.</p>
|
||||
`;
|
||||
card.children[2].append(walletRow);
|
||||
card.children[3].append(balanceRow);
|
||||
const priceLine = document.createElement('p');
|
||||
priceLine.className = 'registration-payment-fees';
|
||||
priceLine.textContent = 'Проверяем актуальную стоимость в Solana…';
|
||||
card.append(priceLine);
|
||||
submitButton.disabled = true;
|
||||
const loadFunding = async () => {
|
||||
const fullLogin = String(state.registrationDraft.login || '').trim();
|
||||
const name = fullLogin.split('@')[1];
|
||||
if (!name) throw new Error('В логине не указан namespace');
|
||||
const solanaEndpoint = state.entrySettings.solanaServer;
|
||||
const [namespace, solana] = await Promise.all([
|
||||
getNamespace({ namespace: name, solanaEndpoint }),
|
||||
loadSolanaWeb3(),
|
||||
]);
|
||||
const connection = new solana.Connection(solanaEndpoint, 'confirmed');
|
||||
const rentLamports = await connection.getMinimumBalanceForRentExemption(USER_PDA_SPACE, 'confirmed');
|
||||
const latestFunding = calculateRegistrationFunding({ namespaceFeeLamports: namespace.registrationFeeLamports, rentLamports });
|
||||
funding = latestFunding;
|
||||
priceLine.textContent = `Регистрация в namespace: ${solFromLamports(funding.namespaceFee)} SOL (депозит PDA включён). Для оплаты на кошельке: не менее ${solFromLamports(funding.requiredLamports)} SOL, включая небольшой запас на комиссию сети. Спишется фактическая комиссия сети, остаток сохранится.`;
|
||||
return funding;
|
||||
};
|
||||
card.append(walletRow, balanceRow);
|
||||
if (isTestContour) {
|
||||
card.append(topupButton);
|
||||
const testHint = document.createElement('p');
|
||||
testHint.className = 'meta-muted registration-payment-test-hint';
|
||||
testHint.textContent = 'Только для сети devnet. Тестовые SOL не имеют реальной стоимости.';
|
||||
card.append(testHint);
|
||||
}
|
||||
card.append(submitButton, status);
|
||||
card.prepend(createRegistrationStepper(3));
|
||||
@@ -420,9 +451,12 @@ export function render({ navigate }) {
|
||||
try {
|
||||
const walletAddress = await deriveUserWalletAddress();
|
||||
await refreshBalance({ addressOverride: walletAddress });
|
||||
await loadFunding();
|
||||
pricingValid = true;
|
||||
submitButton.disabled = false;
|
||||
} catch (error) {
|
||||
status.className = 'status-line is-unavailable';
|
||||
status.textContent = `Не удалось подготовить blockchain key: ${error?.message || 'unknown'}`;
|
||||
status.textContent = `Не удалось подготовить регистрацию: ${error?.message || 'unknown'}`;
|
||||
status.style.display = '';
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -62,7 +62,7 @@ export function render({ navigate, chrome }) {
|
||||
element('p', 'meta-muted', 'Сейчас управление ключами и переход на другой сервер ограничены: ваша регистрация зависит от сервера и сохранности его ключей.'),
|
||||
element('p', 'meta-muted', 'После закрепления в Solana у вас появится собственная PDA: вы сможете самостоятельно менять пароль и ключи, а также пользоваться совместимыми серверами.'),
|
||||
element('p', 'meta-muted', 'Логин, namespace, три публичных ключа, публикации и история Arweave останутся прежними. Для доступности истории на другом сервере требуется её синхронизация.'),
|
||||
element('p', 'meta-muted', 'Регистрация в Solana оплачивается один раз. Для проведения транзакции на вашем Solana-кошельке должны быть SOL.'),
|
||||
element('p', 'meta-muted', 'Вы платите цену своего namespace один раз. Депозит PDA уже включён, отдельно оплачивается только комиссия сети Solana.'),
|
||||
);
|
||||
const introStatus = element('p', 'status-line', 'Проверяем бесплатный сертификат, PDA и актуальную стоимость…');
|
||||
introStatus.setAttribute('aria-live', 'polite');
|
||||
@@ -70,19 +70,30 @@ export function render({ navigate, chrome }) {
|
||||
continueButton.disabled = true;
|
||||
intro.append(continueButton, introStatus);
|
||||
|
||||
const payment = element('div', 'card stack');
|
||||
const payment = element('div', 'card stack registration-payment-card');
|
||||
payment.append(element('h3', '', 'Оплата регистрации Solana'));
|
||||
const walletHint = element('p', 'meta-muted', 'Пополните этот Solana-адрес. Это ваш существующий blockchain key, новый кошелёк не создаётся.');
|
||||
const walletLabel = element('label', 'field-label', 'Ваш Solana-кошелёк');
|
||||
const walletHeading = element('h4', 'registration-payment-wallet-heading', 'Ваш Solana-кошелёк в Сиянии');
|
||||
const walletHint = element('p', 'meta-muted registration-payment-wallet-hint', 'Пополните этот кошелёк в сети Solana для регистрации. Адрес уже связан с ключами вашего аккаунта SHiNE — новый кошелёк не создаётся.');
|
||||
const walletLabel = element('label', 'field-label', 'Адрес кошелька');
|
||||
const wallet = document.createElement('input');
|
||||
wallet.className = 'input'; wallet.type = 'text'; wallet.readOnly = true;
|
||||
wallet.style.width = '100%'; wallet.setAttribute('aria-label', 'Адрес Solana-кошелька');
|
||||
const copyButton = makeButton('Скопировать адрес', 'ghost-btn');
|
||||
const amount = element('p', 'meta-muted', 'Получаем стоимость регистрации…');
|
||||
const balanceLine = element('p', 'meta-muted', 'Баланс: —');
|
||||
const refreshButton = makeButton('Обновить баланс', 'ghost-btn');
|
||||
const topupButton = makeButton(`Тестовое пополнение (+${UPGRADE_TEST_TOPUP_SOL} SOL)`, 'ghost-btn');
|
||||
const testHint = element('p', 'meta-muted', 'Тестовое пополнение доступно только в сети devnet. Тестовые SOL не имеют реальной стоимости.');
|
||||
const copyButton = makeButton('Скопировать адрес', 'secondary-btn registration-payment-action registration-payment-copy-btn');
|
||||
const walletSection = element('div', 'registration-payment-wallet');
|
||||
walletSection.append(walletHeading, walletHint, walletLabel, wallet, copyButton);
|
||||
|
||||
const balanceLine = element('strong', 'registration-payment-balance-value', '— SOL');
|
||||
balanceLine.setAttribute('aria-live', 'polite');
|
||||
const balanceLabel = element('span', 'registration-payment-balance-label', 'Баланс');
|
||||
const balanceInfo = element('div', 'registration-payment-balance-info');
|
||||
balanceInfo.append(balanceLabel, balanceLine);
|
||||
const refreshButton = makeButton('↻ Обновить', 'secondary-btn registration-payment-action registration-payment-refresh-btn');
|
||||
refreshButton.title = 'Обновить баланс Solana';
|
||||
const balanceRow = element('div', 'registration-payment-balance');
|
||||
balanceRow.append(balanceInfo, refreshButton);
|
||||
const topupButton = makeButton(`Тестовое пополнение (+${UPGRADE_TEST_TOPUP_SOL} SOL)`, 'secondary-btn registration-payment-action registration-payment-topup-btn');
|
||||
const testHint = element('p', 'meta-muted registration-payment-test-hint', 'Только для сети devnet. Тестовые SOL не имеют реальной стоимости.');
|
||||
const amount = element('div', 'registration-payment-fees', 'Получаем стоимость регистрации…');
|
||||
const passwordLabel = element('label', 'field-label', 'Пароль действующего аккаунта');
|
||||
const password = document.createElement('input');
|
||||
password.className = 'input'; password.type = 'password'; password.autocomplete = 'current-password';
|
||||
@@ -90,9 +101,9 @@ export function render({ navigate, chrome }) {
|
||||
const payButton = makeButton('Оплатить и закрепить аккаунт');
|
||||
const payStatus = element('p', 'status-line');
|
||||
payStatus.setAttribute('aria-live', 'polite');
|
||||
payment.append(walletHint, walletLabel, wallet, copyButton, amount, balanceLine, refreshButton);
|
||||
payment.append(walletSection, balanceRow);
|
||||
if (isDevnet) payment.append(topupButton, testHint);
|
||||
payment.append(passwordLabel, password, payButton, payStatus);
|
||||
payment.append(amount, passwordLabel, password, payButton, payStatus);
|
||||
|
||||
const syncing = element('div', 'card stack');
|
||||
syncing.append(element('h3', '', 'Проверяем регистрацию'));
|
||||
@@ -147,16 +158,20 @@ export function render({ navigate, chrome }) {
|
||||
async function balanceUpdate(showError = true) {
|
||||
if (!walletAddress) return null;
|
||||
refreshButton.disabled = true;
|
||||
refreshButton.textContent = '↻ Обновляем…';
|
||||
try {
|
||||
const balance = await getBalanceSol({ endpoint: solanaEndpoint, address: walletAddress });
|
||||
if (disposed) return null;
|
||||
balanceLine.textContent = `Баланс: ${formatSol(balance.sol, 6)} SOL`;
|
||||
balanceLine.textContent = `${formatSol(balance.sol, 6)} SOL`;
|
||||
return BigInt(balance.lamports);
|
||||
} catch (error) {
|
||||
if (showError) message(payStatus, `Не удалось прочитать баланс: ${error.message}`, true);
|
||||
return null;
|
||||
} finally {
|
||||
if (!disposed) refreshButton.disabled = false;
|
||||
if (!disposed) {
|
||||
refreshButton.disabled = false;
|
||||
refreshButton.textContent = '↻ Обновить';
|
||||
}
|
||||
}
|
||||
}
|
||||
async function hasVerifiedPda(expectedIdentity = identity) {
|
||||
@@ -252,7 +267,17 @@ export function render({ navigate, chrome }) {
|
||||
const pubkey = new web3.PublicKey(walletAddress);
|
||||
walletAddress = pubkey.toBase58();
|
||||
wallet.value = walletAddress;
|
||||
amount.textContent = `Комиссия namespace: ${solFromLamports(funding.namespaceFee)} SOL; депозит PDA: ${solFromLamports(funding.rent)} SOL; минимум с запасом на сеть: ${solFromLamports(funding.requiredLamports)} SOL. Рекомендуется ${solFromLamports(funding.recommendedLamports)} SOL.`;
|
||||
amount.replaceChildren(element('h4', 'registration-payment-fees-title', 'Стоимость регистрации'));
|
||||
for (const [label, lamports, emphasized] of [
|
||||
['Регистрация в namespace (депозит PDA включён)', funding.namespaceFee, true],
|
||||
['Запас на комиссию сети Solana', funding.networkReserve, false],
|
||||
['Для оплаты достаточно иметь на кошельке', funding.requiredLamports, false],
|
||||
]) {
|
||||
const row = element('div', `registration-payment-fee-row${emphasized ? ' registration-payment-fee-row--emphasis' : ''}`);
|
||||
row.append(element('span', '', label), element('strong', '', `${solFromLamports(lamports)} SOL`));
|
||||
amount.append(row);
|
||||
}
|
||||
amount.append(element('p', 'meta-muted', 'Сеть спишет фактическую комиссию транзакции; неизрасходованный запас останется на кошельке.'));
|
||||
continueButton.disabled = false;
|
||||
message(introStatus, 'Данные аккаунта и стоимость проверены.');
|
||||
}
|
||||
@@ -264,6 +289,8 @@ export function render({ navigate, chrome }) {
|
||||
copyButton.addEventListener('click', async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(walletAddress);
|
||||
copyButton.textContent = '✓ Адрес скопирован';
|
||||
window.setTimeout(() => { if (!disposed) copyButton.textContent = 'Скопировать адрес'; }, 1600);
|
||||
message(payStatus, 'Адрес кошелька скопирован.');
|
||||
} catch {
|
||||
message(payStatus, 'Не удалось скопировать адрес. Можно скопировать его вручную.', true);
|
||||
@@ -277,7 +304,7 @@ export function render({ navigate, chrome }) {
|
||||
message(payStatus, `Переводим ${UPGRADE_TEST_TOPUP_SOL} тестовых SOL в devnet…`);
|
||||
const result = await fundDevnetRegistrationWallet(walletAddress);
|
||||
if (disposed) return;
|
||||
balanceLine.textContent = `Баланс: ${formatSol(result.sol, 6)} SOL`;
|
||||
balanceLine.textContent = `${formatSol(result.sol, 6)} SOL`;
|
||||
message(payStatus, `Тестовое пополнение +${UPGRADE_TEST_TOPUP_SOL} SOL выполнено.`);
|
||||
} catch (error) {
|
||||
message(payStatus, `Тестовое пополнение недоступно (${error.message}). Используйте внешний devnet faucet и обновите баланс.`, true);
|
||||
|
||||
@@ -4,7 +4,7 @@ import { renderAvatar } from '../components/avatar-image.js';
|
||||
import { createPersonRow } from '../components/person-row.js';
|
||||
import { createLoadingState, createStateMessage } from '../components/feedback.js';
|
||||
import { iconHtml } from '../components/ui-icon.js';
|
||||
import { makeShineChannelRoute, makeProfileRoute } from '../services/shine-routes.js';
|
||||
import { formatChannelAddress, makeShineChannelRoute, makeProfileRoute } from '../services/shine-routes.js';
|
||||
|
||||
export const pageMeta = {
|
||||
id: 'search-view',
|
||||
@@ -39,7 +39,7 @@ function channelRow(item, navigate) {
|
||||
title.textContent = displayName;
|
||||
const address = document.createElement('span');
|
||||
address.className = 'shine-search-result__address';
|
||||
address.textContent = `@${ownerLogin}/${slug} · ${Number(item.subscribersCount || 0)} подписчиков`;
|
||||
address.textContent = `${formatChannelAddress({ ownerLogin, channelName: slug })} · ${Number(item.subscribersCount || 0)} подписчиков`;
|
||||
text.append(title, address);
|
||||
const description = String(item.description || '').trim();
|
||||
if (description) {
|
||||
@@ -68,7 +68,7 @@ function personRow(person, navigate) {
|
||||
login,
|
||||
name: displayName || login,
|
||||
avatar: person.avatarAr ? { ar: person.avatarAr } : null,
|
||||
sub: displayName && displayName !== login ? `@${login}` : '',
|
||||
sub: displayName && displayName !== login ? login : '',
|
||||
onClick: () => navigate(makeProfileRoute(login)),
|
||||
actions: [{ icon: 'message', label: 'Написать', onClick: () => navigate(`chat/${encodeURIComponent(login)}`) }],
|
||||
});
|
||||
@@ -85,7 +85,7 @@ export function render({ navigate, chrome }) {
|
||||
const search = document.createElement('input');
|
||||
search.type = 'search';
|
||||
search.className = 'search-field__input shine-search-input';
|
||||
search.placeholder = 'Название канала, @автор или автор/канал';
|
||||
search.placeholder = 'Название канала или Alice@free/channel';
|
||||
search.maxLength = 120;
|
||||
search.autocomplete = 'off';
|
||||
search.enterKeyHint = 'search';
|
||||
|
||||
@@ -123,7 +123,7 @@ export function render({ navigate, route, chrome }) {
|
||||
row.shineConfirmed ? 'сияние подтверждено' : '',
|
||||
].filter(Boolean);
|
||||
const name = userDisplayName(row);
|
||||
const sub = [name !== row.login ? `@${row.login}` : '', ...marks].filter(Boolean).join(' · ');
|
||||
const sub = [name !== row.login ? row.login : '', ...marks].filter(Boolean).join(' · ');
|
||||
return createPersonRow({
|
||||
login: row.login,
|
||||
name,
|
||||
|
||||
@@ -166,7 +166,7 @@ export function render({ route, chrome }) {
|
||||
<section class="card stack relation-manage-card relation-manage-card--social">
|
||||
<div class="relation-manage-card-head">
|
||||
<strong>Связь</strong>
|
||||
<span>@${escapeProfileHtml(targetCard?.login || targetLogin)}</span>
|
||||
<span>${escapeProfileHtml(targetCard?.login || targetLogin)}</span>
|
||||
</div>
|
||||
${relationSummaryHtml(flags)}
|
||||
<div class="relation-manage-choices" aria-label="Изменить ваше отношение к пользователю">
|
||||
|
||||
@@ -744,8 +744,8 @@ function validatePersonalChannelName(value) {
|
||||
const normalized = normalizeChannelDisplayName(value);
|
||||
if (!normalized) return { ok: false, error: 'Введите логин пользователя.' };
|
||||
const length = Array.from(normalized).length;
|
||||
if (length < 1 || length > 20) {
|
||||
return { ok: false, error: 'Логин: 1-20 символов.' };
|
||||
if (length < 4 || length > 20) {
|
||||
return { ok: false, error: 'Логин для нового персонального канала: 4–20 символов.' };
|
||||
}
|
||||
if (!/^[A-Za-z0-9_]+$/.test(normalized)) {
|
||||
return { ok: false, error: 'Логин: разрешены только латиница, цифры и _.' };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const MIN_LEN = 3;
|
||||
const MIN_LEN = 4;
|
||||
const MAX_LEN = 32;
|
||||
const ALLOWED_CHARS_RE = /^[A-Za-z0-9_-]+$/;
|
||||
const DIGITS_ONLY_RE = /^[0-9]+$/;
|
||||
@@ -55,7 +55,7 @@ export function channelNameErrorText(code) {
|
||||
case 'blank':
|
||||
return 'Введите название канала.';
|
||||
case 'too_short':
|
||||
return 'Название слишком короткое: минимум 3 символа.';
|
||||
return 'Название слишком короткое: минимум 4 символа.';
|
||||
case 'too_long':
|
||||
return 'Название слишком длинное: максимум 32 символа.';
|
||||
case 'bad_chars':
|
||||
|
||||
@@ -1,19 +1,25 @@
|
||||
/** Расчёт минимального пополнения для перехода FREE_CERT → PAID. */
|
||||
/** Единая стоимость регистрации: цена namespace уже включает депозит PDA. */
|
||||
export const USER_PDA_SPACE = 768; // shine-solana/shine/programs/shine_users/src/settings.rs
|
||||
export const UPGRADE_NETWORK_RESERVE_LAMPORTS = 100_000; // запас на подписи/комиссию сети
|
||||
// Запас для предварительной проверки баланса; сеть списывает фактическую комиссию.
|
||||
export const REGISTRATION_NETWORK_RESERVE_LAMPORTS = 100_000n;
|
||||
export const UPGRADE_TEST_TOPUP_SOL = 0.02;
|
||||
export const LAMPORTS_PER_SOL = 1_000_000_000;
|
||||
|
||||
export function calculateUpgradeFunding({ namespaceFeeLamports, rentLamports }) {
|
||||
export function calculateRegistrationFunding({ namespaceFeeLamports, rentLamports }) {
|
||||
const namespaceFee = BigInt(namespaceFeeLamports);
|
||||
const rent = BigInt(rentLamports);
|
||||
if (namespaceFee < 0n || rent < 0n) throw new Error('Некорректная стоимость регистрации');
|
||||
const requiredLamports = namespaceFee + rent + BigInt(UPGRADE_NETWORK_RESERVE_LAMPORTS);
|
||||
// Рекомендуем небольшой запас на кошельке, но не ограничиваем 0.01 SOL без необходимости.
|
||||
const recommendedLamports = requiredLamports + 2_000_000n;
|
||||
return { requiredLamports, recommendedLamports, namespaceFee, rent };
|
||||
if (namespaceFee < rent) {
|
||||
throw new Error(`Цена namespace (${solFromLamports(namespaceFee)} SOL) меньше депозита PDA (${solFromLamports(rent)} SOL). Регистрация временно недоступна: обратитесь к администратору namespace.`);
|
||||
}
|
||||
const projectFee = namespaceFee - rent;
|
||||
const requiredLamports = namespaceFee + REGISTRATION_NETWORK_RESERVE_LAMPORTS;
|
||||
return { requiredLamports, namespaceFee, rent, projectFee, networkReserve: REGISTRATION_NETWORK_RESERVE_LAMPORTS };
|
||||
}
|
||||
|
||||
// Существующие потребители используют это имя; формула общая для обоих сценариев.
|
||||
export const calculateUpgradeFunding = calculateRegistrationFunding;
|
||||
|
||||
export function isUpgradeComplete(status) {
|
||||
// Старые серверы могут временно вернуть старые значения при последовательном развёртывании.
|
||||
return status === 'PAID' || status === 'PAID_DIRECT' || status === 'PAID_UPGRADED';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Общий бинарный протокол namespace PDA v1; используется платным create и upgrade.
|
||||
// Namespace PDA v1.0 (legacy) / v1.1 (валюта) для прямой регистрации и upgrade.
|
||||
import { sha256Bytes } from './crypto-utils.js';
|
||||
import { loadSolanaWeb3 } from '../vendor/solana-web3-loader.js';
|
||||
import { SHINE_USERS_PROGRAM_ID } from '../solana-programs.js';
|
||||
@@ -35,7 +35,7 @@ export function buildFreeCertificateInnerMessage(fullLogin, root32, blockchain32
|
||||
}
|
||||
export function decodeNamespacePda(data) {
|
||||
const bytes = new Uint8Array(data);
|
||||
if (bytes.length < 13 || bytes[0] !== 1 || bytes[1] !== 0 || (bytes[2] !== 1 && bytes[2] !== 2)) throw new Error('Неподдерживаемый namespace PDA');
|
||||
if (bytes.length < 13 || bytes[0] !== 1 || ![0, 1].includes(bytes[1]) || (bytes[2] !== 1 && bytes[2] !== 2)) throw new Error('Неподдерживаемый namespace PDA');
|
||||
const type = bytes[2], minLocalpartLength = bytes[3], len = bytes[4];
|
||||
if (len === 0 || 5 + len + 8 > bytes.length) throw new Error('Обрезанный namespace PDA');
|
||||
const namespace = dec.decode(bytes.slice(5, 5 + len));
|
||||
@@ -43,6 +43,8 @@ export function decodeNamespacePda(data) {
|
||||
if (minLocalpartLength < 1 || minLocalpartLength + len + 1 > 30) throw new Error('Недопустимая минимальная длина');
|
||||
const fee = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getBigUint64(5 + len, true);
|
||||
let offset = 5 + len + 8, registrarPublicKey32 = null, serverLogin = null;
|
||||
const currencyCode = bytes[1] === 1 ? bytes[offset++] : 1;
|
||||
if (currencyCode !== 1) throw new Error('Валюта namespace пока не поддерживается (разрешена только SOL)');
|
||||
if (type === 2) {
|
||||
if (bytes.length < offset + 33) throw new Error('В namespace типа 2 отсутствует ключ регистратора');
|
||||
registrarPublicKey32 = bytes.slice(offset, offset + 32); offset += 32;
|
||||
@@ -52,21 +54,23 @@ export function decodeNamespacePda(data) {
|
||||
offset += serverLen;
|
||||
}
|
||||
if (bytes.length !== offset) throw new Error('Лишние данные namespace PDA');
|
||||
return { namespace, type, minLocalpartLength, registrationFeeLamports: fee, registrarPublicKey32, serverLogin };
|
||||
return { namespace, type, minLocalpartLength, registrationFeeLamports: fee, currencyCode, registrarPublicKey32, serverLogin };
|
||||
}
|
||||
export function encodeNamespacePda({ namespace, type, minLocalpartLength, registrationFeeLamports, registrarPublicKey32, serverLogin }) {
|
||||
export function encodeNamespacePda({ namespace, type, minLocalpartLength, registrationFeeLamports, currencyCode = 1, registrarPublicKey32, serverLogin }) {
|
||||
const name = enc.encode(normalizeNamespace(namespace));
|
||||
if (!Number.isInteger(minLocalpartLength) || minLocalpartLength < 1 || minLocalpartLength + name.length + 1 > 30) throw new Error('Недопустимая длина локального логина');
|
||||
if (type !== 1 && type !== 2) throw new Error('Недопустимый тип namespace');
|
||||
if (currencyCode !== 1) throw new Error('Валюта namespace пока не поддерживается (разрешена только SOL)');
|
||||
const fee = BigInt(registrationFeeLamports);
|
||||
if (fee < 0n || fee > (2n ** 64n - 1n)) throw new Error('Неверная цена регистрации');
|
||||
const server = type === 2 ? enc.encode(normalizeFullLogin(serverLogin)) : new Uint8Array();
|
||||
const pub = type === 2 ? new Uint8Array(registrarPublicKey32) : new Uint8Array();
|
||||
if (type === 2 && pub.length !== 32) throw new Error('Ключ регистратора должен быть 32 байта');
|
||||
const out = new Uint8Array(5 + name.length + 8 + (type === 2 ? 32 + 1 + server.length : 0));
|
||||
out.set([1, 0, type, minLocalpartLength, name.length]); out.set(name, 5);
|
||||
const out = new Uint8Array(5 + name.length + 8 + 1 + (type === 2 ? 32 + 1 + server.length : 0));
|
||||
out.set([1, 1, type, minLocalpartLength, name.length]); out.set(name, 5);
|
||||
let offset = 5 + name.length;
|
||||
new DataView(out.buffer).setBigUint64(offset, fee, true); offset += 8;
|
||||
out[offset++] = currencyCode;
|
||||
if (type === 2) { out.set(pub, offset); offset += 32; out[offset++] = server.length; out.set(server, offset); }
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,14 @@ export function normalizeLogin(value = '') {
|
||||
return String(value || '').trim().replace(/^@+/, '');
|
||||
}
|
||||
|
||||
// Видимый адрес канала: <login>@<namespace>/<channel>, без декоративной @ перед логином.
|
||||
// Нормализуем только отображение, не меняем сохранённый идентификатор или URL.
|
||||
export function formatChannelAddress({ ownerLogin = '', channelName = '' } = {}) {
|
||||
const owner = normalizeLogin(ownerLogin);
|
||||
const channel = String(channelName || '').trim();
|
||||
return [owner, channel].filter(Boolean).join('/');
|
||||
}
|
||||
|
||||
export function extractLoginFromBlockchainName(value = '') {
|
||||
const raw = String(value || '').trim();
|
||||
const match = raw.match(/^(.+)-\d+$/);
|
||||
|
||||
@@ -46,11 +46,11 @@ export async function resolveShineServerByServerLogin({ serverLogin, solanaEndpo
|
||||
solanaEndpoint,
|
||||
});
|
||||
if (!parsed?.isServer) {
|
||||
throw new Error(`Логин @${cleanServerLogin} не опубликован как сервер Сияния.`);
|
||||
throw new Error(`Логин ${cleanServerLogin} не опубликован как сервер Сияния.`);
|
||||
}
|
||||
const serverAddress = normalizeHostLike(parsed?.serverAddress || '');
|
||||
if (!serverAddress) {
|
||||
throw new Error(`У server PDA пользователя @${cleanServerLogin} не задан server_address.`);
|
||||
throw new Error(`У server PDA пользователя ${cleanServerLogin} не задан server_address.`);
|
||||
}
|
||||
return {
|
||||
serverLogin: cleanServerLogin,
|
||||
@@ -73,7 +73,7 @@ export async function resolveShineServerForUserLogin({ login, solanaEndpoint, fa
|
||||
: [];
|
||||
const pickedServerLogin = accessServers[0] || normalizeShineServerLogin(fallbackServerLogin);
|
||||
if (!pickedServerLogin) {
|
||||
throw new Error(`У пользователя @${cleanLogin} в PDA не указан access server.`);
|
||||
throw new Error(`У пользователя ${cleanLogin} в PDA не указан access server.`);
|
||||
}
|
||||
const resolved = await resolveShineServerByServerLogin({
|
||||
serverLogin: pickedServerLogin,
|
||||
|
||||
@@ -473,7 +473,7 @@ export async function readShineUserPda({ login, solanaEndpoint }) {
|
||||
const [pda] = solana.PublicKey.findProgramAddressSync(
|
||||
cleanLogin.includes('@') ? [await userPdaSeed32(cleanLogin)] : [new TextEncoder().encode(SHINE_USERS_USER_PDA_SEED_PREFIX), new TextEncoder().encode(cleanLogin)], usersProgram);
|
||||
const info = await connection.getAccountInfo(pda, 'confirmed');
|
||||
if (!info?.data) throw new Error(`PDA пользователя @${cleanLogin} не найдена`);
|
||||
if (!info?.data) throw new Error(`PDA пользователя ${cleanLogin} не найдена`);
|
||||
return { ...parseShineUserPda(new Uint8Array(info.data)), userPda: pda.toBase58(), pdaAddress: pda.toBase58(), endpoint };
|
||||
}
|
||||
|
||||
|
||||
@@ -106,11 +106,12 @@ export function toUserMessage(error, fallback = 'Действие не выпо
|
||||
text.includes('channel name must match') ||
|
||||
text.includes('channelname contains unsupported') ||
|
||||
text.includes('channelname must not contain only digits') ||
|
||||
text.includes('channelname length must be 4..32') ||
|
||||
text.includes('channelname length must be 3..32') ||
|
||||
text.includes('channelname length must be 1..32') ||
|
||||
text.includes('bad_channel_name')
|
||||
) {
|
||||
return 'Некорректное название канала. Разрешены только латинские буквы, цифры, _ и -. Длина: 3..32. Название не должно состоять только из цифр.';
|
||||
return 'Некорректное название канала. Разрешены только латинские буквы, цифры, _ и -. Длина: 4..32. Название не должно состоять только из цифр.';
|
||||
}
|
||||
|
||||
if (text.includes('channel name is required') || text.includes('введите имя канала')) {
|
||||
|
||||
Reference in New Issue
Block a user