From 526941eb33a7853d7e794498e61bc06c4c94e6e3b694b3e3eebd2ea736a16f82 Mon Sep 17 00:00:00 2001 From: AidarKC Date: Mon, 9 Nov 2026 09:59:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BA=D0=BE=D1=88=D0=B5=D0=BB=D1=8C=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=B8=20=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=B4=D0=B5?= =?UTF-8?q?=D1=82=D0=B0=D0=BB=D0=B8=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION.properties | 2 +- .../PROFILE_DECLARATIONS_AND_CONSENT.md | 24 ++ shine-UI/js/app.js | 2 + shine-UI/js/components/channel-editor.js | 4 +- shine-UI/js/components/confirm-dialog.js | 13 + shine-UI/js/components/like-action-sheet.js | 31 ++- .../js/components/visible-password-field.js | 29 ++ .../js/pages/application-settings-view.js | 30 +++ shine-UI/js/pages/channel-thread-view.js | 28 +- shine-UI/js/pages/channel-view.js | 20 +- shine-UI/js/pages/key-rotation-view.js | 3 +- shine-UI/js/pages/login-password-view.js | 5 +- shine-UI/js/pages/network-view.js | 43 +-- shine-UI/js/pages/profile-edit-view.js | 9 +- shine-UI/js/pages/register-view.js | 18 +- .../js/pages/registration-payment-view.js | 4 +- shine-UI/js/pages/settings-view.js | 2 + shine-UI/js/pages/user-profile-view.js | 28 -- .../js/pages/user-relation-manage-view.js | 3 +- shine-UI/js/pages/wallet-view.js | 251 +++++++++++------- shine-UI/js/router.js | 1 + .../js/services/password-boundary-warning.js | 18 ++ .../js/services/public-history-consent.js | 36 +++ .../services/registration-upgrade-helpers.js | 2 +- shine-UI/styles/components/modal.css | 4 + shine-UI/styles/features/channel-thread.css | 2 + shine-UI/styles/features/channels-common.css | 4 + shine-UI/styles/features/preauth.css | 36 +++ shine-UI/styles/features/profile.css | 18 ++ 29 files changed, 469 insertions(+), 201 deletions(-) create mode 100644 shine-UI/js/components/visible-password-field.js create mode 100644 shine-UI/js/pages/application-settings-view.js create mode 100644 shine-UI/js/services/password-boundary-warning.js create mode 100644 shine-UI/js/services/public-history-consent.js diff --git a/VERSION.properties b/VERSION.properties index c99f1056..3008d3ad 100644 --- a/VERSION.properties +++ b/VERSION.properties @@ -1,2 +1,2 @@ -client.version=1.20.24 +client.version=1.20.25 server.version=1.16.19 diff --git a/docs/UI-Design/PROFILE_DECLARATIONS_AND_CONSENT.md b/docs/UI-Design/PROFILE_DECLARATIONS_AND_CONSENT.md index 95467d89..b15465e4 100644 --- a/docs/UI-Design/PROFILE_DECLARATIONS_AND_CONSENT.md +++ b/docs/UI-Design/PROFILE_DECLARATIONS_AND_CONSENT.md @@ -43,3 +43,27 @@ - `shine-UI/js/components/confirm-dialog.js` и стили — корректное расположение модального окна поверх редактора. Форматы блоков, Java API и серверная логика не менялись. + + +## 5. Поведение предупреждений и локальные настройки (09.11.2026) + +- Предупреждения перед обычными публичными действиями (публикации и правки, лайки, + смена аватара, изменение полей профиля и обычных социальных связей) теперь предлагают + **необязательную** галочку «Я понимаю…» о будущих действиях. При подтверждении с + галочкой предупреждение больше не появляется для этого аккаунта в этом браузере. +- Без галочки предупреждение показывается при каждом новом публичном действии. Отказ от + публикации **не** сохраняет предпочтение. Предупреждения включены по умолчанию. +- Настройку можно изменить на экране «Настройки → Настройки приложения»: + «Показывать предупреждение о публичных записях». +- Хранится в `shine-device-prefs-v1` через `public-history-consent.js`, отдельно для + каждого логина и устройства. Очистка данных браузера сбрасывает выбор. +- Не отключаются подтверждения опасных операций, удалений и деклараций статуса + «Официальный» / «Сияющий», а также ответственность при подтверждении других людей. +- Лайк с отключёнными предупреждениями выполняется одним нажатием; лист подробных + категорий лайков доступен отдельным нажатием на число лайков (независимо от настройки). +- При регистрации и в начале смены ключей пароли, начинающиеся или оканчивающиеся + пробелом, разрешены **после явного подтверждения**. Введённые пробелы никогда не + обрезаются, вход уже зарегистрированных пользователей не изменяется. +- Локальные заметки о людях скрыты из профиля и экрана связей; старые данные в + localStorage не удаляются. +- Редактор собственного профиля показывает официальный знак и ауру сияющего на аватаре. diff --git a/shine-UI/js/app.js b/shine-UI/js/app.js index eedcae21..e3a05d3b 100644 --- a/shine-UI/js/app.js +++ b/shine-UI/js/app.js @@ -108,6 +108,7 @@ import * as clientSessionView from './pages/device-session-view.js?v=20260613143 import * as languageView from './pages/language-view.js'; import * as appearanceView from './pages/appearance-view.js'; import * as notificationSettingsView from './pages/notification-settings-view.js'; +import * as applicationSettingsView from './pages/application-settings-view.js'; import * as appLogView from './pages/app-log-view.js'; import * as pwaDiagnosticsView from './pages/pwa-diagnostics-view.js'; import * as solanaUsersInitView from './pages/solana-users-init-view.js'; @@ -192,6 +193,7 @@ const routes = { 'language-view': languageView, 'appearance-view': appearanceView, 'notification-settings-view': notificationSettingsView, + 'application-settings-view': applicationSettingsView, 'app-log-view': appLogView, 'pwa-diagnostics-view': pwaDiagnosticsView, 'solana-users-init-view': solanaUsersInitView, diff --git a/shine-UI/js/components/channel-editor.js b/shine-UI/js/components/channel-editor.js index d563ce51..8054c20d 100644 --- a/shine-UI/js/components/channel-editor.js +++ b/shine-UI/js/components/channel-editor.js @@ -1,5 +1,5 @@ import { iconHtml } from './ui-icon.js'; -import { confirmDialog } from './confirm-dialog.js'; +import { confirmPublicHistoryAction } from '../services/public-history-consent.js'; import { markArweaveAttachmentPlaced } from './arweave-attachment-manager.js'; import { openChannelAttachmentManager } from './channel-attachment-manager.js'; import { composeMessageWithAttachments, MAX_MESSAGE_ATTACHMENTS } from '../services/attachment-format.js'; @@ -340,7 +340,7 @@ export function openChannelEditor({ submitButton.textContent = 'Отправляем…'; sync(); try { - const accepted = await confirmDialog({ + const accepted = await confirmPublicHistoryAction({ title: 'Записать в публичную историю?', aboveEditor: true, text: 'Эта публикация, ответ или изменение будут записаны в блокчейн. Запись может сохраняться постоянно, включая историю правок и удаления. Если передумали, выберите «Вернуться к черновику».', diff --git a/shine-UI/js/components/confirm-dialog.js b/shine-UI/js/components/confirm-dialog.js index 974d1da7..8cb9b1bd 100644 --- a/shine-UI/js/components/confirm-dialog.js +++ b/shine-UI/js/components/confirm-dialog.js @@ -6,6 +6,7 @@ export function confirmDialog({ cancelLabel = 'Отмена', danger = false, aboveEditor = false, + rememberChoice = null, } = {}) { return new Promise((resolve) => { const opener = document.activeElement; @@ -25,6 +26,17 @@ export function confirmDialog({ const textEl = modal.querySelector('.confirm-dialog__text'); textEl.textContent = text; textEl.hidden = !text; + let rememberCheckbox = null; + if (rememberChoice?.label) { + const label = document.createElement('label'); + label.className = 'confirm-dialog__remember'; + rememberCheckbox = document.createElement('input'); + rememberCheckbox.type = 'checkbox'; + const explanation = document.createElement('span'); + explanation.textContent = rememberChoice.label; + label.append(rememberCheckbox, explanation); + modal.querySelector('.form-actions-grid').before(label); + } modal.querySelector('[data-answer="no"]').textContent = cancelLabel; modal.querySelector('[data-answer="yes"]').textContent = confirmLabel; @@ -32,6 +44,7 @@ export function confirmDialog({ document.removeEventListener('keydown', onKeydown, true); modal.remove(); opener?.focus?.(); + if (answer && rememberCheckbox?.checked) rememberChoice?.onConfirm?.(); resolve(answer); }; const onKeydown = (event) => { diff --git a/shine-UI/js/components/like-action-sheet.js b/shine-UI/js/components/like-action-sheet.js index e942b831..4e92c2ee 100644 --- a/shine-UI/js/components/like-action-sheet.js +++ b/shine-UI/js/components/like-action-sheet.js @@ -1,3 +1,4 @@ +import { getShowPublicHistoryWarning, setShowPublicHistoryWarning, PUBLIC_HISTORY_REMEMBER_LABEL } from '../services/public-history-consent.js'; import { openSheet } from './sheet.js'; function safeCount(raw, maximum = Infinity) { @@ -6,7 +7,17 @@ function safeCount(raw, maximum = Infinity) { } // Значения счётчиков получены от сервера, это не криптографическая аттестация личности. -export function confirmLikeAction({ liked = false, counts = {}, onViewList = null } = {}) { +export function confirmLikeAction(options = {}) { + if (!getShowPublicHistoryWarning()) return Promise.resolve(true); + return openLikeSheet(options); +} + +// Просмотр счётчиков не является действием в блокчейне и не спрашивает согласие. +export function showLikeStatistics({ counts = {}, onViewList = null } = {}) { + return openLikeSheet({ counts, onViewList, readOnly: true }); +} + +function openLikeSheet({ liked = false, counts = {}, onViewList = null, readOnly = false } = {}) { return new Promise((resolve) => { let accepted = false; const all = safeCount(counts.all ?? counts.likesCount); @@ -43,20 +54,30 @@ export function confirmLikeAction({ liked = false, counts = {}, onViewList = nul const warning = document.createElement('p'); warning.className = 'meta-muted'; warning.textContent = 'Добавление и отмена лайка создают записи в публичной истории блокчейна. Даже отменённый лайк может остаться в истории.'; + const rememberLabel = document.createElement('label'); + rememberLabel.className = 'confirm-dialog__remember'; + const remember = document.createElement('input'); + remember.type = 'checkbox'; + const rememberText = document.createElement('span'); + rememberText.textContent = PUBLIC_HISTORY_REMEMBER_LABEL; + rememberLabel.append(remember, rememberText); const actions = document.createElement('div'); actions.className = 'form-actions-grid'; const cancel = document.createElement('button'); cancel.type = 'button'; cancel.className = 'secondary-btn'; - cancel.textContent = 'Не менять'; + cancel.textContent = readOnly ? 'Закрыть' : 'Не менять'; const confirm = document.createElement('button'); confirm.type = 'button'; confirm.className = 'primary-btn'; confirm.textContent = liked ? 'Убрать мой лайк' : 'Добавить мой лайк'; - actions.append(cancel, confirm); - body.append(intro, grid, warning, actions); + if (readOnly) actions.append(cancel); + else actions.append(cancel, confirm); + body.append(intro, grid); + if (!readOnly) body.append(warning, rememberLabel); + body.append(actions); const sheet = openSheet({ title: 'Лайки', className: 'like-consent-sheet', content: body, onClose: () => resolve(accepted) }); cancel.addEventListener('click', () => sheet.close()); - confirm.addEventListener('click', () => { accepted = true; sheet.close(); }); + confirm.addEventListener('click', () => { if (remember.checked) setShowPublicHistoryWarning(false); accepted = true; sheet.close(); }); }); } diff --git a/shine-UI/js/components/visible-password-field.js b/shine-UI/js/components/visible-password-field.js new file mode 100644 index 00000000..91907831 --- /dev/null +++ b/shine-UI/js/components/visible-password-field.js @@ -0,0 +1,29 @@ +import { iconHtml } from './ui-icon.js'; + +/** The password is intentionally visible initially on both auth screens. */ +export function createVisiblePasswordField(input) { + input.type = 'text'; + const wrap = document.createElement('div'); + wrap.className = 'auth-password-field'; + const toggle = document.createElement('button'); + toggle.type = 'button'; + toggle.className = 'auth-password-field__toggle'; + function updateToggle() { + const visible = input.type !== 'password'; + toggle.innerHTML = iconHtml(visible ? 'eyeOff' : 'eye', false, 'key-toggle-icon'); + toggle.setAttribute('aria-label', visible ? 'Скрыть пароль' : 'Показать пароль'); + toggle.setAttribute('title', visible ? 'Скрыть пароль' : 'Показать пароль'); + toggle.setAttribute('aria-pressed', String(!visible)); + } + toggle.addEventListener('click', () => { + const start = input.selectionStart; + const end = input.selectionEnd; + input.type = input.type === 'password' ? 'text' : 'password'; + updateToggle(); + input.focus(); + try { if (start !== null && end !== null) input.setSelectionRange(start, end); } catch { /* unsupported input method */ } + }); + updateToggle(); + wrap.append(input, toggle); + return wrap; +} diff --git a/shine-UI/js/pages/application-settings-view.js b/shine-UI/js/pages/application-settings-view.js new file mode 100644 index 00000000..e2d90ccb --- /dev/null +++ b/shine-UI/js/pages/application-settings-view.js @@ -0,0 +1,30 @@ +import { createTopBar } from '../components/topbar.js'; +import { getShowPublicHistoryWarning, setShowPublicHistoryWarning } from '../services/public-history-consent.js'; + +export const pageMeta = { id: 'application-settings-view', title: 'Настройки приложения' }; + +export function render({ navigate, chrome }) { + const screen = document.createElement('section'); + screen.className = 'stack'; + chrome?.setTopbar(createTopBar({ + title: 'Настройки приложения', + back: { label: '←', onClick: () => navigate('settings-view') }, + })); + const section = document.createElement('div'); + section.className = 'nav-list'; + const row = document.createElement('label'); + row.className = 'nav-row nav-row--switch'; + row.innerHTML = ` + + Показывать предупреждение о публичных записях + Сообщения, лайки и другие публичные действия могут сохраняться в блокчейне навсегда. Настройка действует для этого аккаунта на этом устройстве. + + + `; + const input = row.querySelector('input'); + input.checked = getShowPublicHistoryWarning(); + input.addEventListener('change', () => setShowPublicHistoryWarning(input.checked)); + section.append(row); + screen.append(section); + return screen; +} diff --git a/shine-UI/js/pages/channel-thread-view.js b/shine-UI/js/pages/channel-thread-view.js index 8ff0422b..7597434f 100644 --- a/shine-UI/js/pages/channel-thread-view.js +++ b/shine-UI/js/pages/channel-thread-view.js @@ -1,6 +1,6 @@ import { appendShineMessageLinks } from '../services/shine-message-links.js'; import { confirmDialog } from '../components/confirm-dialog.js'; -import { confirmLikeAction } from '../components/like-action-sheet.js'; +import { confirmLikeAction, showLikeStatistics } from '../components/like-action-sheet.js'; import { iconHtml } from '../components/ui-icon.js'; import { consumeReplyEditorOnOpen, rememberChannelPosition, readChannelPosition, restoreChannelPosition } from '../services/channel-view-state.js'; import { attachMessageMenu } from '../components/message-menu.js'; @@ -839,7 +839,6 @@ function renderNodeCard(node, heading, handlers, localNumber, { focusPost = fals likeButton.innerHTML = ` ${isPending ? 'Лайк...' : 'Лайк'} - ${Number(likes) > 0 ? likes : ''} `; likeButton.setAttribute('aria-pressed', String(isLiked)); setActionTitle(likeButton, isPending ? 'Лайк…' : `${isLiked ? 'Убрать отметку «Нравится»' : 'Нравится'}, ${likes}`); @@ -864,6 +863,16 @@ function renderNodeCard(node, heading, handlers, localNumber, { focusPost = fals } }); + const likesStatsButton = document.createElement('button'); + likesStatsButton.type = 'button'; + likesStatsButton.className = 'ui-button channel-action-item channel-action-like-stats'; + likesStatsButton.textContent = String(Number(likes) || ''); + likesStatsButton.setAttribute('aria-label', `Посмотреть статистику лайков: ${likes}`); + likesStatsButton.addEventListener('click', (event) => { + event.stopPropagation(); + void showLikeStatistics({ counts: node }); + }); + const replyButton = document.createElement('button'); replyButton.type = 'button'; replyButton.className = 'ui-button channel-action-item thread-reply-btn'; @@ -941,8 +950,8 @@ function renderNodeCard(node, heading, handlers, localNumber, { focusPost = fals if (!REPOSTS_ENABLED) { notifyRepostSoon(); return; } void handlers.onRepost?.(target); }); - if (threadsLayout) actions.append(likeButton, discussionButton, repostButton, shareButton); - else actions.append(likeButton, shareButton, discussionButton); + if (threadsLayout) actions.append(likeButton, ...(likes > 0 ? [likesStatsButton] : []), discussionButton, repostButton, shareButton); + else actions.append(likeButton, ...(likes > 0 ? [likesStatsButton] : []), shareButton, discussionButton); menuItems.unshift({ label: 'Ответить', iconHtml: iconHtml('reply'), action: () => replyButton.click() }); // Те же действия, что у ответов в обсуждении. menuItems.splice(1, 0, { label: 'Скопировать текст', iconHtml: iconHtml('copy'), action: async () => { @@ -1171,7 +1180,7 @@ function renderComment({ node, parent, focus, channelOwner, handlers, nested = f const like = document.createElement('button'); like.type = 'button'; like.className = `channel-action-item thread-comment__like${liked ? ' is-liked' : ''}`; - like.innerHTML = `${iconHtml('heart', liked)}${likes || ''}`; + like.innerHTML = `${iconHtml('heart', liked)}`; like.setAttribute('aria-pressed', String(liked)); like.setAttribute('aria-label', `${liked ? 'Убрать отметку «Нравится»' : 'Нравится'}, ${likes}`); like.addEventListener('click', async () => { @@ -1181,6 +1190,13 @@ function renderComment({ node, parent, focus, channelOwner, handlers, nested = f finally { if (like.isConnected) like.disabled = false; } }); + const commentLikeStats = document.createElement('button'); + commentLikeStats.type = 'button'; + commentLikeStats.className = 'channel-action-item thread-comment__like-count'; + commentLikeStats.textContent = String(likes || ''); + commentLikeStats.setAttribute('aria-label', `Статистика лайков: ${likes}`); + commentLikeStats.addEventListener('click', () => { void showLikeStatistics({ counts: node }); }); + const replies = replyCountOf(node); const reply = document.createElement('button'); reply.type = 'button'; @@ -1238,7 +1254,7 @@ function renderComment({ node, parent, focus, channelOwner, handlers, nested = f repost.addEventListener('click', () => (REPOSTS_ENABLED ? handlers.onRepost?.(target) : notifyRepostSoon())); // Ряд действий как у записи канала: лайк, ответы, репост, поделиться. - actions.append(like, reply, repost, share); + actions.append(like, ...(likes > 0 ? [commentLikeStats] : []), reply, repost, share); main.append(actions); item.append(who, main); // Как в Threads: нажатие на ответ открывает его обсуждение (кнопки, ссылки и вложения работают сами по себе). diff --git a/shine-UI/js/pages/channel-view.js b/shine-UI/js/pages/channel-view.js index 0cec09f1..c7f25de3 100644 --- a/shine-UI/js/pages/channel-view.js +++ b/shine-UI/js/pages/channel-view.js @@ -1,6 +1,6 @@ import { appendShineMessageLinks } from '../services/shine-message-links.js'; import { confirmDialog } from '../components/confirm-dialog.js'; -import { confirmLikeAction } from '../components/like-action-sheet.js'; +import { confirmLikeAction, showLikeStatistics } from '../components/like-action-sheet.js'; import { iconHtml } from '../components/ui-icon.js'; import { createOverflowDots } from '../components/overflow-dots.js'; import { rememberChannelPosition, readChannelPosition, requestReplyEditorOnOpen, restoreChannelPosition } from '../services/channel-view-state.js'; @@ -2014,7 +2014,6 @@ function renderPostCard(post, { likeButton.innerHTML = ` ${isPending ? 'Лайк...' : 'Лайк'} - ${post.likesCount || ''} `; likeButton.setAttribute('aria-pressed', String(isLiked)); setActionTitle(likeButton, isPending ? 'Лайк…' : `${isLiked ? 'Убрать отметку «Нравится»' : 'Нравится'}, ${post.likesCount || 0}`); @@ -2033,6 +2032,19 @@ function renderPostCard(post, { } }); + const likesStatsButton = document.createElement('button'); + likesStatsButton.type = 'button'; + likesStatsButton.className = 'ui-button channel-action-item channel-action-like-stats'; + likesStatsButton.textContent = String(Number(post.likesCount) || ''); + likesStatsButton.setAttribute('aria-label', `Посмотреть статистику и список лайков: ${Number(post.likesCount) || 0}`); + likesStatsButton.addEventListener('click', (event) => { + event.stopPropagation(); + void showLikeStatistics({ + counts: post, + onViewList: (tab) => openMessageLikesListModal({ navigate, messageRef: post.messageRef, initialTab: tab }), + }); + }); + // Сервер считает только прямые ответы; полное число по всем уровням берём из обсуждения (кэш или подгрузка). if (Number(post.repliesCount || 0) > 0) { const threadRoute = buildThreadRoute(post, selector); @@ -2140,8 +2152,8 @@ function renderPostCard(post, { void onRepost?.(post.messageRef); }); // Четыре кнопки как в Threads: лайк, ответы, репост, поделиться. - if (threadsLayout) actions.append(likeButton, discussionButton, repostButton, shareButton); - else actions.append(likeButton, shareButton, discussionButton); + if (threadsLayout) actions.append(likeButton, ...(Number(post.likesCount) > 0 ? [likesStatsButton] : []), discussionButton, repostButton, shareButton); + else actions.append(likeButton, ...(Number(post.likesCount) > 0 ? [likesStatsButton] : []), shareButton, discussionButton); if (selector?.publicOrdinalUrlsAllowed && post.messageRef?.blockNumber != null) { const streamRoute = makeShineChannelStreamRoute({ ownerBlockchainName: selector?.ownerBlockchainName, diff --git a/shine-UI/js/pages/key-rotation-view.js b/shine-UI/js/pages/key-rotation-view.js index 46f0aed2..691c50ee 100644 --- a/shine-UI/js/pages/key-rotation-view.js +++ b/shine-UI/js/pages/key-rotation-view.js @@ -1,4 +1,5 @@ import { createTopBar } from '../components/topbar.js'; +import { confirmPasswordBoundarySpaces } from '../services/password-boundary-warning.js'; import { authService, state } from '../state.js'; import { bytesToBase64 } from '../services/crypto-utils.js'; import { readShineUserPda } from '../services/shine-user-pda-service.js'; @@ -50,7 +51,7 @@ export function render({navigate,chrome}){ more.addEventListener('click',()=>void load()); const start=document.createElement('button');start.className='primary-btn';start.type='button';start.textContent='Начать смену ключей'; const error=document.createElement('div');error.className='meta-muted'; - start.addEventListener('click',async()=>{start.disabled=true;error.textContent='';try{if(!selected)throw new Error('Выберите последний доверенный блок');if(!oldP.el.value||!newP.el.value)throw new Error('Введите текущий и новый пароль');if(newP.el.value!==new2.el.value)throw new Error('Новые пароли не совпадают');if(oldP.el.value===newP.el.value)throw new Error('Новый пароль должен отличаться');if(!window.confirm('После запуска все остальные сеансы этого аккаунта будут закрыты. Продолжить?')){start.disabled=false;return;}cachedOldBundle=await derive(oldP.el.value);await verifyOldPassword(cachedOldBundle);cachedNewBundle=await derive(newP.el.value);const stateNow=await client.start({newRootKey:cachedNewBundle.rootPair.publicKeyB64,newBlockchainKey:cachedNewBundle.blockchainPair.publicKeyB64,newClientKey:cachedNewBundle.clientPair.publicKeyB64,forkFromBlock:selected.blockNumber,forkFromHash:selected.blockHash,reasonCode:Number(reason.value),comment:comment.value});updateTopbar(stateNow.rotationStatus);await runCopy(stateNow); }catch(e){error.textContent=e?.message||String(e);start.disabled=false;}}); + start.addEventListener('click',async()=>{start.disabled=true;error.textContent='';try{if(!selected)throw new Error('Выберите последний доверенный блок');if(!oldP.el.value||!newP.el.value)throw new Error('Введите текущий и новый пароль');if(newP.el.value!==new2.el.value)throw new Error('Новые пароли не совпадают');if(oldP.el.value===newP.el.value)throw new Error('Новый пароль должен отличаться');if(!await confirmPasswordBoundarySpaces(newP.el.value)){start.disabled=false;return;}if(!window.confirm('После запуска все остальные сеансы этого аккаунта будут закрыты. Продолжить?')){start.disabled=false;return;}cachedOldBundle=await derive(oldP.el.value);await verifyOldPassword(cachedOldBundle);cachedNewBundle=await derive(newP.el.value);const stateNow=await client.start({newRootKey:cachedNewBundle.rootPair.publicKeyB64,newBlockchainKey:cachedNewBundle.blockchainPair.publicKeyB64,newClientKey:cachedNewBundle.clientPair.publicKeyB64,forkFromBlock:selected.blockNumber,forkFromHash:selected.blockHash,reasonCode:Number(reason.value),comment:comment.value});updateTopbar(stateNow.rotationStatus);await runCopy(stateNow); }catch(e){error.textContent=e?.message||String(e);start.disabled=false;}}); setRoot(head,oldP.wrap,newP.wrap,new2.wrap,reasonWrap,comment,list,more,start,error);void load(); } diff --git a/shine-UI/js/pages/login-password-view.js b/shine-UI/js/pages/login-password-view.js index e897c6a4..34b2c1ed 100644 --- a/shine-UI/js/pages/login-password-view.js +++ b/shine-UI/js/pages/login-password-view.js @@ -1,4 +1,5 @@ import { createTopBar } from '../components/topbar.js'; +import { createVisiblePasswordField } from '../components/visible-password-field.js'; import { authService, authorizeSession, @@ -69,7 +70,7 @@ export function render({ navigate }) { const passwordInput = document.createElement('input'); passwordInput.className = 'input'; - passwordInput.type = 'password'; + passwordInput.type = 'text'; passwordInput.name = 'shine-login-password'; passwordInput.autocomplete = 'current-password'; passwordInput.autocapitalize = 'off'; @@ -78,7 +79,7 @@ export function render({ navigate }) { passwordInput.placeholder = 'Пароль'; passwordInput.value = ''; - passwordField.append(passwordInput); + passwordField.append(createVisiblePasswordField(passwordInput)); const status = document.createElement('p'); status.className = 'status-line is-unavailable'; diff --git a/shine-UI/js/pages/network-view.js b/shine-UI/js/pages/network-view.js index c2097aa8..82f3b325 100644 --- a/shine-UI/js/pages/network-view.js +++ b/shine-UI/js/pages/network-view.js @@ -1,6 +1,6 @@ // Экран «Связи»: люди вокруг выбранного человека – картой или списком. // Данные – GetUserConnectionsGraph (только чтение). Карту рисует graph-canvas.js, здесь – -// состав (центр, раскрытые связи), фильтры, поиск, список, карточка человека и заметки. +// состав (центр, раскрытые связи), фильтры, поиск, список, карточка человека. // «Компании», «Интересы» и «Города»: знакомства, подписки и города людей первого круга // собираются по одному запросу на человека (network/people-data-store.js), группы считает // network/communities.js, свои названия компаний и ручные переносы – network/companies-store.js. @@ -20,8 +20,6 @@ import { userDisplayName } from '../services/user-display.js'; import { showToast } from '../services/channels-ux.js'; import { actionErrorText, toUserMessage } from '../services/ui-error-texts.js'; import { matchesPeopleQuery } from '../services/people-search.js'; -import { PEOPLE_NOTES_EVENT, getAllPersonNotes } from '../services/people-notes.js'; -import { createPersonNotePreview, openPersonNoteSheet } from '../components/person-note-sheet.js'; import { createGraphCanvas } from './network/graph-canvas.js'; import { peopleFromGraphModel, relationTypeFromRelation } from './network/adapter.js'; import { REST_GROUP, buildCityGroups, buildCompanies, buildInterestGroups, tieWeight } from './network/communities.js'; @@ -194,7 +192,6 @@ const FILTERS = [ { id: 'close', label: 'Близкие', direct: true, pred: (node) => node.relationType === 'close_friend' || node.relationType === 'family' }, { id: 'friends', label: 'Друзья', direct: true, pred: (node) => node.relationType === 'friend' }, { id: 'shining', label: 'Сияющие', pred: (node) => Boolean(node.shining) }, - { id: 'notes', label: 'С заметкой', pred: (node) => Boolean(node.mark || node.hasNote) }, ]; const FILTER_BY_ID = new Map(FILTERS.map((filter) => [filter.id, filter])); @@ -230,15 +227,14 @@ function tieWeights(ties, ids) { return weights; } -function composeMap(centerLogin, graphs, expanded, notes, ties = null) { +function composeMap(centerLogin, graphs, expanded, ties = null) { const centerKey = normKey(centerLogin); const centerModel = graphs.get(centerKey); if (!centerModel) return null; const byId = new Map(); const edges = []; const add = (node) => { - const note = notes.get(node.id); - byId.set(node.id, { ...node, mark: note?.mark || '', hasNote: Boolean(note?.text?.trim()), hiddenCount: 0 }); + byId.set(node.id, { ...node, hiddenCount: 0 }); }; const { center, peers } = peopleFromGraphModel(centerModel); @@ -313,7 +309,6 @@ export function render({ navigate, route, chrome } = {}) { let viewMode = getViewSetting('view', 'map') === 'list' ? 'list' : 'map'; const LIST_SORTS = ['closeness', 'companies', 'interests', 'cities', 'name']; let listSort = LIST_SORTS.includes(getViewSetting('listSort', 'closeness')) ? getViewSetting('listSort', 'closeness') : 'closeness'; - let notes = getAllPersonNotes(); const graphs = new Map(); const expanding = new Set(); let map = null; @@ -321,7 +316,6 @@ export function render({ navigate, route, chrome } = {}) { let disposed = false; let loadSeq = 0; let loadError = null; - let noteSheet = null; let legendSheet = null; let search = null; // { query, topbar, layer, remote: { seq, query, items, loading, failed } } let groupsModel = null; // острова «Компаний» / «Интересов»: { lens, groups, byId, byPerson } @@ -443,7 +437,7 @@ export function render({ navigate, route, chrome } = {}) { let listFrame = 0; function renderMap({ fit = false, relayout = false } = {}) { if (disposed) return; - map = composeMap(centerLogin, graphs, expanded, notes, getTies(normKey(centerLogin))); + map = composeMap(centerLogin, graphs, expanded, getTies(normKey(centerLogin))); if (!map) return; // Фильтры должны быть на месте до вписывания карты: от них зависит свободная часть экрана. screen.classList.toggle('is-blank', map.nodes.length <= 1); @@ -494,7 +488,7 @@ export function render({ navigate, route, chrome } = {}) { const button = document.createElement('button'); button.type = 'button'; const relation = node.id === map.focusId ? 'в центре карты' : (RELATION_LABEL[node.relationType] || 'Связь').toLowerCase(); - button.textContent = `${node.name}, ${relation}${node.shining ? ', сияющий' : ''}${node.mark || node.hasNote ? ', есть заметка' : ''}`; + button.textContent = `${node.name}, ${relation}${node.shining ? ', сияющий' : ''}`; button.addEventListener('click', () => selectNode(node.id, { reveal: true })); li.append(button); a11yList.append(li); @@ -640,7 +634,7 @@ export function render({ navigate, route, chrome } = {}) { function collapseNode(id) { expanded.delete(id); for (;;) { - const next = composeMap(centerLogin, graphs, expanded, notes); + const next = composeMap(centerLogin, graphs, expanded); const orphan = [...expanded].find((key) => !next?.byId.has(key)); if (!orphan) break; expanded.delete(orphan); @@ -809,9 +803,6 @@ export function render({ navigate, route, chrome } = {}) { card.append(row); } - const note = isSelf ? null : notes.get(node.id); - const notePreview = createPersonNotePreview(note, { className: 'net-card__note', onClick: () => openNoteEditor(node) }); - if (notePreview) card.append(notePreview); const actions = document.createElement('div'); actions.className = 'net-card__actions'; @@ -829,7 +820,6 @@ export function render({ navigate, route, chrome } = {}) { })); if (!isSelf) { actions.append(cardAction('message', 'Написать', () => navigate(`chat/${encodeURIComponent(node.login)}`))); - actions.append(cardAction('edit', 'Заметка', () => openNoteEditor(node))); } card.append(actions); if (node.hiddenCount > 0) { @@ -842,17 +832,6 @@ export function render({ navigate, route, chrome } = {}) { placeOverlays(); } - // --- заметка --- - function openNoteEditor(node) { - noteSheet?.close(); - noteSheet = openPersonNoteSheet({ login: node.id, name: node.name, onClose: () => { noteSheet = null; } }); - } - - function onNotesChanged() { - notes = getAllPersonNotes(); - renderMap(); - } - window.addEventListener(PEOPLE_NOTES_EVENT, onNotesChanged); // --- обозначения --- function openLegend() { @@ -870,7 +849,6 @@ export function render({ navigate, route, chrome } = {}) { ['dash', 'friend', 'Пунктир → точки – вы добавили друга, ответа пока нет'], ['aura', '', 'Свечение вокруг – сияющий'], ['badge', '', 'Синяя галочка – официальный аккаунт'], - ['mark', '', 'Цветная точка – ваша заметка или метка'], ]; for (const [kind, type, text] of rows) { const li = document.createElement('li'); @@ -1809,7 +1787,6 @@ export function render({ navigate, route, chrome } = {}) { const PRIMARY_FILTERS = ['all', 'close', 'friends']; const EXTRA_FILTERS = [ { id: 'shining', short: 'Сияющие', icon: 'sparkle' }, - { id: 'notes', short: 'С заметкой', icon: 'edit' }, ]; const filterBar = document.createElement('div'); filterBar.className = 'net-filters'; @@ -2033,7 +2010,6 @@ export function render({ navigate, route, chrome } = {}) { if (!node) return []; return [ { label: 'Профиль', iconHtml: iconHtml('profile'), action: () => navigate(profileRoute(node.login)) }, - { label: 'Заметка', iconHtml: iconHtml('edit'), action: () => openNoteEditor(node) }, { label: 'Показать на карте', iconHtml: iconHtml('network'), action: () => showOnMap(node.id) }, { label: 'Его связи', iconHtml: iconHtml('focus'), action: () => recenter(node.login) }, ]; @@ -2063,7 +2039,6 @@ 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 (node.tier > 1) { @@ -2082,8 +2057,6 @@ export function render({ navigate, route, chrome } = {}) { avatar: node.avatar, official: node.official, sub: sub.join(' · '), - note: note?.text?.trim() ? note.text.trim().split('\n')[0] : '', - markColor: note?.mark || (note?.text?.trim() ? 'note' : ''), ring: node.shining ? 'shining' : (node.relationType === 'close_friend' && node.tier === 1 ? 'close' : ''), tag: '', onClick: onOpen || (() => { @@ -2326,7 +2299,7 @@ export function render({ navigate, route, chrome } = {}) { function onKeydown(event) { const typing = event.target instanceof HTMLElement && event.target.closest('input, textarea, [contenteditable="true"]'); - const overlayOpen = Boolean(noteSheet || legendSheet || groupSheet || document.querySelector('.dropdown-portal, .modal')); + const overlayOpen = Boolean(legendSheet || groupSheet || document.querySelector('.dropdown-portal, .modal')); if (event.key === 'Escape') { if (overlayOpen || search) return; if (selectedId) selectNode(''); @@ -2384,11 +2357,9 @@ export function render({ navigate, route, chrome } = {}) { moreMenu.destroy(); window.cancelAnimationFrame(listFrame); window.clearTimeout(remoteTimer); - window.removeEventListener(PEOPLE_NOTES_EVENT, onNotesChanged); window.removeEventListener(CONNECTIONS_GRAPH_CHANGED, refreshConnectionsView); window.clearInterval(graphRefreshTimer); document.removeEventListener('keydown', onKeydown); - noteSheet?.close(); legendSheet?.close(); groupSheet?.close(); if (search) { diff --git a/shine-UI/js/pages/profile-edit-view.js b/shine-UI/js/pages/profile-edit-view.js index 43bc8df9..77141e07 100644 --- a/shine-UI/js/pages/profile-edit-view.js +++ b/shine-UI/js/pages/profile-edit-view.js @@ -1,5 +1,6 @@ import { createTopBar } from '../components/topbar.js'; import { confirmDialog } from '../components/confirm-dialog.js'; +import { confirmPublicHistoryAction } from '../services/public-history-consent.js'; import { confirmConsentSteps } from '../components/consent-steps.js'; import { actionErrorText, toUserMessage } from '../services/ui-error-texts.js'; import { showToast } from '../services/channels-ux.js'; @@ -210,6 +211,7 @@ export function render({ navigate, chrome }) { const firstName = String(currentFields.find((field) => field.key === 'first_name')?.value || '').trim(); const lastName = String(currentFields.find((field) => field.key === 'last_name')?.value || '').trim(); avatarSlotEl.innerHTML = ''; + avatarSlotEl.classList.toggle('is-shining', currentShineStatus === PROFILE_SHINE_SHINING); avatarSlotEl.append(renderUserAvatar({ login, firstName, @@ -220,6 +222,7 @@ export function render({ navigate, chrome }) { size: 'xl', // Как в карточке профиля: без стеклянного кольца, которое вылезало за край экрана. className: 'profile-avatar avatar-plain', + official: currentAccountRole === PROFILE_ACCOUNT_ROLE_PRIMARY, })); } @@ -368,7 +371,7 @@ export function render({ navigate, chrome }) { } async function onChangeAvatarClick() { - const accepted = await confirmDialog({ + const accepted = await confirmPublicHistoryAction({ title: 'Публичная история аватара', text: 'Новый аватар и ссылка на него могут остаться доступны в публичной истории даже после замены. Продолжить к выбору аватара?', confirmLabel: 'Выбрать аватар', @@ -483,7 +486,7 @@ export function render({ navigate, chrome }) { } if (String(entered).trim() === String(field.value || '').trim()) return; - const accepted = await confirmDialog({ + const accepted = await confirmPublicHistoryAction({ title: `Опубликовать изменение «${field.label}»?`, text: HISTORY_WARNING, confirmLabel: 'Да, записать', @@ -507,7 +510,7 @@ export function render({ navigate, chrome }) { async function onGenderClick() { const nextGender = await openGenderPickerModal(currentGender); if (!nextGender || nextGender === currentGender) return; - const accepted = await confirmDialog({ + const accepted = await confirmPublicHistoryAction({ title: 'Опубликовать изменение пола?', text: HISTORY_WARNING, confirmLabel: 'Да, записать', diff --git a/shine-UI/js/pages/register-view.js b/shine-UI/js/pages/register-view.js index 5302b7eb..51a65604 100644 --- a/shine-UI/js/pages/register-view.js +++ b/shine-UI/js/pages/register-view.js @@ -1,4 +1,6 @@ import { createTopBar } from '../components/topbar.js'; +import { createVisiblePasswordField } from '../components/visible-password-field.js'; +import { confirmPasswordBoundarySpaces } from '../services/password-boundary-warning.js'; import { createRegistrationStepper } from '../components/registration-stepper.js'; import { authService, clearAuthMessages, state } from '../state.js'; import { PASSWORD_MAX_LENGTH } from '../services/password-words.js'; @@ -151,16 +153,7 @@ export function render({ navigate }) { input.maxLength = PASSWORD_MAX_LENGTH; input.placeholder = 'Ваш секретный пароль'; input.value = draft.password || ''; - const toggle = document.createElement('button'); - toggle.className = 'secondary-btn'; - toggle.type = 'button'; - toggle.textContent = 'Скрыть'; - toggle.setAttribute('aria-label', 'Показать или скрыть пароль'); - toggle.addEventListener('click', () => { - input.type = input.type === 'password' ? 'text' : 'password'; - toggle.textContent = input.type === 'password' ? 'Показать' : 'Скрыть'; - }); - label.append(labelText, input); + label.append(labelText, createVisiblePasswordField(input)); const guidance = document.createElement('div'); guidance.className = 'signup-guidance'; guidance.innerHTML = ` @@ -185,6 +178,9 @@ export function render({ navigate }) { return; } if (!draft.login || !draft.login.includes('@')) { status.textContent = 'Сначала выберите логин.'; return; } + const warningRevision = inputRevision; + if (!await confirmPasswordBoundarySpaces(value) || !screen.isConnected) return; + if (warningRevision !== inputRevision || input.value !== value) { status.textContent = 'Пароль изменился. Нажмите «Продолжить» ещё раз.'; return; } if (draft.password && draft.password !== value && !confirmFundedWalletChange()) return; if (draft.password && draft.password !== value) { state.registrationPayment.walletAddress = ''; @@ -211,7 +207,7 @@ export function render({ navigate }) { if (screen.isConnected && thisRequest === requestId) next.disabled = false; } }); - body.append(heading, description, label, toggle, guidance, status, next); + body.append(heading, description, label, guidance, status, next); } if (flowType !== 'free' && flowType !== 'paid') { diff --git a/shine-UI/js/pages/registration-payment-view.js b/shine-UI/js/pages/registration-payment-view.js index 56aee64b..bab78806 100644 --- a/shine-UI/js/pages/registration-payment-view.js +++ b/shine-UI/js/pages/registration-payment-view.js @@ -31,7 +31,7 @@ import { getNamespace, normalizeFullLogin } from '../services/shine-namespace-se import { calculateRegistrationFunding, USER_PDA_SPACE, solFromLamports } from '../services/registration-upgrade-helpers.js'; export const pageMeta = { id: 'registration-payment-view', title: 'Оплата регистрации', showAppChrome: false }; -const TEST_TOPUP_AMOUNT_SOL = 0.02; +const TEST_TOPUP_AMOUNT_SOL = 0.032; const DEVNET_ENDPOINT = 'https://api.devnet.solana.com'; const TEST_TOPUP_SENDER_PRIVATE_32_BASE58 = '6xqAuKYvA8qrCdAkcw7Y8aMgvBnYk8JLxWLma5BzbAvu'; const AUTO_LOGIN_INITIAL_DELAY_MS = 1000; @@ -746,7 +746,7 @@ function renderSolanaDoneStage({ navigate, status, keyBundle, registrationTxId = }, AUTO_LOGIN_INITIAL_DELAY_MS); } -/** Тот же тестовый источник +0.02 devnet SOL, что используется обычной регистрацией. +/** Тот же тестовый источник +0.032 devnet SOL, что используется обычной регистрацией. * Экспорт добавлен для FREE_CERT → Solana upgrade; поведение обычной регистрации не изменяется. * Никогда не используйте этот встроенный devnet-кошелёк для реальных средств. */ diff --git a/shine-UI/js/pages/settings-view.js b/shine-UI/js/pages/settings-view.js index f968ff0a..9ffeef04 100644 --- a/shine-UI/js/pages/settings-view.js +++ b/shine-UI/js/pages/settings-view.js @@ -127,6 +127,7 @@ export function render({navigate, chrome}) {