SHA256
UI: обновлена шапка каналов, закрыты pending-задачи и обновлены версии
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
getBalanceSol,
|
||||
getTopupSiteUrl,
|
||||
} from '../services/solana-wallet-service.js';
|
||||
import { registerUserOnSolana } from '../services/solana-register-service.js';
|
||||
|
||||
export const pageMeta = { id: 'registration-payment-view', title: 'Оплата регистрации', showAppChrome: false };
|
||||
const MIN_REQUIRED_SOL = 0.01;
|
||||
@@ -136,6 +137,12 @@ export function render({ navigate }) {
|
||||
}
|
||||
});
|
||||
|
||||
const showKeysButton = document.createElement('button');
|
||||
showKeysButton.className = 'ghost-btn';
|
||||
showKeysButton.type = 'button';
|
||||
showKeysButton.textContent = 'Показать сгенерированные ключи';
|
||||
showKeysButton.addEventListener('click', () => navigate('registration-draft-keys-view'));
|
||||
|
||||
const submitButton = document.createElement('button');
|
||||
submitButton.className = 'primary-btn';
|
||||
submitButton.type = 'button';
|
||||
@@ -143,8 +150,8 @@ export function render({ navigate }) {
|
||||
submitButton.addEventListener('click', async () => {
|
||||
status.style.display = 'none';
|
||||
|
||||
const cryptoState = getCryptoRuntimeState();
|
||||
if (!cryptoState.hasCrypto || !cryptoState.hasGetRandomValues || !cryptoState.hasSubtle) {
|
||||
const cryptoState = getCryptoRuntimeState();
|
||||
if (!cryptoState.hasCrypto || !cryptoState.hasGetRandomValues || !cryptoState.hasSubtle) {
|
||||
status.className = 'status-line is-unavailable';
|
||||
status.textContent = 'Криптография браузера недоступна. Откройте приложение через HTTPS tunnel или localhost и повторите регистрацию.';
|
||||
status.style.display = '';
|
||||
@@ -169,6 +176,33 @@ export function render({ navigate }) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Используем предсгенерированный keyBundle или генерируем заново
|
||||
let keyBundle = state.registrationDraft.preGeneratedKeyBundle;
|
||||
if (!keyBundle) {
|
||||
keyBundle = await authService.derivePasswordKeyBundle(
|
||||
state.registrationDraft.login,
|
||||
state.registrationDraft.password,
|
||||
);
|
||||
}
|
||||
|
||||
// Регистрация на Solana (смарт контракт)
|
||||
submitButton.textContent = 'Регистрация в Solana...';
|
||||
try {
|
||||
await registerUserOnSolana({
|
||||
login: state.registrationDraft.login,
|
||||
keyBundle,
|
||||
solanaEndpoint: state.entrySettings.solanaServer,
|
||||
});
|
||||
} catch (solanaError) {
|
||||
const solanaMsg = String(solanaError?.message || '');
|
||||
// Пользователь уже зарегистрирован в Solana — продолжаем
|
||||
if (!solanaMsg.includes('already') && !solanaMsg.includes('UserAlreadyExists')) {
|
||||
throw new Error(`Ошибка регистрации в Solana: ${solanaMsg}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Регистрация на сервере SHiNE
|
||||
submitButton.textContent = 'Регистрация на сервере...';
|
||||
await authService.reconnect(state.entrySettings.shineServer);
|
||||
const result = await authService.registerUser(state.registrationDraft.login, state.registrationDraft.password);
|
||||
state.registrationDraft.flowType = 'registration';
|
||||
@@ -200,7 +234,7 @@ export function render({ navigate }) {
|
||||
`;
|
||||
card.children[1].append(walletRow);
|
||||
card.children[2].append(balanceRow);
|
||||
card.append(topupButton, submitButton, status);
|
||||
card.append(topupButton, showKeysButton, submitButton, status);
|
||||
|
||||
screen.append(
|
||||
renderHeader({
|
||||
|
||||
Reference in New Issue
Block a user