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:
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 98 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 35 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 35 KiB |
+3
-3
@@ -9,8 +9,8 @@
|
||||
<meta name="theme-color" content="#121419" />
|
||||
<base href="/" />
|
||||
<link rel="manifest" href="./manifest.webmanifest" />
|
||||
<link rel="icon" type="image/jpeg" href="./img/logo.jpg" />
|
||||
<link rel="apple-touch-icon" href="./img/logo.jpg" />
|
||||
<link rel="icon" type="image/svg+xml" href="./img/logo.svg" />
|
||||
<link rel="apple-touch-icon" href="./img/logo.svg" />
|
||||
<title>СИЯНИЕ</title>
|
||||
<script>
|
||||
// Язык объявляется сразу, а не после загрузки словарей (js/i18n/index.js): иначе браузер принимает русскую
|
||||
@@ -87,7 +87,7 @@ window.__SHINE_BUILD_HASH__ = '20261119-graph-v4c';
|
||||
<div class="initial-splash__frame">
|
||||
<section class="auth-screen auth-screen--welcome">
|
||||
<div class="auth-logo-wrap">
|
||||
<img class="auth-logo" src="./img/shine-logo-transparent-final.png" alt="Логотип Сияние" />
|
||||
<img class="auth-logo" src="./img/logo.svg" alt="Логотип Сияние" />
|
||||
</div>
|
||||
<div class="stack auth-brand-block">
|
||||
<h1 class="auth-brand"><svg class="shine-wordmark" viewBox="52 -722 7294 744" role="img" aria-label="Сияние"><path fill="currentColor" d="M721 -129Q619 -33 479 -33Q401 -33 341 -60Q281 -87 241 -132Q201 -177 180.5 -236Q160 -295 160 -359Q160 -427 181.5 -483.5Q203 -540 242 -581Q281 -622 334.5 -645Q388 -668 451 -668Q494 -668 529.5 -658Q565 -648 592.5 -632Q620 -616 637.5 -595.5Q655 -575 662 -554H736Q721 -588 697.5 -617Q674 -646 639 -667Q604 -688 557 -700Q510 -712 450 -712Q363 -712 291.5 -687Q220 -662 169 -615.5Q118 -569 90 -503.5Q62 -438 62 -357Q62 -287 84.5 -220.5Q107 -154 154 -102.5Q201 -51 274 -19.5Q347 12 448 12Q512 12 562.5 0Q613 -12 650.5 -29.5Q688 -47 713 -67Q738 -87 751 -102ZM1542 -82V-700H1451V0H1542L1957 -625V0H2048V-700H1957ZM3316 -700V0H3225V-309H3181Q3153 -309 3134.5 -304Q3116 -299 3101 -287Q3086 -275 3073 -256Q3060 -237 3042 -209L2963 -92Q2948 -69 2933.5 -50Q2919 -31 2902 -17.5Q2885 -4 2863.5 4Q2842 12 2812 12Q2790 12 2776 10Q2762 8 2748 0V-37Q2753 -36 2758 -35.5Q2763 -35 2768 -35Q2789 -35 2805 -41Q2821 -47 2835 -58.5Q2849 -70 2862 -86.5Q2875 -103 2889 -124Q2931 -185 2954 -221.5Q2977 -258 2990.5 -278Q3004 -298 3012.5 -307Q3021 -316 3033 -322L3043 -327V-331Q2995 -334 2960.5 -352Q2926 -370 2904 -397Q2882 -424 2872 -455.5Q2862 -487 2862 -517Q2862 -544 2872.5 -576Q2883 -608 2908.5 -635.5Q2934 -663 2978 -681.5Q3022 -700 3089 -700ZM3225 -656H3124Q3086 -656 3055.5 -645Q3025 -634 3003 -614.5Q2981 -595 2969.5 -568Q2958 -541 2958 -509Q2958 -482 2968.5 -454.5Q2979 -427 3000 -404.5Q3021 -382 3051.5 -368Q3082 -354 3122 -354H3225ZM4197 -348H4616V0H4707V-700H4616V-394H4197V-700H4106V0H4197ZM5588 -82V-700H5497V0H5588L6003 -625V0H6094V-700H6003ZM6884 -700V0H7336V-55H6975V-346H7285V-394H6975V-645H7336V-700Z"/></svg></h1>
|
||||
|
||||
@@ -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 ...' },
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</div>
|
||||
|
||||
<h1>Регистрация серверного аккаунта</h1>
|
||||
<p class="subtitle">Создаёт серверную user_pda в Solana (PDA 1.2) по полному логину server@shine</p>
|
||||
<p class="subtitle">Создаёт серверную user_pda в Solana (PDA 1.0) по полному логину server@shine</p>
|
||||
|
||||
<div class="card">
|
||||
<h2>Параметры Solana</h2>
|
||||
@@ -101,21 +101,21 @@
|
||||
<div class="kp-row"><span class="kp-lbl">Приватный</span><input class="kp-inp" type="text" id="rootPriv" placeholder="seed base58, ~44 символа" /></div>
|
||||
</div>
|
||||
<div class="kp-block">
|
||||
<div class="kp-title">Blockchain Key – активный ключ блокчейна и обычный authority PDA</div>
|
||||
<div class="kp-title">Blockchain Key – ключ блокчейна и оплата регистрации Solana</div>
|
||||
<div class="kp-row"><span class="kp-lbl">Публичный</span><input class="kp-inp" type="text" id="bchPub" placeholder="base58, ~44 символа" /></div>
|
||||
<div class="kp-row"><span class="kp-lbl">Приватный</span><input class="kp-inp" type="text" id="bchPriv" placeholder="seed base58, ~44 символа" /></div>
|
||||
</div>
|
||||
<div class="kp-block">
|
||||
<div class="kp-title">Device Key – оплата транзакции Solana</div>
|
||||
<div class="kp-title">Device Key – ключ устройства</div>
|
||||
<div class="kp-row"><span class="kp-lbl">Публичный</span><input class="kp-inp" type="text" id="devPub" placeholder="base58, ~44 символа (= Solana-адрес)" /></div>
|
||||
<div class="kp-row"><span class="kp-lbl">Приватный</span><input class="kp-inp" type="text" id="devPriv" placeholder="seed base58, ~44 символа" /></div>
|
||||
<div class="sol-box" id="solBox">
|
||||
<div class="sol-ttl">Положите SOL на этот адрес перед регистрацией:</div>
|
||||
<div class="sol-adr" id="solAdr"></div>
|
||||
<div class="sol-ht">Это Solana-адрес client/device-ключа (base58). В этой форме он оплачивает создание серверного PDA; для обновления PDA проверьте отдельный экран и его fee payer.</div>
|
||||
<div class="sol-ht">Это Solana-адрес Blockchain Key (base58). Он оплачивает создание серверного PDA, цену namespace и комиссию сети.</div>
|
||||
<button class="btn-secondary sol-topup-btn" id="btnTopupDevnet" type="button">Открыть тестовое пополнение DEVNET</button>
|
||||
<button class="btn-secondary sol-balance-btn" id="btnRefreshBalance" type="button">Показать / обновить баланс device</button>
|
||||
<div class="sol-balance" id="deviceBalance">Баланс device ещё не запрашивался.</div>
|
||||
<button class="btn-secondary sol-balance-btn" id="btnRefreshBalance" type="button">Показать / обновить баланс blockchain</button>
|
||||
<div class="sol-balance" id="deviceBalance">Баланс blockchain ещё не запрашивался.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,6 +27,7 @@ const fieldMap = {
|
||||
bchPriv: 'bchPriv',
|
||||
devPub: 'devPub',
|
||||
devPriv: 'devPriv',
|
||||
paymentPub: 'bchPub',
|
||||
solBox: 'solBox',
|
||||
solAdr: 'solAdr',
|
||||
};
|
||||
@@ -41,9 +42,9 @@ $('endpoint').value = defaultSolanaEndpoint;
|
||||
$('btnTopupDevnet').addEventListener('click', () => {
|
||||
try {
|
||||
if (!String($('endpoint').value || '').includes('devnet')) {
|
||||
throw new Error('Автопополнение доступно только для devnet. Для mainnet пополните device-кошелёк вручную.');
|
||||
throw new Error('Автопополнение доступно только для devnet. Для mainnet пополните blockchain-кошелёк вручную.');
|
||||
}
|
||||
openDevnetTopup($('devPub').value);
|
||||
openDevnetTopup($('bchPub').value);
|
||||
} catch (error) {
|
||||
setStatus($('status'), error?.message || String(error), 'error');
|
||||
}
|
||||
@@ -54,7 +55,7 @@ $('btnRefreshBalance').addEventListener('click', async () => {
|
||||
$('btnRefreshBalance').disabled = true;
|
||||
await refreshDeviceBalance({
|
||||
endpoint: $('endpoint').value,
|
||||
deviceAddress: $('devPub').value,
|
||||
deviceAddress: $('bchPub').value,
|
||||
targetNode: $('deviceBalance'),
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -77,8 +78,8 @@ $('btnGen').addEventListener('click', async () => {
|
||||
});
|
||||
fillKeyFields(fieldMap, keyBundle, masterSecret32);
|
||||
updateSolAddress(fieldMap);
|
||||
$('deviceBalance').textContent = 'Теперь можно проверить баланс device-аккаунта.';
|
||||
setGenMessage($('genMsg'), 'Ключи и master secret сгенерированы из логина и пароля. Транзакцию оплатит device-ключ.', 'ok');
|
||||
$('deviceBalance').textContent = 'Теперь можно проверить баланс blockchain-аккаунта.';
|
||||
setGenMessage($('genMsg'), 'Ключи и master secret сгенерированы из логина и пароля. Транзакцию оплатит blockchain-ключ.', 'ok');
|
||||
} catch (error) {
|
||||
setGenMessage($('genMsg'), error?.message || String(error), 'err');
|
||||
} finally {
|
||||
|
||||
@@ -181,7 +181,7 @@ export function fillKeyFields(fieldMap, keyBundle, masterSecret32) {
|
||||
export function updateSolAddress(fieldMap) {
|
||||
const box = $(fieldMap.solBox);
|
||||
const label = $(fieldMap.solAdr);
|
||||
const pubB58 = String($(fieldMap.devPub).value || '').trim();
|
||||
const pubB58 = String($(fieldMap.paymentPub || fieldMap.devPub).value || '').trim();
|
||||
if (!pubB58) {
|
||||
box.classList.remove('show');
|
||||
label.textContent = '';
|
||||
@@ -204,7 +204,7 @@ export function setText(idOrNode, value) {
|
||||
|
||||
export function wireDeviceAddressPreview(fieldMap) {
|
||||
const update = () => updateSolAddress(fieldMap);
|
||||
$(fieldMap.devPub).addEventListener('input', update);
|
||||
$(fieldMap.paymentPub || fieldMap.devPub).addEventListener('input', update);
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
@@ -1099,7 +1099,7 @@ var solanaWeb3=function(exports){"use strict";function getDefaultExportFromCjs(x
|
||||
const BLOCK_TYPE_ARCHIVE_HEAD = 80;
|
||||
const CORE_MAX_NUMBER = 2147482623;
|
||||
// Transport namespace актуального standalone Viewer.
|
||||
const SHINE_PROTOCOL_NAMESPACE = 'test5595';
|
||||
const SHINE_PROTOCOL_NAMESPACE = 'test5599';
|
||||
const SHINE_ARWEAVE_APP_TAG = SHINE_PROTOCOL_NAMESPACE;
|
||||
const SHINE_ARWEAVE_CHANNEL_TAG = 'c';
|
||||
const BCH_TYPE_TECH = 0;
|
||||
@@ -1845,8 +1845,7 @@ var solanaWeb3=function(exports){"use strict";function getDefaultExportFromCjs(x
|
||||
if (magic !== MAGIC) throw new Error('Некорректный формат PDA: magic не совпадает');
|
||||
const formatMajor = bytes[5];
|
||||
const formatMinor = bytes[6];
|
||||
if (formatMajor === 1 && formatMinor === 2) return parseShineUserPdaV12(bytes);
|
||||
if (formatMajor === 1 && formatMinor === 0) return parseShineUserPdaLegacy(bytes);
|
||||
if (formatMajor === 1 && formatMinor === 0) return parseShineUserPdaV12(bytes);
|
||||
throw new Error(`Неподдерживаемый формат PDA ${formatMajor}.${formatMinor}`);
|
||||
}
|
||||
|
||||
@@ -1937,31 +1936,21 @@ var solanaWeb3=function(exports){"use strict";function getDefaultExportFromCjs(x
|
||||
throw new Error(`HEADER: неожиданный tag ${tag}`);
|
||||
}
|
||||
const login = reader.readUtf8U8();
|
||||
let accountType = null, previousAccounts = [], license = null;
|
||||
let previousAccounts = [];
|
||||
const strict = bytes => new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(bytes);
|
||||
if (version === 3) {
|
||||
accountType = reader.readU8();
|
||||
if (![0,1].includes(accountType)) throw new Error('Invalid HEADER account type');
|
||||
if (accountType === 1) {
|
||||
const csv = strict(reader.readBytes(reader.readU16()));
|
||||
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 = strict(reader.readBytes(reader.readU8()));
|
||||
} else if (version === 2) {
|
||||
const field = bodyBytes.slice(6 + bodyBytes[5], -32);
|
||||
if (field.length === 15 && field.every((b,i) => b === 'license:CC0-1.0'.charCodeAt(i))) {
|
||||
reader.readBytes(15); license = 'CC0-1.0';
|
||||
} else {
|
||||
if (!field.length || field[0] !== field.length - 1) throw new Error('Invalid HEADER license length');
|
||||
license = strict(reader.readBytes(reader.readU8()));
|
||||
const accountType = reader.readU8();
|
||||
if (![0,1].includes(accountType)) throw new Error('Invalid HEADER account type');
|
||||
if (accountType === 1) {
|
||||
const csv = strict(reader.readBytes(reader.readU16()));
|
||||
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 = strict(reader.readBytes(reader.readU8()));
|
||||
const initialBlockchainKey = base64Url(reader.readBytes(32));
|
||||
reader.ensureDone();
|
||||
return { kind: 'header', login, tag, initialBlockchainKey, accountType, previousAccounts, license };
|
||||
@@ -2051,7 +2040,7 @@ var solanaWeb3=function(exports){"use strict";function getDefaultExportFromCjs(x
|
||||
}
|
||||
|
||||
function parseBlockchainBody(type, subType, version, bodyBytes, line) {
|
||||
if (version !== 1 && !(type === BCH_TYPE_TECH && subType === BCH_SUBTYPE_HEADER && [2,3].includes(version))) {
|
||||
if (version !== 1) {
|
||||
return { kind: 'unsupported', reason: `Неподдерживаемая версия body ${version}` };
|
||||
}
|
||||
if (type === BCH_TYPE_TECH && subType === BCH_SUBTYPE_HEADER) {
|
||||
@@ -2094,7 +2083,7 @@ var solanaWeb3=function(exports){"use strict";function getDefaultExportFromCjs(x
|
||||
const core = parseCorePayload(coreBytes);
|
||||
if (contentBytes.length < 7 || contentBytes.length > 8*1024*1024-117 || contentBytes[0] !== 1 || bytesToHex(await digestSha256(contentBytes)) !== core.contentHashHex) throw new Error('CONTENT hash/format mismatch');
|
||||
const type=readUint16BE(contentBytes,1),subType=readUint16BE(contentBytes,3),version=readUint16BE(contentBytes,5);
|
||||
if ((version !== 1 && !(type===0 && subType===0 && [2,3].includes(version))) || (type===0 && subType===0)!==(core.blockNumber===0)) throw new Error('Invalid CONTENT version/HEADER');
|
||||
if (version !== 1 || (type===0 && subType===0)!==(core.blockNumber===0)) throw new Error('Invalid CONTENT version/HEADER');
|
||||
const channelText=type===1 && [10,11,50,90,92,100,110,120,130].includes(subType);
|
||||
const expectedLine=type===0&&subType!==0?2147483647:type===3?2147483646:type===4?2147483645:null;
|
||||
if (channelText ? !core.line||core.line.lineCode>CORE_MAX_NUMBER : expectedLine===null ? !!core.line : core.line?.lineCode!==expectedLine) throw new Error('CONTENT/CORE line mismatch');
|
||||
@@ -3365,7 +3354,7 @@ var solanaWeb3=function(exports){"use strict";function getDefaultExportFromCjs(x
|
||||
function v3RenderBlocks(){ const host=document.getElementById('v3-block-view'); if(!host)return; host.innerHTML=''; const wrap=document.createElement('div'); wrap.className='v3-blocks'; const blocks=(currentBlockchainView?.rawBlocks||V3.blocks||[]).slice().sort((a,b)=>b.blockNumber-a.blockNumber); blocks.forEach(b=>{ const d=document.createElement('details'); d.className='v3-block'; const sm=document.createElement('summary'); sm.textContent=`#${b.blockNumber} · type ${b.type}/${b.subType} · ${formatTimestamp(Number(b.timestampSec)*1000)}`; const pre=document.createElement('pre'); pre.textContent=JSON.stringify({blockNumber:b.blockNumber,type:b.type,subType:b.subType,version:b.version,hash:b.hashHex,prevHash:b.prevHashHex,contentHash:b.contentHashHex,contentDataItemId:b.contentDataItemId,line:b.line,arweaveId:b.arweaveId,body:b.body},(k,v)=>typeof v==='bigint'?String(v):v,2); d.append(sm,pre); wrap.appendChild(d); }); if(!blocks.length)wrap.textContent='Блоки ещё не загружены.'; host.appendChild(wrap); }
|
||||
function v3SetView(mode){ const bv=document.getElementById('v3-block-view'), cb=document.getElementById('content-browser'); document.getElementById('v3-channel-tab').classList.toggle('is-active',mode==='channel'); document.getElementById('v3-blocks-tab').classList.toggle('is-active',mode==='blocks'); if(bv)bv.hidden=mode!=='blocks'; if(cb)cb.hidden=mode==='blocks'; if(mode==='blocks')v3RenderBlocks(); }
|
||||
async function v3ClearCache(){ try{ const keys=Object.keys(localStorage).filter(k=>k.startsWith('shine.viewer.data.')||k.startsWith('shine.viewer.author-chain.')); keys.forEach(k=>localStorage.removeItem(k)); if('caches' in window){ for(const k of await caches.keys()) if(k.startsWith('shine-viewer-')) await caches.delete(k); } v3Log('Кэш данных очищен'); }catch(e){v3Log('Ошибка очистки кэша: '+e.message);} }
|
||||
function v3CacheKey(key,channel){return 'shine.viewer.author-chain.test5595.'+String(key);}
|
||||
function v3CacheKey(key,channel){return 'shine.viewer.author-chain.test5599.'+String(key);}
|
||||
function v3SaveCache(key,channel,blocks){ if(!V3.cacheEnabled)return; try{ localStorage.setItem(v3CacheKey(key,channel),JSON.stringify(blocks,(k,v)=>typeof v==='bigint'?{__bigint:String(v)}:v)); }catch(e){v3Log('Кэш переполнен: '+e.message);} }
|
||||
function v3LoadCache(key,channel){ if(!V3.cacheEnabled)return null; try{return JSON.parse(localStorage.getItem(v3CacheKey(key,channel))||'null',(k,v)=>v&&typeof v==='object'&&v.__bigint!==undefined?BigInt(v.__bigint):v);}catch{return null;} }
|
||||
async function v3RestoreCached(key, channel) {
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
/* Общий диалог подтверждения (js/components/confirm-dialog.js). */
|
||||
.confirm-dialog__card { width: min(100%, 400px); display: grid; gap: 12px; }
|
||||
.confirm-dialog__text { margin: 0; color: var(--text-secondary); font-size: .9375rem; line-height: 1.375rem; overflow-wrap: anywhere; }
|
||||
.confirm-dialog__text { margin: 0; color: var(--text-secondary); font-size: .9375rem; line-height: 1.375rem; overflow-wrap: anywhere; white-space: pre-line; }
|
||||
.confirm-dialog__danger { color: #fff; background: var(--danger); }
|
||||
:root[data-theme='dark'] .confirm-dialog__danger { color: var(--background); }
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
.settings-logo-wrap {
|
||||
width: clamp(150px, 38vw, 210px);
|
||||
margin: 8px auto 0;
|
||||
touch-action: manipulation;
|
||||
}
|
||||
|
||||
|
||||
@@ -551,3 +552,37 @@
|
||||
|
||||
.about-sheet__copy { width: 100%; }
|
||||
|
||||
|
||||
/* Общая информация о ПО и отдельное публичное описание сервера. */
|
||||
.about-app-text {
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.about-app-text a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.about-app-server-heading {
|
||||
margin: 0;
|
||||
font-size: var(--text-lg);
|
||||
font-weight: var(--weight-bold);
|
||||
}
|
||||
.screen-content:has(> .about-app-screen) {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--border-control) var(--border-subtle);
|
||||
}
|
||||
|
||||
/* Постоянные подписи и многострочное поле владельца узла (только чтение). */
|
||||
.about-app-network,
|
||||
.about-app-owner-label {
|
||||
margin: 0;
|
||||
}
|
||||
.about-app-owner {
|
||||
box-sizing: border-box;
|
||||
min-height: calc(6em + 2 * var(--space-3) + 2px);
|
||||
padding: var(--space-3);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-md);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { readFileSync } from 'node:fs';
|
||||
import { profileCardHtml } from '../js/components/profile-card.js';
|
||||
import { accountRoleFromHeader, confirmationRights } from '../js/services/account-voting.js';
|
||||
|
||||
test('only explicit HEADER V3 type 1 is Primary; no legacy fallbacks', () => {
|
||||
test('only explicit HEADER 1.0 type 1 is Primary; no legacy fallbacks', () => {
|
||||
assert.equal(accountRoleFromHeader(1), 'primary');
|
||||
assert.equal(accountRoleFromHeader(0), 'non_voting');
|
||||
for (const x of [undefined, null, '1', 2, true]) assert.equal(accountRoleFromHeader(x), '');
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import vm from 'node:vm';
|
||||
import { appendAboutText } from '../js/services/about-app-text.js';
|
||||
import { confirmDialog } from '../js/components/confirm-dialog.js';
|
||||
|
||||
const source = path => readFileSync(new URL('../js/' + path, import.meta.url), 'utf8');
|
||||
|
||||
test('описание сохраняет исходный текст, а ссылка DAO безопасна и кликабельна', () => {
|
||||
const previous = globalThis.document;
|
||||
try {
|
||||
globalThis.document = {
|
||||
createTextNode: textContent => ({ textContent }),
|
||||
createElement: tag => ({ tag }),
|
||||
};
|
||||
const nodes = [];
|
||||
const input = '<script>alert(1)</script>\nhttps://v2.realms.today/dao/abc/\nhttps://user:pass@example.org/\njavascript:alert(1)';
|
||||
appendAboutText({ append: node => nodes.push(node) }, input);
|
||||
assert.equal(nodes.map(n => n.textContent).join(''), input);
|
||||
const links = nodes.filter(n => n.tag === 'a');
|
||||
assert.equal(links.length, 1);
|
||||
assert.equal(links[0].href, 'https://v2.realms.today/dao/abc/');
|
||||
assert.equal(links[0].rel, 'noopener noreferrer');
|
||||
assert.equal(links[0].target, '_blank');
|
||||
} finally { globalThis.document = previous; }
|
||||
});
|
||||
|
||||
test('маршрут About сохраняет вкладку профиля и корректно разбирается', () => {
|
||||
const code = source('router.js').replace(/^import .*$/gm, '').replace(/^export /gm, '');
|
||||
const router = vm.runInNewContext(code + '\n({toPrettyPath,parseRouteFromPath,resolveToolbarActive})', {
|
||||
window: { location: { pathname: '/settings' } }, parseShineRouteParts: () => null,
|
||||
});
|
||||
assert.equal(router.toPrettyPath('about-app-view'), 'settings/about');
|
||||
assert.equal(router.parseRouteFromPath('/settings/about').pageId, 'about-app-view');
|
||||
assert.equal(router.resolveToolbarActive('about-app-view'), 'profile-view');
|
||||
});
|
||||
|
||||
test('пять быстрых нажатий на логотип, медленные нажатия сбрасывают счётчик', () => {
|
||||
const code = source('pages/settings-view.js');
|
||||
const handler = code.slice(code.indexOf(' let logoTapCount'), code.indexOf(' const card ='));
|
||||
let click, now = 10000;
|
||||
const routes = [];
|
||||
vm.runInNewContext(handler, {
|
||||
logo: { addEventListener: (_, cb) => { click = cb; } },
|
||||
Date: { now: () => now }, navigate: route => routes.push(route),
|
||||
});
|
||||
for (let i = 0; i < 4; i++) { click(); now += 100; }
|
||||
assert.deepEqual(routes, []);
|
||||
now += 1000;
|
||||
for (let i = 0; i < 4; i++) { click(); now += 100; }
|
||||
assert.deepEqual(routes, []);
|
||||
click();
|
||||
assert.deepEqual(routes, ['developer-settings-view']);
|
||||
});
|
||||
|
||||
test('отмена диалога при уходе со страницы и повторное завершение безопасны', async () => {
|
||||
const old = globalThis.document;
|
||||
const events = new Map();
|
||||
let removed = 0;
|
||||
const buttons = new Map();
|
||||
const modal = {
|
||||
querySelector: key => {
|
||||
if (!buttons.has(key)) buttons.set(key, { focus() {} });
|
||||
return buttons.get(key);
|
||||
},
|
||||
addEventListener: (key, cb) => events.set(key, cb),
|
||||
remove: () => { removed++; },
|
||||
};
|
||||
try {
|
||||
globalThis.document = {
|
||||
activeElement: { focus() {} }, createElement: () => modal,
|
||||
addEventListener: (key, cb) => events.set(key, cb),
|
||||
removeEventListener: key => events.delete(key), body: { append() {} },
|
||||
};
|
||||
const controller = new AbortController();
|
||||
const pending = confirmDialog({ title: 'Call', confirmLabel: 'Continue', cancelLabel: 'Cancel', signal: controller.signal });
|
||||
controller.abort();
|
||||
assert.equal(await pending, false);
|
||||
assert.equal(removed, 1);
|
||||
events.get('click')({ target: modal });
|
||||
assert.equal(removed, 1);
|
||||
assert.equal(events.has('keydown'), false);
|
||||
assert.equal(await confirmDialog({ signal: controller.signal }), false);
|
||||
} finally { globalThis.document = old; }
|
||||
});
|
||||
|
||||
function aboutHarness(request) {
|
||||
const code = source('pages/about-app-view.js').replace(/^import .*$/gm, '').replace(/^export /gm, '');
|
||||
const node = () => ({ children: [], append(...items) { this.children.push(...items); }, replaceChildren(...items) { this.children = items; } });
|
||||
let language = 'ru';
|
||||
const result = vm.runInNewContext(code + '\n({render,pageMeta})', {
|
||||
document: { createElement: node },
|
||||
t: key => key === 'screens.about_app_view.software_description' ? `Software ${language}` : ['network_membership', 'owner_label'].some(name => key.endsWith('.' + name)) ? `${key} ${language}` : key,
|
||||
createTopBar: () => ({}), createErrorState: opts => ({ error: true, ...opts }), createLoadingState: () => ({ loading: true }),
|
||||
appendAboutText: (el, text) => el.append({ textContent: text }),
|
||||
authService: { ws: { request } },
|
||||
});
|
||||
return { ...result, setLanguage: value => { language = value; } };
|
||||
}
|
||||
const tick = () => new Promise(resolve => setImmediate(resolve));
|
||||
|
||||
test('About: версия локализована, описание узла одинаковое, полоса прокрутки включена', async () => {
|
||||
const requests = [];
|
||||
const { render, pageMeta, setLanguage } = aboutHarness(async (op, payload) => {
|
||||
requests.push([op, Object.keys(payload)]);
|
||||
return { payload: { aboutText: 'OpenMindSoft LLC (Georgia)\nhttps://example.org/' } };
|
||||
});
|
||||
assert.equal(pageMeta.shellMode.scrollbar, 'auto');
|
||||
assert.equal(pageMeta.shellMode.scrollContainer, 'screen');
|
||||
const ru = render({});
|
||||
setLanguage('en');
|
||||
const en = render({});
|
||||
await tick();
|
||||
assert.equal(ru.children[0].children[0].textContent, 'Software ru');
|
||||
assert.equal(en.children[0].children[0].textContent, 'Software en');
|
||||
for (const [screen, lang] of [[ru, 'ru'], [en, 'en']]) {
|
||||
const [, network, label, owner] = screen.children[1].children;
|
||||
assert.equal(network.textContent, `screens.about_app_view.network_membership ${lang}`);
|
||||
assert.equal(label.textContent, `screens.about_app_view.owner_label ${lang}`);
|
||||
assert.match(owner.className, /about-app-owner/);
|
||||
assert.equal(owner.children[0].textContent, 'OpenMindSoft LLC (Georgia)\nhttps://example.org/');
|
||||
}
|
||||
assert.deepEqual(requests, [['GetServerInfo', []], ['GetServerInfo', []]]);
|
||||
});
|
||||
|
||||
test('About: ошибка, пустое описание и повторный запрос не скрывают сведения о ПО', async () => {
|
||||
let count = 0;
|
||||
const { render } = aboutHarness(async () => {
|
||||
count++;
|
||||
if (count === 1) throw Error('Offline');
|
||||
return { payload: { aboutText: count === 2 ? '' : 'Owner' } };
|
||||
});
|
||||
const screen = render({});
|
||||
const software = screen.children[0];
|
||||
const description = screen.children[1].children[3];
|
||||
await tick();
|
||||
assert.equal(description.children[0].error, true);
|
||||
await description.children[0].onRetry();
|
||||
assert.equal(description.children[0].title, 'screens.about_app_view.unavailable');
|
||||
await description.children[0].onRetry();
|
||||
assert.equal(description.children[0].textContent, 'Owner');
|
||||
assert.equal(screen.children[0], software);
|
||||
});
|
||||
|
||||
test('About: словари содержат версию, DAO и не содержат владельца узла', () => {
|
||||
for (const lang of ['ru', 'en']) {
|
||||
const dictionary = JSON.parse(source(`i18n/locales/${lang}.json`));
|
||||
const text = dictionary.screens.about_app_view.software_description;
|
||||
assert.match(text, /0\.9 Alpha/);
|
||||
assert.match(text, /https:\/\/v2.realms.today\/dao\/FcMg5G3RpAYvW3vvztrcMuFXifWYR3HYiTuPfVgwuN4K\//);
|
||||
assert.doesNotMatch(text, /OpenMindSoft/);
|
||||
assert.ok(dictionary.screens.about_app_view.network_membership);
|
||||
assert.match(dictionary.screens.about_app_view.owner_label, /:$/);
|
||||
}
|
||||
});
|
||||
@@ -12,10 +12,10 @@ test('CORE эпоха одинакова в UI, Server, discovery и серти
|
||||
const viewer = read('shine-UI/static-sites/arweave-viewer/index.html');
|
||||
const reg = read('SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationCertificateV1.java');
|
||||
const archive = read('SHiNE-server/shine-server-archive/src/main/java/server/archive/ArweaveBlocksConfig.java');
|
||||
assert.match(ui, /SHINE_CORE_NAMESPACE\s*=\s*'test5595'/);
|
||||
assert.match(ui, /SHINE_CORE_NAMESPACE\s*=\s*'test5599'/);
|
||||
assert.match(archive, /TEST_TAG_VALUE\s*=\s*ShineProtocolTags\.CORE_NAMESPACE/);
|
||||
assert.match(server, /CORE_NAMESPACE\s*=\s*"test5595"/);
|
||||
assert.match(viewer, /SHINE_PROTOCOL_NAMESPACE\s*=\s*'test5595'/);
|
||||
assert.match(server, /CORE_NAMESPACE\s*=\s*"test5599"/);
|
||||
assert.match(viewer, /SHINE_PROTOCOL_NAMESPACE\s*=\s*'test5599'/);
|
||||
assert.match(reg, /ShineProtocolTags\.CORE_REGISTRATION_TAGS/);
|
||||
for (const txt of [ui, server, viewer, reg]) assert.doesNotMatch(txt, /test5591/);
|
||||
});
|
||||
|
||||
@@ -15,8 +15,8 @@ const special = new Map([[SHINE_CORE_LINE_PROFILE,'P'],[SHINE_CORE_LINE_CONNECTI
|
||||
|
||||
test('CORE v2 namespace и числовые линии согласованы в Java и UI', () => {
|
||||
const server=fs.readFileSync(new URL('../../SHiNE-server/shine-server-blockchain/src/main/java/blockchain/ShineProtocolTags.java',import.meta.url),'utf8');
|
||||
assert.equal(SHINE_CORE_NAMESPACE,'test5595');
|
||||
assert.match(server,/CORE_NAMESPACE\s*=\s*"test5595"/);
|
||||
assert.equal(SHINE_CORE_NAMESPACE,'test5599');
|
||||
assert.match(server,/CORE_NAMESPACE\s*=\s*"test5599"/);
|
||||
assert.equal(SHINE_CORE_MAX_BLOCK_NUMBER,2147482623);
|
||||
assert.deepEqual([...special.keys()],[2147483645,2147483646,2147483647]);
|
||||
});
|
||||
@@ -92,20 +92,20 @@ test('Minimal pair codec and container: exact vectors, tampering, unsigned lengt
|
||||
|
||||
|
||||
import { inspectBlockchainDataItem } from '../js/services/blockchain-entry-inspector.js';
|
||||
test('HEADER v2 signed CORE/CONTENT and inspector accept arbitrary UTF-8 license', async () => {
|
||||
test('HEADER 1.0 signed CORE/CONTENT and inspector accept arbitrary UTF-8 license', async () => {
|
||||
const pkcs8=Buffer.concat([unhex('302e020100300506032b657004220420'),Buffer.from(Array.from({length:32},(_,i)=>i))]);
|
||||
const key=await crypto.subtle.importKey('pkcs8',pkcs8,{name:'Ed25519'},false,['sign']);
|
||||
const owner=unhex(rows[0][1]);
|
||||
const login=Buffer.from('Alice@shine');
|
||||
for (const license of ['', 'CC-BY-NC-4.0', 'Лицензия 🌞', '\ufeffx', 'x'.repeat(255)]) {
|
||||
const bytes=Buffer.from(license);
|
||||
const body=Buffer.concat([Buffer.from('SHiNE'),Buffer.of(login.length),login,Buffer.of(bytes.length),bytes,owner]);
|
||||
const content={type:0,subType:0,version:2,body};
|
||||
const body=Buffer.concat([Buffer.from('SHiNE'),Buffer.of(login.length),login,Buffer.of(1, 0, 0, bytes.length),bytes,owner]);
|
||||
const content={type:0,subType:0,version:1,body};
|
||||
const signed=await signCoreContentPair({owner32:owner,privateKey:key,content,prevCoreHash32:new Uint8Array(32),blockNumber:0,timestamp:1700001000n,line:null});
|
||||
const raw=packCoreContent(signed.coreDataItem,signed.contentDataItem);
|
||||
const result=await inspectBlockchainDataItem(Buffer.from(raw).toString('base64'));
|
||||
assert.equal(result.frame.body.license,license);
|
||||
assert.equal(result.frame.version,2);
|
||||
assert.equal(result.frame.version,1);
|
||||
await assert.rejects(signCoreContentPair({owner32:owner,privateKey:key,content:{...content,version:4},prevCoreHash32:new Uint8Array(32),blockNumber:0,timestamp:1700001000n,line:null}));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -16,85 +16,54 @@ const encode = vm.runInNewContext(`function makeHeaderBodyBytes(${source}\nmakeH
|
||||
Uint8Array,
|
||||
});
|
||||
|
||||
test('client writes HEADER v2 as SHiNE → login → length + license → key', () => {
|
||||
function inspectorParser() {
|
||||
const stripped = inspector.replace(/^import .+;\s*$/gm, '').replace(/^export /gm, '');
|
||||
return vm.runInNewContext(`${stripped}\nparseShineFrame`, {
|
||||
TextDecoder, DataView, Uint8Array, BigInt,
|
||||
bytesToBase64Url: bytes => Buffer.from(bytes).toString('base64url'), Buffer,
|
||||
});
|
||||
}
|
||||
|
||||
function headerFrame(body, version = 1) {
|
||||
const frame = new Uint8Array(88 + body.length);
|
||||
const view = new DataView(frame.buffer);
|
||||
view.setUint16(0, 1, false);
|
||||
view.setInt32(66, frame.length, false);
|
||||
view.setInt32(70, 0, false);
|
||||
view.setBigInt64(74, 0n, false);
|
||||
view.setUint16(82, 0, false);
|
||||
view.setUint16(84, 0, false);
|
||||
view.setUint16(86, version, false);
|
||||
frame.set(body, 88);
|
||||
return frame;
|
||||
}
|
||||
|
||||
test('client writes only HEADER 1.0: identity, arbitrary license, then initial key', () => {
|
||||
const key = Uint8Array.from({ length: 32 }, (_, i) => i + 1);
|
||||
const login = 'Alice@shine';
|
||||
const license = 'Лицензия 🌞';
|
||||
const body = encode({ login, initialBlockchainKey32: key, license });
|
||||
const loginBytes = utf8(login);
|
||||
const previous = 'Bob@free,Older';
|
||||
const body = encode({ login, initialBlockchainKey32: key, accountType: 1, previousAccounts: ['Bob@free', 'Older'], license });
|
||||
const expected = Uint8Array.from([
|
||||
...utf8('SHiNE'), loginBytes.length, ...loginBytes,
|
||||
utf8(license).length, ...utf8(license), ...key,
|
||||
...utf8('SHiNE'), utf8(login).length, ...utf8(login),
|
||||
1, 0, utf8(previous).length, ...utf8(previous), utf8(license).length, ...utf8(license), ...key,
|
||||
]);
|
||||
assert.deepEqual(Array.from(body), Array.from(expected));
|
||||
assert.match(auth, /msgSubType: MSG_SUBTYPE_TECH_HEADER,\s*msgVersion: HEADER_VERSION/);
|
||||
assert.match(auth, /export const HEADER_VERSION = 3/);
|
||||
assert.match(auth, /export const HEADER_VERSION = 1/);
|
||||
});
|
||||
|
||||
test('inspector decodes both v1 and v2 and supports arbitrary license and rejects malformed v2', () => {
|
||||
const stripped = inspector.replace(/^import .+;\s*$/gm, '').replace(/^export /gm, '');
|
||||
const inspect = vm.runInNewContext(`${stripped}\nparseShineFrame`, {
|
||||
TextDecoder, DataView, Uint8Array, BigInt,
|
||||
bytesToBase64Url: bytes => Buffer.from(bytes).toString('base64url'),
|
||||
Buffer,
|
||||
});
|
||||
test('inspector accepts only HEADER 1.0 and validates its identity and license', () => {
|
||||
const inspect = inspectorParser();
|
||||
const key = Uint8Array.from({ length: 32 }, (_, i) => i + 1);
|
||||
const login = utf8('Alice@shine');
|
||||
const prefix = Uint8Array.from([...utf8('SHiNE'), login.length, ...login]);
|
||||
const bodyV1 = Uint8Array.from([...prefix, ...key]);
|
||||
const bodyV2 = Uint8Array.from([...prefix, ...utf8('license:CC0-1.0'), ...key]);
|
||||
const frameFor = (version, body) => {
|
||||
const frame = new Uint8Array(88 + body.length);
|
||||
const view = new DataView(frame.buffer);
|
||||
view.setUint16(0, 1, false); // frameCode
|
||||
view.setInt32(66, frame.length, false);
|
||||
view.setInt32(70, 0, false); // blockNumber
|
||||
view.setBigInt64(74, 0n, false);
|
||||
view.setUint16(82, 0, false); // type TECH
|
||||
view.setUint16(84, 0, false); // subtype HEADER
|
||||
view.setUint16(86, version, false);
|
||||
frame.set(body, 88);
|
||||
return frame;
|
||||
};
|
||||
const old = inspect(frameFor(1, bodyV1));
|
||||
assert.equal(old.body.kind, 'header');
|
||||
assert.equal(old.body.license, null);
|
||||
const current = inspect(frameFor(2, bodyV2));
|
||||
assert.equal(current.body.kind, 'header');
|
||||
assert.equal(current.body.license, 'CC0-1.0');
|
||||
assert.equal(current.body.initialBlockchainKey, Buffer.from(key).toString('base64url'));
|
||||
assert.throws(() => inspect(frameFor(2, Uint8Array.from([...prefix, ...key, ...utf8('license:CC0-1.0')]))));
|
||||
const invalid = bodyV2.slice();
|
||||
invalid[prefix.length + 8] = 'X'.charCodeAt(0);
|
||||
assert.throws(() => inspect(frameFor(2, invalid)));
|
||||
for (const license of ['', 'CC-BY-NC-4.0', 'Лицензия 🌞', 'x'.repeat(255)]) {
|
||||
const body = encode({ login: 'Alice@shine', initialBlockchainKey32: key, license });
|
||||
assert.equal(inspect(frameFor(2, body)).body.license, license);
|
||||
assert.throws(() => inspect(frameFor(2, body.slice(0, -1))));
|
||||
const body = encode({ login: 'Alice@shine', initialBlockchainKey32: key, accountType: 1, previousAccounts: ['Bob@free'], license });
|
||||
const parsed = inspect(headerFrame(body)).body;
|
||||
assert.equal(parsed.accountType, 1);
|
||||
assert.deepEqual(Array.from(parsed.previousAccounts), ['Bob@free']);
|
||||
assert.equal(parsed.license, license);
|
||||
assert.throws(() => inspect(headerFrame(body.slice(0, -1))));
|
||||
assert.equal(inspect(headerFrame(body, 2)).body.kind, 'unsupported_version');
|
||||
}
|
||||
assert.throws(() => encode({ login: 'Alice@shine', initialBlockchainKey32: key, license: 'x'.repeat(256) }));
|
||||
assert.throws(() => inspect(frameFor(2, Uint8Array.from([...prefix, 1, 255, ...key]))));
|
||||
assert.throws(() => inspect(frameFor(2, new Uint8Array(0))));
|
||||
});
|
||||
|
||||
test('HEADER v3: actual serializer and inspector agree on identity and reject malformed declarations', () => {
|
||||
const stripped = inspector.replace(/^import .+;\s*$/gm, '').replace(/^export /gm, '');
|
||||
const inspect = vm.runInNewContext(`${stripped}\nparseShineFrame`, {TextDecoder, DataView, Uint8Array, BigInt, bytesToBase64Url: b => Buffer.from(b).toString('base64url'), Buffer});
|
||||
const login = 'Alice@shine', key = Uint8Array.from({length:32}, (_,i)=>i+1);
|
||||
const prefix = [...utf8('SHiNE'), utf8(login).length, ...utf8(login)];
|
||||
const frame = body => {const a=new Uint8Array(88+body.length), v=new DataView(a.buffer);v.setUint16(0,1);v.setInt32(66,a.length);v.setUint16(86,3);a.set(body,88);return a;};
|
||||
const make = (accountType,previousAccounts=[],license='')=>encode({login,initialBlockchainKey32:key,accountType,previousAccounts,license});
|
||||
assert.deepEqual([...make(0)], [...prefix,0,0,...key]);
|
||||
assert.deepEqual([...make(1)], [...prefix,1,0,0,0,...key]);
|
||||
for(const previousAccounts of [[],['Bob@free','Older'],Array.from({length:10},(_,i)=>'old'+i+'@free')]) {
|
||||
const body=make(1,previousAccounts,'Лицензия');
|
||||
const parsed=inspect(frame(body)).body;
|
||||
assert.equal(parsed.accountType,1);assert.deepEqual(Array.from(parsed.previousAccounts),previousAccounts);assert.equal(parsed.license,'Лицензия');
|
||||
assert.throws(()=>inspect(frame(body.slice(0,-1))));
|
||||
}
|
||||
assert.equal(inspect(frame(make(0))).body.accountType,0);
|
||||
for(const list of [['ALICE@shine'],['Bob@free','bob@free'],['a,b'],Array.from({length:11},(_,i)=>'old'+i)]) assert.throws(()=>make(1,list));
|
||||
assert.throws(()=>make(0,['Bob@free']));assert.throws(()=>make(2));
|
||||
const bad=make(1);bad[prefix.length]=2;assert.throws(()=>inspect(frame(bad)));
|
||||
const csv=utf8('Bob@free,bob@free');assert.throws(()=>inspect(frame(Uint8Array.from([...prefix,1,0,csv.length,...csv,0,...key]))));
|
||||
assert.throws(() => encode({ login: 'Alice@shine', initialBlockchainKey32: key, accountType: 0, previousAccounts: ['Bob@free'] }));
|
||||
});
|
||||
|
||||
@@ -29,11 +29,11 @@ test('viewer: rejects tampered CONTENT, invalid CORE and wrong indexed tags',asy
|
||||
test('viewer: requests CORE then CONTENT by ID and never claims signature verification',async()=>{
|
||||
const f=find('post'),id=itemid(f.coreItemId),cid=itemid(f.contentItemId),calls=[];
|
||||
ctx.fetch=async url=>{calls.push(url);const raw=url.endsWith(cid)?f.content:f.core;return {ok:true,arrayBuffer:async()=>bytes(raw).buffer};};
|
||||
const r=await v.loadArweavePairs('https://mock.invalid',[{id,owner:{address:'indexed'},tags:[{name:'App',value:'test5595'},{name:'n',value:'2'},{name:'l',value:'1'}]}]);
|
||||
const r=await v.loadArweavePairs('https://mock.invalid',[{id,owner:{address:'indexed'},tags:[{name:'App',value:'test5599'},{name:'n',value:'2'},{name:'l',value:'1'}]}]);
|
||||
assert.deepEqual(calls,[`https://mock.invalid/${id}`,`https://mock.invalid/${cid}`]);assert.equal(r.blocks[0].hashHex,f.coreHash);
|
||||
const checks=v.v3Verification(r.blocks);assert.equal(checks.signature.ok,0);assert.equal(checks.signature.na,1);assert.equal(checks.global.na,1);
|
||||
ctx.fetch=async url=>url.endsWith(cid)?{ok:false,status:404}:{ok:true,arrayBuffer:async()=>bytes(f.core).buffer};
|
||||
await assert.rejects(v.loadArweavePairs('https://mock.invalid',[{id,tags:[{name:'App',value:'test5595'},{name:'n',value:'2'},{name:'l',value:'1'}]}]),/CONTENT.*404/);
|
||||
await assert.rejects(v.loadArweavePairs('https://mock.invalid',[{id,tags:[{name:'App',value:'test5599'},{name:'n',value:'2'},{name:'l',value:'1'}]}]),/CONTENT.*404/);
|
||||
});
|
||||
test('viewer: parses historical v2 and v3 primary declaration',async()=>{
|
||||
const f=find('header'), old=bytes(f.content), key=old.slice(-32), prefix=old.slice(7,-32);
|
||||
|
||||
@@ -24,18 +24,21 @@ const context = {
|
||||
};
|
||||
const makeHeaderBodyBytes = vm.runInNewContext(`function makeHeaderBodyBytes(${makeBytesFunction}\nmakeHeaderBodyBytes`, context);
|
||||
|
||||
test('CORE/CONTENT HEADER v2 contains login, empty license and initial key', () => {
|
||||
test('CORE/CONTENT HEADER 1.0 contains identity, arbitrary license and initial key', () => {
|
||||
const key = Uint8Array.from({ length: 32 }, (_, n) => n + 1);
|
||||
const result = makeHeaderBodyBytes({ login: 'Alice@shine', initialBlockchainKey32: key });
|
||||
const login = new TextEncoder().encode('Alice@shine');
|
||||
assert.equal(new TextDecoder().decode(result.slice(0,5)), 'SHiNE');
|
||||
assert.equal(result[5], login.length);
|
||||
assert.deepEqual(Array.from(result.slice(6, 6+login.length)), Array.from(login));
|
||||
assert.deepEqual(Array.from(result.slice(7+login.length)), Array.from(key));
|
||||
assert.equal(result[6+login.length], 0);
|
||||
assert.equal(result.length, 5 + 1 + login.length + 1 + 32);
|
||||
const identityOffset = 6 + login.length;
|
||||
assert.equal(result[identityOffset], 1);
|
||||
assert.deepEqual(Array.from(result.slice(identityOffset + 1, identityOffset + 3)), [0, 0]);
|
||||
assert.equal(result[identityOffset + 3], 0);
|
||||
assert.deepEqual(Array.from(result.slice(identityOffset + 4)), Array.from(key));
|
||||
assert.equal(result.length, 5 + 1 + login.length + 1 + 2 + 1 + 32);
|
||||
assert.match(auth, /msgSubType: MSG_SUBTYPE_TECH_HEADER,\s*msgVersion: HEADER_VERSION/);
|
||||
assert.match(auth, /export const HEADER_VERSION = 3/);
|
||||
assert.match(auth, /export const HEADER_VERSION = 1/);
|
||||
});
|
||||
|
||||
test('free and paid registration both require accepted documents before any registration operation', { skip: !hasRegistrationTerms }, () => {
|
||||
|
||||
@@ -17,5 +17,5 @@ test('форма создания требует namespace type1 и правил
|
||||
assert.match(page, /namespace\.type !== 1/);
|
||||
assert.match(page, /getNamespace\(/);
|
||||
assert.match(html, /maxlength="30"/);
|
||||
assert.match(service, /feePayerPrivatePkcs8B64: keyBundle\.clientPair\.privatePkcs8B64/);
|
||||
assert.match(service, /feePayerPrivatePkcs8B64: keyBundle\.blockchainPair\.privatePkcs8B64/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user