SHA256
Слить свежий main (8db2c7e7) в ветку личного чата
Конфликт был только в VERSION.properties: клиент 1.21.20 из ветки, сервер 1.17.11 из main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -92,6 +92,7 @@ import * as walletView from './pages/wallet-view.js?v=202611170124';
|
||||
import * as walletTransferView from './pages/wallet-transfer-view.js';
|
||||
import * as walletSwapView from './pages/wallet-swap-view.js';
|
||||
import * as settingsView from './pages/settings-view.js';
|
||||
import * as aboutAppView from './pages/about-app-view.js';
|
||||
import * as accessKeysView from './pages/access-keys-view.js';
|
||||
import * as myBlockchainView from './pages/my-blockchain-view.js';
|
||||
import * as myBlockchainHistoryView from './pages/my-blockchain-history-view.js';
|
||||
@@ -178,6 +179,7 @@ const routes = {
|
||||
'wallet-transfer-view': walletTransferView,
|
||||
'wallet-swap-view': walletSwapView,
|
||||
'settings-view': settingsView,
|
||||
'about-app-view': aboutAppView,
|
||||
'access-keys-view': accessKeysView,
|
||||
'my-blockchain-view': myBlockchainView,
|
||||
'my-blockchain-history-view': myBlockchainHistoryView,
|
||||
|
||||
@@ -9,8 +9,10 @@ export function confirmDialog({
|
||||
aboveEditor = false,
|
||||
rememberChoice = null,
|
||||
infoOnly = false,
|
||||
signal = null,
|
||||
} = {}) {
|
||||
return new Promise((resolve) => {
|
||||
if (signal?.aborted) { resolve(false); return; }
|
||||
const opener = document.activeElement;
|
||||
const modal = document.createElement('div');
|
||||
modal.className = `modal confirm-dialog${aboveEditor ? ' confirm-dialog--above-editor' : ''}`;
|
||||
@@ -46,7 +48,12 @@ export function confirmDialog({
|
||||
modal.querySelector('.form-actions-grid').classList.add('form-actions-grid--single');
|
||||
}
|
||||
|
||||
let finished = false;
|
||||
const onAbort = () => finish(false);
|
||||
const finish = (answer) => {
|
||||
if (finished) return;
|
||||
finished = true;
|
||||
signal?.removeEventListener('abort', onAbort);
|
||||
document.removeEventListener('keydown', onKeydown, true);
|
||||
modal.remove();
|
||||
opener?.focus?.();
|
||||
@@ -63,6 +70,7 @@ export function confirmDialog({
|
||||
});
|
||||
document.addEventListener('keydown', onKeydown, true);
|
||||
document.body.append(modal);
|
||||
signal?.addEventListener('abort', onAbort, { once: true });
|
||||
modal.querySelector(infoOnly ? '[data-answer="yes"]' : '[data-answer="no"]').focus();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { t, th } from '../i18n/index.js';
|
||||
// data-profile-list / data-self-profile-action / data-profile-action обрабатывают profile-view.js и user-profile-view.js.
|
||||
import { iconHtml } from './ui-icon.js';
|
||||
import { displayCity } from '../services/cities.js';
|
||||
|
||||
export function escapeProfileHtml(text) {
|
||||
return String(text || '')
|
||||
@@ -67,7 +66,6 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
|
||||
const official = card?.accountRole === 'primary';
|
||||
const shining = card?.shineStatus === 'shining';
|
||||
const cardLogin = String(card?.login || login || '').trim().replace(/^@+/, '');
|
||||
const city = displayCity(card?.city);
|
||||
const fullName = [card?.firstName, card?.lastName].map((v) => String(v || '').trim()).filter(Boolean).join(' ');
|
||||
const displayName = fullName || cardLogin || t('screens.profile_card.text_012');
|
||||
const about = String(card?.about || '').trim();
|
||||
@@ -108,7 +106,6 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
|
||||
</div>
|
||||
<h2 class="pf-name">${esc(displayName)}</h2>
|
||||
<div class="pf-login">${esc(cardLogin)}</div>
|
||||
${city ? `<div class="pf-city">${iconHtml('place')}<span>${esc(city)}</span></div>` : ''}
|
||||
</div>
|
||||
|
||||
<div class="pf-stats">
|
||||
|
||||
@@ -868,7 +868,10 @@
|
||||
"confirm_clear_history_error": "Failed to clear history",
|
||||
"confirm_delete_chat_success": "Chat's remote",
|
||||
"confirm_delete_chat_error": "Failed to delete the chat",
|
||||
"confirm_delete_message_error": "Failed to delete the message"
|
||||
"confirm_delete_message_error": "Failed to delete the message",
|
||||
"alpha_call_title": "Calls are an experimental feature",
|
||||
"alpha_call_text": "Audio and video calls are technically implemented in this version of SHiNE but remain under development.\n\nDue to Progressive Web App (PWA) and browser limitations, incoming calls may not always arrive, especially when the app is closed or in the background. The web version may be unable to play an incoming ringtone. If notifications are permitted, a standard system notification similar to a new message notification may arrive.",
|
||||
"alpha_call_continue": "Continue"
|
||||
},
|
||||
"device": {
|
||||
"agree": "Yes",
|
||||
@@ -1010,7 +1013,10 @@
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"secret_generation_overlay": {"title": "Generating your digital keys…", "description": "Generating keys from your login and password directly on this device. Your private keys are never sent to the server and will be stored only on your device."}
|
||||
"secret_generation_overlay": {
|
||||
"title": "Generating your digital keys…",
|
||||
"description": "Generating keys from your login and password directly on this device. Your private keys are never sent to the server and will be stored only on your device."
|
||||
}
|
||||
},
|
||||
"screens": {
|
||||
"dm_attachments": {
|
||||
@@ -1313,7 +1319,7 @@
|
||||
"text_009": "Devices",
|
||||
"text_010": "Sessions and device pairing",
|
||||
"text_011": "My blockchain",
|
||||
"text_012": "Record history, files, and external device",
|
||||
"text_012": "Record history, files, servers and external device",
|
||||
"text_013": "Server settings",
|
||||
"text_014": "Access Server and Blockchain Servers",
|
||||
"text_015": "Keys and passwords",
|
||||
@@ -1535,7 +1541,8 @@
|
||||
"text_032": "Your session is outdated. Re-enter.",
|
||||
"text_037": "No correspondence · {value1}",
|
||||
"text_038": "Muted",
|
||||
"text_039": "Fixed"
|
||||
"text_039": "Fixed",
|
||||
"menu": "Private messages menu"
|
||||
},
|
||||
"register_view": {
|
||||
"access_server_title": "Access server",
|
||||
@@ -1826,7 +1833,7 @@
|
||||
"arweave_uploads_view": {
|
||||
"text_003": "Not yet attached to the post",
|
||||
"text_004": "No files yet. Tap “+” to upload a file now and attach it to a post later.",
|
||||
"text_005": "Files on the blockchain",
|
||||
"text_005": "Files in Arweave",
|
||||
"text_006": "Add file",
|
||||
"text_007": "Add file",
|
||||
"text_008": "Menu",
|
||||
@@ -1835,10 +1842,11 @@
|
||||
"text_011": "Clear history",
|
||||
"text_012": "Certificate",
|
||||
"text_013": "Couldn't upload the file.",
|
||||
"text_001": "File uploads",
|
||||
"text_001": "Files in Arweave",
|
||||
"text_002": "Checking...",
|
||||
"text_014": "Checking...",
|
||||
"text_015": "Unavailable"
|
||||
"text_015": "Unavailable",
|
||||
"description": "This section displays files uploaded directly to Arweave from this client."
|
||||
},
|
||||
"appearance_view": {
|
||||
"text_001": "Appearance",
|
||||
@@ -3413,7 +3421,7 @@
|
||||
"text_041": "Now, after a normal login, both working keys – the blockchain key and the access key – are saved automatically. There is no separate limited mode in the current version.",
|
||||
"text_042": "Generation is not specifically made instantaneous. This complicates the mass selection of passwords.",
|
||||
"text_033": "We recommend using open source browsers. Later, separate applications are planned for Android, iPhone, Ubuntu Touch and Linux, also with open source.",
|
||||
"text_034": "The project is distributed under the AGPL v3 license. Some important data and login records also rely on the blockchain layer to reduce reliance on one closed party.",
|
||||
"text_034": "The project’s own source code is distributed under the GNU AGPL version 3 or any later version (AGPL-3.0-or-later). Some important data and login records also rely on the blockchain layer to reduce reliance on one closed party.",
|
||||
"text_039": "The blockchain key is permanently stored on an authorized device. It signs records and actions on SHiNE blockchain and is the source key for full-time user wallets.",
|
||||
"text_040": "The client key is also permanently stored on the device. It is used to log into the server, operate the device and secure private messages.",
|
||||
"text_047": "Use a unique password that does not apply to other services.",
|
||||
@@ -3440,7 +3448,7 @@
|
||||
"text_060": "The beautiful off-the-shelf Waveshare model on the ESP32-S3 Touch AMOLED 2.16 costs around $32. There are cheaper options on open chips, ranging from about $10 to $15."
|
||||
},
|
||||
"my_blockchain_view": {
|
||||
"text_008": "Files on the blockchain",
|
||||
"text_008": "Files in Arweave (from this client)",
|
||||
"text_016": "Type",
|
||||
"text_035": "Male",
|
||||
"text_036": "Female",
|
||||
@@ -4028,7 +4036,10 @@
|
||||
"text_001": "Application settings",
|
||||
"text_002": "Application settings",
|
||||
"text_003": "Show a warning about public records",
|
||||
"text_004": "Messages, likes and other public actions can be stored on the blockchain forever. The setting is valid for this account on this device."
|
||||
"text_004": "Messages, likes and other public actions can be stored on the blockchain forever. The setting is valid for this account on this device.",
|
||||
"call_warning": "Show call warning",
|
||||
"call_hint": "Remind me about PWA call limitations before outgoing calls. This setting applies to this account on this device.",
|
||||
"call_remember": "Do not show the call warning again"
|
||||
},
|
||||
"trusted_device_login_settings_view": {
|
||||
"text_009": "The additional password could not be removed.",
|
||||
@@ -4244,7 +4255,12 @@
|
||||
"text_010": "<span class=\"session-current-badge\">Selected for remote AddBlock</span>",
|
||||
"text_015": "Update the list of homeserver sessions",
|
||||
"text_016": "Reset the choice",
|
||||
"text_014": "If the device does not have a local blockchain key, the UI will be able to send AddBlock to the selected homeserver session. Homeserver will sign the block with its blockchain key and send the usual AddBlock to the server."
|
||||
"text_014": "If the device does not have a local blockchain key, the UI will be able to send AddBlock to the selected homeserver session. Homeserver will sign the block with its blockchain key and send the usual AddBlock to the server.",
|
||||
"external_title": "Blockchain key on an external device",
|
||||
"development_title": "Feature under development",
|
||||
"client_key": "The SHiNE architecture separates keys by purpose. The client key is used for authentication and private messaging.",
|
||||
"blockchain_key": "The blockchain key is used to sign public records and manage associated funds. To improve security, the architecture allows for keeping this key on a separate external device while retaining private messaging on the client.",
|
||||
"external_status": "Connecting and using external signing devices is under development and is not yet available."
|
||||
},
|
||||
"device_camera_view": {
|
||||
"text_001": "Connect through the camera",
|
||||
@@ -4400,6 +4416,15 @@
|
||||
},
|
||||
"support_phase3": {
|
||||
"channel_total": "Channel support received"
|
||||
},
|
||||
"about_app_view": {
|
||||
"hint": "Version and development status",
|
||||
"unavailable": "Server description unavailable",
|
||||
"unavailable_hint": "The current server has not provided a description.",
|
||||
"server_heading": "About this server",
|
||||
"network_membership": "This server is part of the SHiNE network.",
|
||||
"owner_label": "This server is owned by:",
|
||||
"software_description": "SHiNE — 0.9 Alpha\nServer and software version: 0.9 Alpha\n\nSHiNE is in alpha testing and active development.\n\nProtocol\n• The basic SHiNE protocol has been established.\n• The core user blockchain functions are implemented and operational.\n• SHiNE DAO has been launched:\nhttps://v2.realms.today/dao/FcMg5G3RpAYvW3vvztrcMuFXifWYR3HYiTuPfVgwuN4K/\n\nServer\n• The core server functionality is implemented and operational for a small number of users.\n• Scaling will require further optimization of the server software.\n\nClient application\n• The core functionality is implemented and in alpha testing.\n• The user interface and visual design are under development.\n• Audio and video calls operate in a limited mode."
|
||||
}
|
||||
},
|
||||
"errors": {
|
||||
|
||||
@@ -887,7 +887,10 @@
|
||||
"confirm_clear_history_error": "Не удалось очистить историю",
|
||||
"confirm_delete_chat_success": "Чат удалён",
|
||||
"confirm_delete_chat_error": "Не удалось удалить чат",
|
||||
"confirm_delete_message_error": "Не удалось удалить сообщение"
|
||||
"confirm_delete_message_error": "Не удалось удалить сообщение",
|
||||
"alpha_call_title": "Звонки — экспериментальная функция",
|
||||
"alpha_call_text": "В текущей версии SHiNE аудио- и видеозвонки технически реализованы, но ещё находятся в разработке.\n\nИз-за ограничений Progressive Web App (PWA) и браузеров входящие звонки могут поступать не всегда, особенно при закрытом приложении или в фоновом режиме. Веб-версия не всегда может воспроизвести мелодию входящего звонка. При наличии разрешения на уведомления может прийти обычное системное уведомление, аналогичное уведомлению о новом сообщении.",
|
||||
"alpha_call_continue": "Продолжить"
|
||||
},
|
||||
"profile": {
|
||||
"char_limit": "До {count} символов."
|
||||
@@ -1010,7 +1013,10 @@
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"secret_generation_overlay": {"title": "Генерируем ваши цифровые ключи…", "description": "Генерируем ключи из вашего логина и пароля непосредственно на этом устройстве. Ваши приватные ключи никогда не передаются на сервер и будут храниться только на вашем устройстве."}
|
||||
"secret_generation_overlay": {
|
||||
"title": "Генерируем ваши цифровые ключи…",
|
||||
"description": "Генерируем ключи из вашего логина и пароля непосредственно на этом устройстве. Ваши приватные ключи никогда не передаются на сервер и будут храниться только на вашем устройстве."
|
||||
}
|
||||
},
|
||||
"screens": {
|
||||
"dm_attachments": {
|
||||
@@ -1312,7 +1318,7 @@
|
||||
"text_009": "Устройства",
|
||||
"text_010": "Сеансы и подключение устройств",
|
||||
"text_011": "Мой блокчейн",
|
||||
"text_012": "История записей, файлы и внешнее устройство",
|
||||
"text_012": "История записей, файлы, серверы и внешнее устройство",
|
||||
"text_013": "Настройки серверов",
|
||||
"text_014": "Сервер доступа и серверы блокчейнов",
|
||||
"text_015": "Ключи и пароли",
|
||||
@@ -1535,7 +1541,8 @@
|
||||
"text_036": "Начать переписку · {value1}",
|
||||
"text_037": "Без переписки · {value1}",
|
||||
"text_038": "Без звука",
|
||||
"text_039": "Закреплён"
|
||||
"text_039": "Закреплён",
|
||||
"menu": "Меню личных сообщений"
|
||||
},
|
||||
"register_view": {
|
||||
"access_server_title": "Сервер доступа",
|
||||
@@ -1875,11 +1882,11 @@
|
||||
"text_025": "Включает дополнительные тестовые инструменты и версии экрана «Связи». По умолчанию выключено."
|
||||
},
|
||||
"arweave_uploads_view": {
|
||||
"text_001": "Загрузка файлов",
|
||||
"text_001": "Файлы в Arweave",
|
||||
"text_002": "Проверяем...",
|
||||
"text_003": "Ещё не прикреплён к записи",
|
||||
"text_004": "Файлов пока нет. Нажмите «+», чтобы загрузить файл заранее и прикрепить его к записи позже.",
|
||||
"text_005": "Файлы в блокчейне",
|
||||
"text_005": "Файлы в Arweave",
|
||||
"text_006": "Добавить файл",
|
||||
"text_007": "Добавить файл",
|
||||
"text_008": "Меню",
|
||||
@@ -1889,7 +1896,8 @@
|
||||
"text_012": "Справка",
|
||||
"text_013": "Не удалось загрузить файл.",
|
||||
"text_014": "Проверяем...",
|
||||
"text_015": "Недоступен"
|
||||
"text_015": "Недоступен",
|
||||
"description": "Здесь отображаются файлы, загруженные непосредственно в Arweave с этого клиента."
|
||||
},
|
||||
"appearance_view": {
|
||||
"text_001": "Оформление",
|
||||
@@ -3700,7 +3708,7 @@
|
||||
"text_031": "Сияние не хранит ваши приватные ключи на сервере. В будущем для повышенной защиты рабочие ключи можно будет вынести на отдельное программируемое устройство с открытым кодом, например ESP32-контроллер.",
|
||||
"text_032": "Мы делаем ставку на открытость: клиентский код открыт, серверный код открыт, протокол открыт. Это позволяет проверять систему независимо, а не верить обещаниям на слово.",
|
||||
"text_033": "Мы рекомендуем использовать браузеры с открытым исходным кодом. Позже планируются отдельные приложения для Android, iPhone, Ubuntu Touch и Linux, тоже с открытым кодом.",
|
||||
"text_034": "Проект распространяется по лицензии AGPL v3. Часть важных данных и регистрационных записей также опирается на блокчейн-слой, чтобы уменьшать зависимость от одной закрытой стороны.",
|
||||
"text_034": "Собственный исходный код проекта распространяется по лицензии GNU AGPL версии 3 или любой последующей версии (AGPL-3.0-or-later). Часть важных данных и регистрационных записей также опирается на блокчейн-слой, чтобы уменьшать зависимость от одной закрытой стороны.",
|
||||
"text_035": "Из вашего логина и пароля с помощью Argon2id вычисляется специальный секрет.",
|
||||
"text_036": "Из этого секрета детерминированно строятся три ключа: ключ восстановления (Recovery), ключ блокчейна и ключ доступа.",
|
||||
"text_037": "Это значит, что логин и пароль не просто проверяются на сервере, а реально участвуют в создании ваших ключей. У разных логинов даже с одинаковым паролем будут разные ключи.",
|
||||
@@ -3736,7 +3744,10 @@
|
||||
"text_001": "Настройки приложения",
|
||||
"text_002": "Настройки приложения",
|
||||
"text_003": "Показывать предупреждение о публичных записях",
|
||||
"text_004": "Сообщения, лайки и другие публичные действия могут сохраняться в блокчейне навсегда. Настройка действует для этого аккаунта на этом устройстве."
|
||||
"text_004": "Сообщения, лайки и другие публичные действия могут сохраняться в блокчейне навсегда. Настройка действует для этого аккаунта на этом устройстве.",
|
||||
"call_warning": "Показывать предупреждение о звонках",
|
||||
"call_hint": "Перед исходящим звонком напоминать об ограничениях звонков в PWA. Настройка действует для этого аккаунта на этом устройстве.",
|
||||
"call_remember": "Больше не показывать предупреждение о звонках"
|
||||
},
|
||||
"my_blockchain_view": {
|
||||
"text_001": "Мой блокчейн",
|
||||
@@ -3746,7 +3757,7 @@
|
||||
"text_005": "Открыть профиль →",
|
||||
"text_006": "Открыть запись в блокчейне ↗",
|
||||
"text_007": "Показать историю моего блокчейна",
|
||||
"text_008": "Файлы в блокчейне",
|
||||
"text_008": "Файлы в Arweave (с этого клиента)",
|
||||
"text_009": "Использовать ключ блокчейна с внешнего устройства",
|
||||
"text_010": "Показать более ранние записи",
|
||||
"text_011": "Записей пока нет.",
|
||||
@@ -4181,7 +4192,12 @@
|
||||
"text_013": "Сессия на этом устройстве уже завершена. Выполните вход заново.",
|
||||
"text_014": "Если на устройстве нет локального blockchain key, UI сможет отправлять AddBlock в выбранную homeserver-сессию. Homeserver подпишет блок своим blockchain key и сам отправит обычный AddBlock на сервер.",
|
||||
"text_015": "Обновить список homeserver-сессий",
|
||||
"text_016": "Сбросить выбор"
|
||||
"text_016": "Сбросить выбор",
|
||||
"external_title": "Ключ блокчейна на внешнем устройстве",
|
||||
"development_title": "Функция находится в разработке",
|
||||
"client_key": "Архитектура SHiNE предусматривает разделение ключей по назначению. Клиентский ключ используется для авторизации и личной переписки.",
|
||||
"blockchain_key": "Ключ блокчейна используется для подписания публичных записей и управления связанными финансовыми средствами. Для повышения безопасности архитектура предусматривает возможность хранить его на отдельном внешнем устройстве, сохраняя возможность личной переписки на клиенте.",
|
||||
"external_status": "Подключение и использование внешних устройств для подписи находится в разработке и пока недоступно."
|
||||
},
|
||||
"trusted_device_login_settings_view": {
|
||||
"text_001": "Вход с другого устройства",
|
||||
@@ -4400,6 +4416,15 @@
|
||||
},
|
||||
"support_phase3": {
|
||||
"channel_total": "Канал получил поддержку"
|
||||
},
|
||||
"about_app_view": {
|
||||
"hint": "Версия и состояние разработки",
|
||||
"unavailable": "Описание сервера недоступно",
|
||||
"unavailable_hint": "Текущий сервер не предоставил сведения о себе.",
|
||||
"server_heading": "О сервере",
|
||||
"network_membership": "Этот сервер является частью Сияния.",
|
||||
"owner_label": "Данный сервер принадлежит:",
|
||||
"software_description": "SHiNE — 0.9 Alpha\nВерсия сервера и программного обеспечения: 0.9 Alpha\n\nSHiNE находится на стадии альфа-тестирования и активной разработки.\n\nПротокол\n• Базовый протокол SHiNE сформирован.\n• Основные функции пользовательского блокчейна реализованы и работают.\n• SHiNE DAO запущено:\nhttps://v2.realms.today/dao/FcMg5G3RpAYvW3vvztrcMuFXifWYR3HYiTuPfVgwuN4K/\n\nСервер\n• Основной серверный функционал реализован и работает при небольшом количестве пользователей.\n• Для масштабирования потребуется дальнейшая оптимизация серверного программного обеспечения.\n\nКлиентское приложение\n• Основной функционал реализован и находится на стадии альфа-тестирования.\n• Пользовательский интерфейс и дизайн находятся в разработке.\n• Аудио- и видеозвонки работают в ограниченном режиме."
|
||||
}
|
||||
},
|
||||
"errors": {
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import { t } from '../i18n/index.js';
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
import { createErrorState, createLoadingState } from '../components/feedback.js';
|
||||
import { authService } from '../state.js';
|
||||
import { appendAboutText } from '../services/about-app-text.js';
|
||||
|
||||
export const pageMeta = {
|
||||
id: 'about-app-view',
|
||||
get title() { return t('screens.settings_view.text_017'); },
|
||||
shellMode: { scrollContainer: 'screen', scrollbar: 'auto' },
|
||||
};
|
||||
|
||||
export function render({ navigate, chrome }) {
|
||||
const screen = document.createElement('section');
|
||||
screen.className = 'stack about-app-screen';
|
||||
chrome?.setTopbar(createTopBar({
|
||||
title: t('screens.settings_view.text_017'),
|
||||
back: { label: '←', onClick: () => navigate('settings-view') },
|
||||
}));
|
||||
|
||||
// Общая информация о ПО не зависит от доступности или владельца узла.
|
||||
const software = document.createElement('div');
|
||||
software.className = 'card about-app-text';
|
||||
appendAboutText(software, t('screens.about_app_view.software_description'));
|
||||
const server = document.createElement('section');
|
||||
server.className = 'card stack';
|
||||
const heading = document.createElement('h2');
|
||||
heading.className = 'about-app-server-heading';
|
||||
heading.textContent = t('screens.about_app_view.server_heading');
|
||||
const network = document.createElement('p');
|
||||
network.className = 'about-app-network';
|
||||
network.textContent = t('screens.about_app_view.network_membership');
|
||||
const ownerLabel = document.createElement('p');
|
||||
ownerLabel.className = 'about-app-owner-label';
|
||||
ownerLabel.textContent = t('screens.about_app_view.owner_label');
|
||||
const description = document.createElement('div');
|
||||
description.className = 'about-app-text about-app-owner';
|
||||
server.append(heading, network, ownerLabel, description);
|
||||
screen.append(software, server);
|
||||
|
||||
let disposed = false;
|
||||
let requestSeq = 0;
|
||||
async function load() {
|
||||
const seq = ++requestSeq;
|
||||
const active = () => !disposed && seq === requestSeq;
|
||||
description.replaceChildren(createLoadingState());
|
||||
try {
|
||||
const result = await authService.ws.request('GetServerInfo', {}, 7000);
|
||||
if (!active()) return;
|
||||
const text = result?.payload?.aboutText;
|
||||
if (typeof text !== 'string' || !text.trim()) {
|
||||
description.replaceChildren(createErrorState({
|
||||
title: t('screens.about_app_view.unavailable'),
|
||||
text: t('screens.about_app_view.unavailable_hint'),
|
||||
onRetry: load,
|
||||
}));
|
||||
return;
|
||||
}
|
||||
description.replaceChildren();
|
||||
appendAboutText(description, text);
|
||||
} catch {
|
||||
if (active()) description.replaceChildren(createErrorState({ onRetry: load }));
|
||||
}
|
||||
}
|
||||
screen.cleanup = () => { disposed = true; };
|
||||
void load();
|
||||
return screen;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { t, th } from '../i18n/index.js';
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
import { getShowCallWarning, setShowCallWarning } from '../services/call-warning-preference.js';
|
||||
import { getShowPublicHistoryWarning, setShowPublicHistoryWarning } from '../services/public-history-consent.js';
|
||||
|
||||
export const pageMeta = { id: 'application-settings-view', get title() { return t('screens.application_settings_view.text_001'); } };
|
||||
@@ -26,6 +27,19 @@ export function render({ navigate, chrome }) {
|
||||
input.checked = getShowPublicHistoryWarning();
|
||||
input.addEventListener('change', () => setShowPublicHistoryWarning(input.checked));
|
||||
section.append(row);
|
||||
const callRow = document.createElement('label');
|
||||
callRow.className = 'nav-row nav-row--switch';
|
||||
callRow.innerHTML = `
|
||||
<span class="nav-row__text">
|
||||
<span class="nav-row__label">${th('screens.application_settings_view.call_warning')}</span>
|
||||
<span class="nav-row__hint">${th('screens.application_settings_view.call_hint')}</span>
|
||||
</span>
|
||||
<input class="switch" type="checkbox" />
|
||||
`;
|
||||
const callInput = callRow.querySelector('input');
|
||||
callInput.checked = getShowCallWarning();
|
||||
callInput.addEventListener('change', () => setShowCallWarning(callInput.checked));
|
||||
section.append(callRow);
|
||||
screen.append(section);
|
||||
return screen;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,10 @@ export function render({navigate, chrome}) {
|
||||
],
|
||||
});
|
||||
chrome?.setTopbar(topbar);
|
||||
screen.append(statusLine, list);
|
||||
const description = document.createElement('p');
|
||||
description.className = 'meta-muted';
|
||||
description.textContent = t('screens.arweave_uploads_view.description');
|
||||
screen.append(description, statusLine, list);
|
||||
renderHistory();
|
||||
return screen;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ import {
|
||||
state,
|
||||
} from '../state.js';
|
||||
import { startOutgoingCall } from '../services/call-service.js';
|
||||
import { confirmDialog } from '../components/confirm-dialog.js';
|
||||
import { getShowCallWarning, setShowCallWarning } from '../services/call-warning-preference.js';
|
||||
import {
|
||||
createEmojiPicker,
|
||||
createTwemojiAsset,
|
||||
@@ -1406,15 +1408,34 @@ export function render({ navigate, route, chrome }) {
|
||||
await speakTextBySettings(String(parsedText.displayText || ''), state.entrySettings);
|
||||
};
|
||||
|
||||
const callDialogLifetime = new AbortController();
|
||||
let callStartPending = false;
|
||||
const handleStartCall = async (mode = 'audio') => {
|
||||
if (disposed || callStartPending) return;
|
||||
callStartPending = true;
|
||||
try {
|
||||
const confirmed = !getShowCallWarning() || await confirmDialog({
|
||||
title: t('dialogs.final.chat.alpha_call_title'),
|
||||
text: t('dialogs.final.chat.alpha_call_text'),
|
||||
confirmLabel: t('dialogs.final.chat.alpha_call_continue'),
|
||||
rememberChoice: {
|
||||
label: t('screens.application_settings_view.call_remember'),
|
||||
onConfirm: () => setShowCallWarning(false),
|
||||
},
|
||||
signal: callDialogLifetime.signal,
|
||||
});
|
||||
if (!confirmed || disposed) return;
|
||||
await startOutgoingCall(chatId, { mode });
|
||||
if (disposed) return;
|
||||
renderChatLog({ scrollMode: 'latest', markAsRead: false });
|
||||
} catch (e) {
|
||||
if (disposed) return;
|
||||
// Подробности запуска уже в журнале звонка; человеку – причина тостом, а не пузырь в переписке.
|
||||
const mediaReason = mediaAccessErrorText(e);
|
||||
showToast(mediaReason ? t('screens.chat_view.text_088', { value1: mediaReason }) : actionErrorText(t('screens.chat_view.text_044'), e), { kind: 'error' });
|
||||
renderChatLog({ scrollMode: 'latest', markAsRead: false });
|
||||
} finally {
|
||||
callStartPending = false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3063,6 +3084,7 @@ export function render({ navigate, route, chrome }) {
|
||||
screen.cleanup = () => {
|
||||
if (disposed) return;
|
||||
disposed = true;
|
||||
callDialogLifetime.abort();
|
||||
window.clearTimeout(searchDebounce);
|
||||
// После ухода со страницы запись поиска в истории уже не текущая: close() только снимает слой.
|
||||
search?.layer?.close();
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
import { renderUserAvatar } from '../components/avatar-image.js';
|
||||
import { createSearchTopBar, createTopBar } from '../components/topbar.js';
|
||||
import { createDropdownMenu } from '../components/dropdown-menu.js';
|
||||
import { createOverflowDots } from '../components/overflow-dots.js';
|
||||
import { createTopBarFilterTitle } from '../components/topbar-filter-title.js';
|
||||
import { createDmMuteMenuItem } from '../components/dm-mute-menu.js';
|
||||
import { iconHtml } from '../components/ui-icon.js';
|
||||
@@ -261,18 +262,15 @@ export function render({ navigate, chrome }) {
|
||||
className: 'topbar--root topbar--section-filter',
|
||||
actions: [
|
||||
{
|
||||
icon: 'search',
|
||||
title: t('screens.messages_list.text_002'),
|
||||
ariaLabel: t('screens.messages_list.text_003'),
|
||||
className: 'messages-search-btn',
|
||||
onClick: () => openChatsSearch(),
|
||||
},
|
||||
{
|
||||
icon: 'compose',
|
||||
title: t('screens.messages_list.text_004'),
|
||||
ariaLabel: t('screens.messages_list.text_005'),
|
||||
className: 'messages-compose-btn',
|
||||
onClick: () => navigate('contact-search-view'),
|
||||
iconNode: createOverflowDots({ className: 'app-overflow-dots--vertical' }),
|
||||
title: t('screens.messages_list.menu'),
|
||||
ariaLabel: t('screens.messages_list.menu'),
|
||||
menu: {
|
||||
items: [
|
||||
{ label: t('screens.messages_list.text_002'), iconHtml: iconHtml('search'), action: () => openChatsSearch() },
|
||||
{ label: t('screens.messages_list.text_004'), iconHtml: iconHtml('compose'), action: () => navigate('contact-search-view') },
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -511,7 +511,12 @@ export function render({ navigate, chrome }, { historyOnly = false } = {}) {
|
||||
remoteButton.className = 'nav-row';
|
||||
remoteButton.textContent = t('screens.my_blockchain_view.text_009');
|
||||
remoteButton.addEventListener('click', () => navigate('remote-addblock-session-view'));
|
||||
intro.append(historyButton, filesButton, remoteButton);
|
||||
const serversButton = document.createElement('button');
|
||||
serversButton.type = 'button';
|
||||
serversButton.className = 'nav-row';
|
||||
serversButton.textContent = t('screens.settings_view.text_013');
|
||||
serversButton.addEventListener('click', () => navigate('settings-servers-view'));
|
||||
intro.append(historyButton, filesButton, remoteButton, serversButton);
|
||||
screen.append(intro);
|
||||
return screen;
|
||||
}
|
||||
|
||||
@@ -2348,6 +2348,7 @@ export function createGraphCanvas({ stage, onSelect, onNodeMoved, onGroupSelect,
|
||||
const node = caption ? null : hitTest(p.x, p.y);
|
||||
const touch = event.pointerType === 'touch' || event.pointerType === 'pen';
|
||||
gesture = { kind: 'pending', touch, start: p, last: p, lastAt: performance.now(), node, caption, vx: 0, vy: 0 };
|
||||
if (node?.isFocus && !caption) onSelect?.(node.data);
|
||||
// Пальцем: просто провести – двигается карта; задержать палец на человеке – можно
|
||||
// переносить его. Иначе на плотной карте любая попытка сдвинуть её хватала бы точку.
|
||||
if (touch && node && !node.isFocus) {
|
||||
|
||||
@@ -16,7 +16,7 @@ export function render({ navigate }) {
|
||||
const brand = document.createElement('div');
|
||||
brand.className = 'signup-intro__brand';
|
||||
const logo = document.createElement('img');
|
||||
logo.src = './img/shine-logo-transparent-final.png';
|
||||
logo.src = './img/logo.svg';
|
||||
logo.alt = t('screens.registration_intro_view.text_003');
|
||||
const title = document.createElement('div');
|
||||
title.className = 'signup-intro__wordmark';
|
||||
|
||||
@@ -1,149 +1,29 @@
|
||||
import { formatDateTime } from '../i18n/format.js';
|
||||
import { t, th } from '../i18n/index.js';
|
||||
import { t } from '../i18n/index.js';
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
import { toUserMessage } from '../services/ui-error-texts.js';
|
||||
import { showToast } from '../services/channels-ux.js';
|
||||
import {
|
||||
isSessionInvalidError,
|
||||
refreshSessions,
|
||||
saveEntrySettings,
|
||||
setAuthError,
|
||||
setAuthInfo,
|
||||
state,
|
||||
terminateCurrentSession,
|
||||
} from '../state.js';
|
||||
|
||||
export const pageMeta = { id: 'remote-addblock-session-view', get title() { return t('screens.remote_addblock_session_view.text_001'); } };
|
||||
export const pageMeta = { id: 'remote-addblock-session-view', get title() { return t('screens.my_blockchain_view.text_009'); } };
|
||||
|
||||
const SESSION_TYPE_HOMESERVER = 100;
|
||||
|
||||
function formatSessionTime(ms) {
|
||||
return formatDateTime(new Date(ms), {
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
year: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
}
|
||||
|
||||
function sessionLabel(session) {
|
||||
const title = String(session?.clientInfoFromClient || '').trim();
|
||||
if (title) return title;
|
||||
return `Homeserver ${String(session?.sessionId || '').slice(0, 12)}`;
|
||||
}
|
||||
|
||||
export function render({navigate, chrome}) {
|
||||
export function render({ navigate, chrome }) {
|
||||
const screen = document.createElement('section');
|
||||
screen.className = 'stack';
|
||||
|
||||
chrome?.setTopbar(createTopBar({
|
||||
title: t('screens.remote_addblock_session_view.text_002'),
|
||||
back: { label: '←', onClick: () => navigate('my-blockchain-view') },
|
||||
}));
|
||||
|
||||
const actions = document.createElement('div');
|
||||
actions.className = 'card stack';
|
||||
actions.innerHTML = `
|
||||
<p class="meta-muted">${th('screens.remote_addblock_session_view.text_014')}</p>
|
||||
<button class="primary-btn" type="button" id="remote-addblock-refresh">${th('screens.remote_addblock_session_view.text_015')}</button>
|
||||
<button class="ghost-btn" type="button" id="remote-addblock-clear">${th('screens.remote_addblock_session_view.text_016')}</button>
|
||||
`;
|
||||
|
||||
const listCard = document.createElement('div');
|
||||
listCard.className = 'card stack';
|
||||
|
||||
const buildList = () => {
|
||||
listCard.innerHTML = '';
|
||||
const selectedId = String(state.entrySettings.remoteAddBlockSessionId || '').trim();
|
||||
const sessions = (state.sessions || [])
|
||||
.filter((item) => Number(item?.sessionType || 0) === SESSION_TYPE_HOMESERVER)
|
||||
.sort((a, b) => Number(b?.lastAuthenticatedAtMs || 0) - Number(a?.lastAuthenticatedAtMs || 0));
|
||||
|
||||
if (sessions.length === 0) {
|
||||
const empty = document.createElement('p');
|
||||
empty.className = 'meta-muted';
|
||||
empty.textContent = t('screens.remote_addblock_session_view.text_003');
|
||||
listCard.append(empty);
|
||||
return;
|
||||
}
|
||||
|
||||
sessions.forEach((session) => {
|
||||
const sessionId = String(session?.sessionId || '').trim();
|
||||
const item = document.createElement('button');
|
||||
item.className = 'ui-button session-item';
|
||||
item.type = 'button';
|
||||
const isSelected = sessionId && sessionId === selectedId;
|
||||
item.innerHTML = `
|
||||
<div class="stack" style="gap:4px; text-align:left;">
|
||||
<strong>${sessionLabel(session)}</strong>
|
||||
<span class="meta-muted">${session.geo || 'unknown'} · ${formatSessionTime(session.lastAuthenticatedAtMs || Date.now())}</span>
|
||||
<span class="meta-muted">sessionId: ${sessionId || '-'}</span>
|
||||
<span class="meta-muted">status: ${session.onlineOnThisServer ? 'online' : 'offline on this server'}</span>
|
||||
${isSelected ? t('screens.remote_addblock_session_view.text_010') : ''}
|
||||
</div>
|
||||
`;
|
||||
item.addEventListener('click', async () => {
|
||||
try {
|
||||
await saveEntrySettings({
|
||||
...state.entrySettings,
|
||||
remoteAddBlockSessionId: sessionId,
|
||||
});
|
||||
buildList();
|
||||
setAuthInfo(t('screens.remote_addblock_session_view.text_004'));
|
||||
} catch (error) {
|
||||
if (isSessionInvalidError(error)) {
|
||||
await terminateCurrentSession({
|
||||
infoMessage: t('screens.remote_addblock_session_view.text_011'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
setAuthError(error.message);
|
||||
showToast(toUserMessage(error, t('screens.remote_addblock_session_view.text_005')), { kind: 'error' });
|
||||
}
|
||||
});
|
||||
listCard.append(item);
|
||||
});
|
||||
};
|
||||
|
||||
actions.querySelector('#remote-addblock-refresh')?.addEventListener('click', async () => {
|
||||
try {
|
||||
await refreshSessions();
|
||||
buildList();
|
||||
setAuthInfo(t('screens.remote_addblock_session_view.text_006'));
|
||||
} catch (error) {
|
||||
if (isSessionInvalidError(error)) {
|
||||
await terminateCurrentSession({
|
||||
infoMessage: t('screens.remote_addblock_session_view.text_012'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
setAuthError(error.message);
|
||||
showToast(toUserMessage(error, t('screens.remote_addblock_session_view.text_007')), { kind: 'error' });
|
||||
}
|
||||
});
|
||||
|
||||
actions.querySelector('#remote-addblock-clear')?.addEventListener('click', async () => {
|
||||
try {
|
||||
await saveEntrySettings({
|
||||
...state.entrySettings,
|
||||
remoteAddBlockSessionId: '',
|
||||
});
|
||||
buildList();
|
||||
setAuthInfo(t('screens.remote_addblock_session_view.text_008'));
|
||||
} catch (error) {
|
||||
if (isSessionInvalidError(error)) {
|
||||
await terminateCurrentSession({
|
||||
infoMessage: t('screens.remote_addblock_session_view.text_013'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
setAuthError(error.message);
|
||||
showToast(toUserMessage(error, t('screens.remote_addblock_session_view.text_009')), { kind: 'error' });
|
||||
}
|
||||
});
|
||||
|
||||
buildList();
|
||||
screen.append(actions, listCard);
|
||||
title: t('screens.remote_addblock_session_view.external_title'),
|
||||
back: { label: '←', onClick: () => navigate('my-blockchain-view') },
|
||||
}));
|
||||
const card = document.createElement('div');
|
||||
card.className = 'card stack';
|
||||
const heading = document.createElement('strong');
|
||||
heading.textContent = t('screens.remote_addblock_session_view.development_title');
|
||||
card.append(heading);
|
||||
for (const text of [
|
||||
t('screens.remote_addblock_session_view.client_key'),
|
||||
t('screens.remote_addblock_session_view.blockchain_key'),
|
||||
t('screens.remote_addblock_session_view.external_status'),
|
||||
]) {
|
||||
const paragraph = document.createElement('p');
|
||||
paragraph.textContent = text;
|
||||
card.append(paragraph);
|
||||
}
|
||||
screen.append(card);
|
||||
return screen;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ export function render({ navigate, chrome }) {
|
||||
screen.className = 'stack';
|
||||
chrome?.setTopbar(createTopBar({
|
||||
title: t('screens.settings_servers_view.text_002'),
|
||||
back: { label: '←', onClick: () => navigate('settings-view') },
|
||||
back: { label: '←', onClick: () => navigate('my-blockchain-view') },
|
||||
}));
|
||||
const list = document.createElement('div');
|
||||
list.className = 'nav-list';
|
||||
|
||||
@@ -33,7 +33,7 @@ export function render({navigate, chrome}) {
|
||||
});
|
||||
const logo = document.createElement('img');
|
||||
logo.className = 'auth-logo';
|
||||
logo.src = './img/shine-logo-transparent-final.png';
|
||||
logo.src = './img/logo.svg';
|
||||
logo.alt = t('screens.start_view.text_002');
|
||||
logoWrap.append(logo);
|
||||
|
||||
@@ -49,6 +49,18 @@ export function render({navigate, chrome}) {
|
||||
navigate('advanced-settings-view');
|
||||
});
|
||||
|
||||
// Отдельный скрытый вход в настройки разработчика: пять нажатий на логотип.
|
||||
let logoTapCount = 0;
|
||||
let lastLogoTapAt = 0;
|
||||
logo.addEventListener('click', () => {
|
||||
const now = Date.now();
|
||||
logoTapCount = now - lastLogoTapAt <= 900 ? logoTapCount + 1 : 1;
|
||||
lastLogoTapAt = now;
|
||||
if (logoTapCount < 5) return;
|
||||
logoTapCount = 0;
|
||||
navigate('developer-settings-view');
|
||||
});
|
||||
|
||||
const card = document.createElement('div');
|
||||
card.className = 'stack settings-sections';
|
||||
const row = (id, label, hint) => `<button class="nav-row" type="button" id="${id}"><span class="nav-row__label">${label}</span>${hint ? `<span class="nav-row__hint">${hint}</span>` : ''}</button>`;
|
||||
@@ -68,13 +80,10 @@ export function render({navigate, chrome}) {
|
||||
<div class="nav-list">
|
||||
${row('settings-device', t('screens.settings_view.text_009'), t('screens.settings_view.text_010'))}
|
||||
${row('settings-my-blockchain', t('screens.settings_view.text_011'), t('screens.settings_view.text_012'))}
|
||||
${row('settings-servers', t('screens.settings_view.text_013'), t('screens.settings_view.text_014'))}
|
||||
${row('settings-access-keys', t('screens.settings_view.text_015'), t('screens.settings_view.text_016'))}
|
||||
${row('settings-about', t('screens.settings_view.text_017'), t('screens.about_app_view.hint'))}
|
||||
</div>
|
||||
<div class="nav-list" id="settings-install-list" hidden></div>
|
||||
<div class="nav-list">
|
||||
${row('settings-developer', t('screens.settings_view.text_018'), t('screens.settings_view.text_019'))}
|
||||
</div>
|
||||
<div class="nav-list">
|
||||
<button class="nav-row nav-row--danger" type="button" id="settings-signout"><span class="nav-row__label">${th('screens.settings_view.text_029')}</span></button>
|
||||
</div>
|
||||
@@ -111,9 +120,8 @@ export function render({navigate, chrome}) {
|
||||
card.querySelector('#settings-application').addEventListener('click', () => navigate('application-settings-view'));
|
||||
card.querySelector('#settings-device').addEventListener('click', () => navigate('device-view'));
|
||||
card.querySelector('#settings-my-blockchain').addEventListener('click', () => navigate('my-blockchain-view'));
|
||||
card.querySelector('#settings-servers').addEventListener('click', () => navigate('settings-servers-view'));
|
||||
card.querySelector('#settings-access-keys').addEventListener('click', () => navigate('access-keys-view'));
|
||||
card.querySelector('#settings-developer').addEventListener('click', () => navigate('developer-settings-view'));
|
||||
card.querySelector('#settings-about').addEventListener('click', () => navigate('about-app-view'));
|
||||
card.querySelector('#settings-language').addEventListener('click', () => {
|
||||
sessionStorage.setItem('shine-language-return-page', 'settings-view');
|
||||
navigate('language-view');
|
||||
|
||||
@@ -19,7 +19,7 @@ export function render({ navigate }) {
|
||||
|
||||
const logo = document.createElement('img');
|
||||
logo.className = 'auth-logo';
|
||||
logo.src = './img/shine-logo-transparent-final.png';
|
||||
logo.src = './img/logo.svg';
|
||||
logo.alt = t('screens.start_view.text_002');
|
||||
logoWrap.append(logo);
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ const PRETTY_PATHS = new Map([
|
||||
['server-settings-view', 'settings/servers'],
|
||||
['arweave-uploads-view', 'settings/arweave-uploads'],
|
||||
['developer-settings-view', 'settings/developer'],
|
||||
['about-app-view', 'settings/about'],
|
||||
['advanced-settings-view', 'settings/advanced'],
|
||||
['trusted-device-login-settings-view', 'settings/device-login'],
|
||||
['language-view', 'settings/language'],
|
||||
@@ -369,6 +370,7 @@ export function parseRouteFromPath(pathname = '') {
|
||||
if (sub === 'servers') return { pageId: 'server-settings-view', params: {} };
|
||||
if (sub === 'arweave-uploads') return { pageId: 'arweave-uploads-view', params: {} };
|
||||
if (sub === 'developer') return { pageId: 'developer-settings-view', params: {} };
|
||||
if (sub === 'about') return { pageId: 'about-app-view', params: {} };
|
||||
if (sub === 'advanced') return { pageId: 'advanced-settings-view', params: {} };
|
||||
if (sub === 'device-login') return { pageId: 'trusted-device-login-settings-view', params: {} };
|
||||
if (sub === 'language') return { pageId: 'language-view', params: {} };
|
||||
@@ -621,6 +623,7 @@ function resolveToolbarTab(pageId) {
|
||||
pageId === 'access-servers-view' ||
|
||||
pageId === 'settings-servers-view' ||
|
||||
pageId === 'developer-settings-view' ||
|
||||
pageId === 'about-app-view' ||
|
||||
pageId === 'advanced-settings-view' ||
|
||||
pageId === 'server-settings-view' ||
|
||||
pageId === 'arweave-uploads-view' ||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// Текст сервера недоверенный: никакого HTML, только текст и HTTPS-ссылки.
|
||||
export function appendAboutText(container, text) {
|
||||
const value = String(text);
|
||||
let offset = 0;
|
||||
for (const match of value.matchAll(/https:\/\/[^\s<>"']+/gu)) {
|
||||
container.append(document.createTextNode(value.slice(offset, match.index)));
|
||||
try {
|
||||
const url = new URL(match[0]);
|
||||
if (url.protocol !== 'https:' || url.username || url.password) throw new Error('Invalid URL');
|
||||
const link = document.createElement('a');
|
||||
link.href = url.href;
|
||||
link.textContent = match[0];
|
||||
link.target = '_blank';
|
||||
link.rel = 'noopener noreferrer';
|
||||
container.append(link);
|
||||
} catch {
|
||||
container.append(document.createTextNode(match[0]));
|
||||
}
|
||||
offset = match.index + match[0].length;
|
||||
}
|
||||
container.append(document.createTextNode(value.slice(offset)));
|
||||
}
|
||||
@@ -544,11 +544,11 @@ function extractContactsFromDialogs(dialogs) {
|
||||
return out;
|
||||
}
|
||||
|
||||
export const HEADER_VERSION = 3;
|
||||
export const HEADER_VERSION = 1;
|
||||
// Временное значение до утверждения лицензии проекта.
|
||||
export const HEADER_DEFAULT_LICENSE = '';
|
||||
|
||||
function makeHeaderBodyBytes({ login, initialBlockchainKey32, license = '', accountType = null, previousAccounts = [] }) {
|
||||
function makeHeaderBodyBytes({ login, initialBlockchainKey32, license = '', accountType = 1, previousAccounts = [] }) {
|
||||
const cleanLogin = String(login || '').trim();
|
||||
const loginBytes = utf8Bytes(cleanLogin);
|
||||
const licenseBytes = utf8Bytes(license);
|
||||
@@ -560,18 +560,15 @@ function makeHeaderBodyBytes({ login, initialBlockchainKey32, license = '', acco
|
||||
if (keyBytes.length !== 32 || keyBytes.every((value) => value === 0)) {
|
||||
throw new Error('HEADER initialBlockchainKey32 must be a non-zero 32-byte key');
|
||||
}
|
||||
let identityBytes = new Uint8Array(0);
|
||||
if (accountType !== null) {
|
||||
if (accountType !== 0 && accountType !== 1) throw new Error('Invalid HEADER account type');
|
||||
if (!Array.isArray(previousAccounts) || previousAccounts.length > 10 || (accountType === 0 && previousAccounts.length)) throw new Error('Invalid HEADER previous accounts');
|
||||
const seen = new Set([cleanLogin.toLowerCase()]);
|
||||
for (const previous of previousAccounts) {
|
||||
if (typeof previous !== 'string' || !(/^[A-Za-z0-9_]{1,255}$/.test(previous) || (previous.length <= 30 && /^[A-Za-z0-9_]+@[a-z0-9_]+$/.test(previous))) || seen.has(previous.toLowerCase())) throw new Error('Invalid or duplicate previous account');
|
||||
seen.add(previous.toLowerCase());
|
||||
}
|
||||
const csv = utf8Bytes(previousAccounts.join(','));
|
||||
identityBytes = accountType === 1 ? concatBytes(int8Byte(1), Uint8Array.of(csv.length >> 8, csv.length & 255), csv) : int8Byte(0);
|
||||
if (accountType !== 0 && accountType !== 1) throw new Error('Invalid HEADER account type');
|
||||
if (!Array.isArray(previousAccounts) || previousAccounts.length > 10 || (accountType === 0 && previousAccounts.length)) throw new Error('Invalid HEADER previous accounts');
|
||||
const seen = new Set([cleanLogin.toLowerCase()]);
|
||||
for (const previous of previousAccounts) {
|
||||
if (typeof previous !== 'string' || !(/^[A-Za-z0-9_]{1,255}$/.test(previous) || (previous.length <= 30 && /^[A-Za-z0-9_]+@[a-z0-9_]+$/.test(previous))) || seen.has(previous.toLowerCase())) throw new Error('Invalid or duplicate previous account');
|
||||
seen.add(previous.toLowerCase());
|
||||
}
|
||||
const csv = utf8Bytes(previousAccounts.join(','));
|
||||
const identityBytes = accountType === 1 ? concatBytes(int8Byte(1), Uint8Array.of(csv.length >> 8, csv.length & 255), csv) : int8Byte(0);
|
||||
return concatBytes(
|
||||
utf8Bytes('SHiNE'),
|
||||
int8Byte(loginBytes.length),
|
||||
|
||||
@@ -124,33 +124,20 @@ function parseTechBody(subType, body, frame) {
|
||||
const magic = reader.text(5, 'HEADER magic');
|
||||
if (magic !== 'SHiNE') throw new Error('Неправильная сигнатура HEADER');
|
||||
const login = reader.textU8('HEADER login');
|
||||
let license = null;
|
||||
let accountType = null;
|
||||
const accountType = reader.u8('HEADER account type');
|
||||
if (accountType !== 0 && accountType !== 1) throw new Error('Invalid HEADER account type');
|
||||
let previousAccounts = [];
|
||||
if (frame.version === 3) {
|
||||
accountType = reader.u8('HEADER account type');
|
||||
if (accountType !== 0 && accountType !== 1) throw new Error('Invalid HEADER account type');
|
||||
if (accountType === 1) {
|
||||
const csv = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(reader.raw(reader.u16('HEADER previous accounts length'), 'HEADER previous accounts'));
|
||||
previousAccounts = csv ? csv.split(',') : [];
|
||||
const seen = new Set([login.toLowerCase()]);
|
||||
if (previousAccounts.length > 10) throw new Error('Too many previous accounts');
|
||||
for (const previous of previousAccounts) {
|
||||
if (!(/^[A-Za-z0-9_]{1,255}$/.test(previous) || (previous.length <= 30 && /^[A-Za-z0-9_]+@[a-z0-9_]+$/.test(previous))) || seen.has(previous.toLowerCase())) throw new Error('Invalid previous account');
|
||||
seen.add(previous.toLowerCase());
|
||||
}
|
||||
}
|
||||
license = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(reader.raw(reader.u8('HEADER license length'), 'HEADER license'));
|
||||
} else if (frame.version === 2) {
|
||||
const field = reader.raw(reader.remaining() - 32, 'HEADER license');
|
||||
const marker = 'license:CC0-1.0';
|
||||
if (field.length === marker.length && field.every((b, i) => b === marker.charCodeAt(i))) {
|
||||
license = 'CC0-1.0'; // исторический HEADER v2
|
||||
} else {
|
||||
if (!field.length || field[0] !== field.length - 1) throw new Error('Некорректная длина лицензии HEADER');
|
||||
license = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(field.slice(1));
|
||||
if (accountType === 1) {
|
||||
const csv = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(reader.raw(reader.u16('HEADER previous accounts length'), 'HEADER previous accounts'));
|
||||
previousAccounts = csv ? csv.split(',') : [];
|
||||
const seen = new Set([login.toLowerCase()]);
|
||||
if (previousAccounts.length > 10) throw new Error('Too many previous accounts');
|
||||
for (const previous of previousAccounts) {
|
||||
if (!(/^[A-Za-z0-9_]{1,255}$/.test(previous) || (previous.length <= 30 && /^[A-Za-z0-9_]+@[a-z0-9_]+$/.test(previous))) || seen.has(previous.toLowerCase())) throw new Error('Invalid previous account');
|
||||
seen.add(previous.toLowerCase());
|
||||
}
|
||||
}
|
||||
const license = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(reader.raw(reader.u8('HEADER license length'), 'HEADER license'));
|
||||
const initialBlockchainKey = bytesToBase64Url(reader.raw(32, 'initialBlockchainKey32'));
|
||||
if (reader.remaining() !== 0) throw new Error('Неожиданные данные после HEADER');
|
||||
return { kind: 'header', magic, login, license, accountType, previousAccounts, initialBlockchainKey };
|
||||
@@ -260,8 +247,7 @@ function parseStatusBody(subType, body) {
|
||||
}
|
||||
|
||||
function parseBody(type, subType, version, body, frame) {
|
||||
// Only TECH HEADER subtype 0 has a second version; all other records stay v1.
|
||||
if (version !== 1 && !(type === 0 && subType === 0 && (version === 2 || version === 3))) {
|
||||
if (version !== 1) {
|
||||
return { kind: 'unsupported_version', rawBodyLength: body.length };
|
||||
}
|
||||
if (type === 0) return parseTechBody(subType, body, frame);
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { state } from '../state.js';
|
||||
import { getDevicePref, setDevicePref } from './device-prefs.js';
|
||||
|
||||
const PREFIX = 'showCallWarning:';
|
||||
|
||||
function key() {
|
||||
const login = String(state.session?.login || '').trim().toLowerCase();
|
||||
return login ? `${PREFIX}${login}` : null;
|
||||
}
|
||||
|
||||
export function getShowCallWarning() {
|
||||
const preference = key();
|
||||
return preference ? getDevicePref(preference, true) !== false : true;
|
||||
}
|
||||
|
||||
export function setShowCallWarning(show) {
|
||||
const preference = key();
|
||||
if (preference) setDevicePref(preference, Boolean(show));
|
||||
}
|
||||
@@ -80,7 +80,7 @@ export function coreTags(core) {
|
||||
function checkEventLine(content, core) {
|
||||
const { type, subType, version } = content;
|
||||
const header = type === 0 && subType === 0;
|
||||
if (version !== 1 && !(header && (version === 2 || version === 3))) throw new Error('Unsupported CONTENT version for creation');
|
||||
if (version !== 1) throw new Error('Unsupported CONTENT version for creation');
|
||||
if (header !== (core.blockNumber === 0)) throw new Error('HEADER must be CORE #0');
|
||||
const code = core.line?.lineCode;
|
||||
if (type === 0 && !header) { if (code !== SHINE_CORE_LINE_TECH) throw new Error('Wrong TECH line'); }
|
||||
|
||||
@@ -7,7 +7,7 @@ export const SHINE_CHANNEL_TAG_NAME = 'c';
|
||||
export const SHINE_TYPE_TAG_NAME = 't';
|
||||
|
||||
// Активная эпоха CORE/CONTENT.
|
||||
export const SHINE_CORE_NAMESPACE = 'test5595';
|
||||
export const SHINE_CORE_NAMESPACE = 'test5599';
|
||||
export const SHINE_CORE_NUMBER_TAG_NAME = 'n';
|
||||
export const SHINE_CORE_LINE_TAG_NAME = 'l';
|
||||
export const SHINE_CORE_LINE_PROFILE = 2147483645;
|
||||
|
||||
@@ -12,9 +12,7 @@ import { getNamespace, assertLoginInNamespace, normalizeFullLogin, userPdaSeed32
|
||||
|
||||
const MAGIC = 'SHiNE';
|
||||
const FORMAT_MAJOR = 1;
|
||||
const FORMAT_MINOR_LEGACY = 0;
|
||||
const FORMAT_MINOR_CURRENT = 3;
|
||||
const FORMAT_MINOR_PREVIOUS = 2;
|
||||
const FORMAT_MINOR_CURRENT = 0;
|
||||
const SHINE_PAYMENTS_INFLOW_VAULT_SEED = 'shine_payments_inflow_vault';
|
||||
const SHINE_USERS_USER_PDA_SEED_PREFIX = 'user_login=';
|
||||
const SHINE_USERS_PROMO_SELLER_PDA_SEED_PREFIX = 'promo_seller=';
|
||||
@@ -56,7 +54,7 @@ function normalizeAccessServers(values) {
|
||||
const login = normalizeLogin(value);
|
||||
if (!login || seen.has(login)) continue;
|
||||
if (result.length >= MAX_EFFECTIVE_ACCESS_SERVERS) {
|
||||
throw new Error('PDA 1.3 поддерживает максимум один сервер доступа');
|
||||
throw new Error('PDA 1.0 поддерживает максимум один сервер доступа');
|
||||
}
|
||||
seen.add(login);
|
||||
result.push(login);
|
||||
@@ -155,7 +153,7 @@ function buildEd25519IxData(sig64, pubkey32, messageBytes) {
|
||||
|
||||
function normalizeServerAddresses(values, fallback = null) {
|
||||
const src = Array.isArray(values) && values.length ? values : (fallback ? [fallback] : []);
|
||||
if (src.length > 1) throw new Error('PDA 1.3 поддерживает только один адрес сервера');
|
||||
if (src.length > 1) throw new Error('PDA 1.0 поддерживает только один адрес сервера');
|
||||
return src.map((item) => {
|
||||
const address = String(item?.address ?? item?.serverAddress ?? '').trim();
|
||||
const bytes = new TextEncoder().encode(address);
|
||||
@@ -223,7 +221,7 @@ function parseV12Pda(bytes, header) {
|
||||
if (payload.remaining !== 0) throw new Error('Повреждённый BlockchainRegistry');
|
||||
} else if (blockType === BLOCK_TYPE_SERVER_PROFILE) {
|
||||
const count = payload.readU8();
|
||||
if (count !== 1) throw new Error('PDA 1.3 допускает ровно один адрес в ServerProfileBlock');
|
||||
if (count !== 1) throw new Error('PDA 1.0 допускает ровно один адрес в ServerProfileBlock');
|
||||
serverAddresses = [];
|
||||
for (let j = 0; j < count; j += 1) {
|
||||
serverAddresses.push({
|
||||
@@ -235,7 +233,7 @@ function parseV12Pda(bytes, header) {
|
||||
if (payload.remaining !== 0) throw new Error('Повреждённый ServerProfileBlock');
|
||||
} else if (blockType === BLOCK_TYPE_ACCESS_SERVERS) {
|
||||
const count = payload.readU8();
|
||||
if (count > 1) throw new Error('PDA 1.3 допускает максимум один access server');
|
||||
if (count > 1) throw new Error('PDA 1.0 допускает максимум один access server');
|
||||
accessServers = [];
|
||||
for (let j = 0; j < count; j += 1) accessServers.push(payload.readStrU8());
|
||||
if (payload.remaining !== 0) throw new Error('Повреждённый AccessServersBlock');
|
||||
@@ -277,7 +275,7 @@ export function parseShineUserPda(dataBytes) {
|
||||
const formatMajor = reader.readU8();
|
||||
const formatMinor = reader.readU8();
|
||||
const recordLen = reader.readU16();
|
||||
if (formatMajor !== FORMAT_MAJOR || ![FORMAT_MINOR_PREVIOUS, FORMAT_MINOR_CURRENT].includes(formatMinor)) throw new Error(`Неподдерживаемый формат PDA ${formatMajor}.${formatMinor}`);
|
||||
if (formatMajor !== FORMAT_MAJOR || formatMinor !== FORMAT_MINOR_CURRENT) throw new Error(`Неподдерживаемый формат PDA ${formatMajor}.${formatMinor}`);
|
||||
if (recordLen < 9 + 64 || recordLen > bytes.length) throw new Error('Некорректный record_len');
|
||||
const createdAtMs = reader.readU64();
|
||||
const updatedAtMs = reader.readU64();
|
||||
@@ -311,13 +309,13 @@ function writeVariableBlock(out, blockType, writer) {
|
||||
out[lenPos + 1] = (len >>> 8) & 0xff;
|
||||
}
|
||||
|
||||
/** PDA 1.3 canonical signing message. Only the four limit bytes per fork are skipped.
|
||||
/** PDA 1.0 canonical signing message. Only the four limit bytes per fork are skipped.
|
||||
* All physical length fields remain unchanged, so changing a limit preserves signatures.
|
||||
*/
|
||||
export function canonicalPdaSigningBytes(unsignedBytes) {
|
||||
const bytes = toUint8Array(unsignedBytes);
|
||||
if (bytes.length < 64 || new TextDecoder().decode(bytes.slice(0, 5)) !== MAGIC || bytes[5] !== 1 || bytes[6] !== 3) {
|
||||
throw new Error('Ожидается unsigned PDA v1.3');
|
||||
if (bytes.length < 64 || new TextDecoder().decode(bytes.slice(0, 5)) !== MAGIC || bytes[5] !== FORMAT_MAJOR || bytes[6] !== FORMAT_MINOR_CURRENT) {
|
||||
throw new Error('Ожидается unsigned PDA v1.0');
|
||||
}
|
||||
const rd16 = (i) => bytes[i] | (bytes[i + 1] << 8);
|
||||
if (rd16(7) !== bytes.length + 64) throw new Error('Неверный record_len');
|
||||
@@ -696,36 +694,8 @@ export async function upgradeFreeUserOnSolana({ login, keyBundle, solanaEndpoint
|
||||
}
|
||||
|
||||
export async function registerServerOnSolana({ login, keyBundle, serverAddress, serverAddresses = null, addressFormatType = 1, addressFormatVersion = 0, accessServers = [], solanaEndpoint }) {
|
||||
// Серверная админка показывает баланс client/device-кошелька; именно он оплачивает создание PDA.
|
||||
return createShineUserPdaOnSolana({ login, keyBundle, solanaEndpoint, isServer: true, serverAddress, serverAddresses: serverAddresses || [], addressFormatType, addressFormatVersion, accessServers, feePayerPrivatePkcs8B64: keyBundle.clientPair.privatePkcs8B64 });
|
||||
}
|
||||
|
||||
export async function closeLegacyShineUserPdaOnSolana({ login, solanaEndpoint, callerPrivatePkcs8B64 }) {
|
||||
const cleanLogin = normalizeLogin(login);
|
||||
if (!cleanLogin || !callerPrivatePkcs8B64) throw new Error('Нужны login и private key вызывающего');
|
||||
const solana = await loadSolanaLib();
|
||||
const endpoint = String(solanaEndpoint || '').trim();
|
||||
const connection = new solana.Connection(endpoint, 'confirmed');
|
||||
const usersProgram = new solana.PublicKey(SHINE_USERS_PROGRAM_ID);
|
||||
const [userPda] = solana.PublicKey.findProgramAddressSync([new TextEncoder().encode(SHINE_USERS_USER_PDA_SEED_PREFIX), new TextEncoder().encode(cleanLogin)], usersProgram);
|
||||
const info = await connection.getAccountInfo(userPda, 'confirmed');
|
||||
if (!info) throw new Error('PDA не найдена');
|
||||
const raw = new Uint8Array(info.data);
|
||||
if (raw.length < 7 || new TextDecoder().decode(raw.slice(0, 5)) !== MAGIC || raw[5] !== FORMAT_MAJOR || raw[6] !== FORMAT_MINOR_LEGACY) {
|
||||
throw new Error('Закрывать этой инструкцией можно только legacy PDA 1.0');
|
||||
}
|
||||
const seed32 = extractSeed32FromPkcs8B64(callerPrivatePkcs8B64);
|
||||
const caller = solana.Keypair.fromSeed(seed32);
|
||||
const ix = new solana.TransactionInstruction({
|
||||
programId: usersProgram,
|
||||
keys: [
|
||||
{ pubkey: caller.publicKey, isSigner: true, isWritable: true },
|
||||
{ pubkey: userPda, isSigner: false, isWritable: true },
|
||||
],
|
||||
data: serializeCloseLegacyArgs(cleanLogin),
|
||||
});
|
||||
const signature = await sendAndConfirmSolanaHttp(connection, new solana.Transaction().add(ix), [caller]);
|
||||
return { signature, pdaAddress: userPda.toBase58() };
|
||||
// Единый payer регистрации — blockchain key, как и для обычного пользователя.
|
||||
return createShineUserPdaOnSolana({ login, keyBundle, solanaEndpoint, isServer: true, serverAddress, serverAddresses: serverAddresses || [], addressFormatType, addressFormatVersion, accessServers, feePayerPrivatePkcs8B64: keyBundle.blockchainPair.privatePkcs8B64 });
|
||||
}
|
||||
|
||||
export async function updateShineUserPdaOnSolana({
|
||||
@@ -760,7 +730,7 @@ export async function updateShineUserPdaOnSolana({
|
||||
if ((rootChanged || clientChanged) && !fullKeyRotation) {
|
||||
throw new Error('Root/client keys меняются только как полная ротация: новый root + новый client + новый blockchain fork');
|
||||
}
|
||||
const authMode = AUTH_MODE_ROOT; // Root is the sole user PDA authority in v1.3.
|
||||
const authMode = AUTH_MODE_ROOT; // Root is the sole user PDA authority in v1.0.
|
||||
if (authorityMode != null && authorityMode !== 'root' && authorityMode !== 'blockchain' && authorityMode !== AUTH_MODE_ROOT && authorityMode !== AUTH_MODE_BLOCKCHAIN) {
|
||||
throw new Error('Неподдерживаемый режим authority');
|
||||
}
|
||||
@@ -790,8 +760,7 @@ export async function updateShineUserPdaOnSolana({
|
||||
createdAtMs: current.createdAtMs,
|
||||
updatedAtMs,
|
||||
recordNumber: current.recordNumber + 1,
|
||||
prevRecordHash: await sha256Bytes(current.formatMinor === FORMAT_MINOR_CURRENT
|
||||
? canonicalPdaSigningBytes(current.unsignedBytes) : current.unsignedBytes),
|
||||
prevRecordHash: await sha256Bytes(canonicalPdaSigningBytes(current.unsignedBytes)),
|
||||
rootKey,
|
||||
clientKey,
|
||||
forks,
|
||||
|
||||
@@ -4,13 +4,10 @@ import { authService, state } from '../state.js';
|
||||
import { validateArweaveTxId } from './arweave-file-service.js';
|
||||
import { validatePublicPiecesRoot } from './public-pieces-root.js';
|
||||
import { buildAvatarReference, parseAvatarReference } from './avatar-reference.js';
|
||||
import { CITY_MAX_LENGTH, CITY_PARAM, CITY_SUGGESTIONS } from './cities.js';
|
||||
|
||||
export const profileFieldDefs = [
|
||||
{ key: 'first_name', readKeys: ['first_name'], get label() { return t('remaining.profile_fields.first_name'); }, get placeholder() { return t('remaining.profile_fields.enter_your_first_name'); } },
|
||||
{ key: 'last_name', readKeys: ['last_name'], get label() { return t('remaining.profile_fields.last_name'); }, get placeholder() { return t('remaining.profile_fields.enter_your_last_name'); } },
|
||||
// Город виден в профиле и собирает знакомых в раскладке «Города» на карте связей.
|
||||
{ key: CITY_PARAM, readKeys: [CITY_PARAM], get label() { return t('remaining.profile_fields.city'); }, get placeholder() { return t('remaining.profile_fields.for_example_london'); }, maxLength: CITY_MAX_LENGTH, suggestions: CITY_SUGGESTIONS },
|
||||
{ key: 'address', readKeys: ['address'], get label() { return t('remaining.profile_fields.address'); }, get placeholder() { return t('remaining.profile_fields.street_and_house_number'); } },
|
||||
{ key: 'web', readKeys: ['web'], get label() { return t('remaining.profile_fields.links'); }, get placeholder() { return t('remaining.profile_fields.website_profile_or_other_link'); } },
|
||||
{ key: 'phone', readKeys: ['phone'], get label() { return t('remaining.profile_fields.phone'); }, placeholder: '+7 ...' },
|
||||
|
||||
Reference in New Issue
Block a user