SHA256
CORE/CONTENT test5593 и адаптация UI
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Регистрация сервера – SHiNE Server Admin</title>
|
||||
<link rel="stylesheet" href="styles.css" />
|
||||
<style>
|
||||
.pwd-wrap { display: flex; }
|
||||
.pwd-wrap input { flex: 1; border-radius: var(--radius) 0 0 var(--radius); }
|
||||
.btn-eye { border: 1px solid var(--border); border-left: none; background: #0d0d0d;
|
||||
color: var(--text-muted); border-radius: 0 var(--radius) var(--radius) 0;
|
||||
padding: 0 16px; cursor: pointer; font-size: 13px; }
|
||||
.btn-eye:hover { color: var(--accent); border-color: var(--accent); }
|
||||
.gen-msg { font-size: 12px; margin-top: 8px; padding: 8px 12px; border-radius: var(--radius); display: none; }
|
||||
.gen-msg.ok { display:block; background:#1a2e1a; border:1px solid #2a4a2a; color:#7dcc7d; }
|
||||
.gen-msg.err { display:block; background:#2e1a1a; border:1px solid #5a2a2a; color:#f08080; }
|
||||
.kp-title { font-size:11px; font-weight:700; color:var(--accent); text-transform:uppercase; letter-spacing:.06em; margin-bottom:8px; }
|
||||
.kp-row { display:flex; gap:8px; align-items:flex-start; margin-bottom:6px; }
|
||||
.kp-row:last-child { margin-bottom:0; }
|
||||
.kp-lbl { font-size:11px; color:var(--text-muted); min-width:60px; padding-top:10px; }
|
||||
.kp-inp { flex:1; font-size:11px; font-family:monospace; padding:8px 10px; }
|
||||
.kp-block { margin-bottom:14px; padding-bottom:14px; border-bottom:1px solid var(--border); }
|
||||
.kp-block:last-child { border-bottom:none; margin-bottom:0; padding-bottom:0; }
|
||||
.sec-lbl { font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.06em; margin:16px 0 10px; }
|
||||
.sol-box { margin-top:14px; background:#0d1a0d; border:1px solid #2a4a2a; border-radius:var(--radius); padding:10px 14px; display:none; }
|
||||
.sol-box.show { display:block; }
|
||||
.sol-ttl { font-size:12px; font-weight:600; color:#7dcc7d; }
|
||||
.sol-adr { font-family:monospace; font-size:12px; word-break:break-all; margin-top:4px; }
|
||||
.sol-ht { font-size:11px; color:var(--text-muted); margin-top:4px; }
|
||||
.sol-topup-btn { margin-top:10px; width:100%; }
|
||||
.sol-balance-btn { margin-top:10px; width:100%; }
|
||||
.sol-balance { font-size:11px; color:var(--text-muted); margin-top:8px; word-break:break-all; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="nav-links">
|
||||
<a href="../server-ui.html">← Назад</a>
|
||||
<a href="update-server-pda.html">Обновить PDA</a>
|
||||
<a href="read-pda.html">Просмотреть PDA</a>
|
||||
</div>
|
||||
|
||||
<h1>Регистрация серверного аккаунта</h1>
|
||||
<p class="subtitle">Создаёт серверную user_pda в Solana (PDA 1.2) по полному логину server@shine</p>
|
||||
|
||||
<div class="card">
|
||||
<h2>Параметры Solana</h2>
|
||||
<div class="field">
|
||||
<label>Solana Endpoint</label>
|
||||
<input type="text" id="endpoint" value="https://solana-rpc.publicnode.com" />
|
||||
<div class="hint">mainnet: https://solana-rpc.publicnode.com · devnet: https://api.devnet.solana.com</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Данные сервера</h2>
|
||||
<div class="field">
|
||||
<label>Логин сервера</label>
|
||||
<input type="text" id="login" placeholder="server@shine" maxlength="30" autocomplete="off" autocapitalize="off" spellcheck="false" />
|
||||
<div class="hint">Полный логин server@shine · только a-z, 0-9, _ и одна @ · максимум 30 байт. Namespace типа 1 должен уже существовать в Solana.</div>
|
||||
</div>
|
||||
<div class="hint" id="namespaceInfo" role="status">Сначала создайте @shine и настройте Solana endpoint. Проверка выполняется перед отправкой.</div>
|
||||
<div class="field">
|
||||
<label>Адрес сервера (URL) например shineup.me</label>
|
||||
<input type="text" id="serverAddress" placeholder="Адрес сервера" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Сервер доступа (access_servers, 0 или 1)</label>
|
||||
<textarea id="accessServers" placeholder="Один логин сервера доступа или пусто"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Ключи сервера</h2>
|
||||
|
||||
<div class="field">
|
||||
<label>Пароль</label>
|
||||
<div class="pwd-wrap">
|
||||
<input type="password" id="password" name="server-ui-password-create" placeholder="Пароль аккаунта сервера" autocomplete="new-password" autocapitalize="off" spellcheck="false" />
|
||||
<button class="btn-eye" id="btnEye" type="button">Показать</button>
|
||||
</div>
|
||||
<div class="hint">Нажмите «Сгенерировать» – поля ниже заполнятся из логина + пароля (Argon2id).<br/>Или введите ключи вручную.</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-row">
|
||||
<button class="btn-secondary" id="btnGen" type="button">Сгенерировать ключи</button>
|
||||
</div>
|
||||
<div class="gen-msg" id="genMsg"></div>
|
||||
|
||||
<div class="sec-lbl">Секрет (master secret, base58)</div>
|
||||
<div class="field" style="margin-bottom:0">
|
||||
<input type="text" id="masterSecret" placeholder="32-байтовый master secret в base58 (~44 символа)" />
|
||||
</div>
|
||||
|
||||
<div class="sec-lbl">Ключевые пары (base58)</div>
|
||||
|
||||
<div class="kp-block">
|
||||
<div class="kp-title">Root Key – холодное восстановление / полный контроль PDA</div>
|
||||
<div class="kp-row"><span class="kp-lbl">Публичный</span><input class="kp-inp" type="text" id="rootPub" placeholder="base58, ~44 символа" /></div>
|
||||
<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-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-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>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-row">
|
||||
<button class="btn-primary" id="btnCreate">Зарегистрировать сервер</button>
|
||||
</div>
|
||||
<div class="status" id="status"></div>
|
||||
</div>
|
||||
|
||||
<script type="module" src="./js/create-server-pda-page.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,138 @@
|
||||
import { registerServerOnSolana } from '../../js/services/shine-user-pda-service.js';
|
||||
import { getNamespace, assertLoginInNamespace } from '../../js/services/shine-namespace-service.js';
|
||||
import {
|
||||
$,
|
||||
buildKeyBundleFromForm,
|
||||
clearGenMessage,
|
||||
clearStatus,
|
||||
openDevnetTopup,
|
||||
deriveKeyBundleFromPassword,
|
||||
fillKeyFields,
|
||||
parseLoginList,
|
||||
refreshDeviceBalance,
|
||||
setGenMessage,
|
||||
setStatus,
|
||||
setupPasswordEye,
|
||||
updateSolAddress,
|
||||
validateLoginOrThrow,
|
||||
wireDeviceAddressPreview,
|
||||
} from './server-ui-shared.js';
|
||||
import { defaultServerAddress, defaultServerLogin, defaultSolanaEndpoint } from '../../js/deploy-config.js';
|
||||
|
||||
const fieldMap = {
|
||||
masterSecret: 'masterSecret',
|
||||
rootPub: 'rootPub',
|
||||
rootPriv: 'rootPriv',
|
||||
bchPub: 'bchPub',
|
||||
bchPriv: 'bchPriv',
|
||||
devPub: 'devPub',
|
||||
devPriv: 'devPriv',
|
||||
solBox: 'solBox',
|
||||
solAdr: 'solAdr',
|
||||
};
|
||||
|
||||
setupPasswordEye($('btnEye'), $('password'));
|
||||
wireDeviceAddressPreview(fieldMap);
|
||||
$('password').value = '';
|
||||
$('login').placeholder = defaultServerLogin.includes('@') ? defaultServerLogin : `${defaultServerLogin}@shine`;
|
||||
$('serverAddress').placeholder = defaultServerAddress;
|
||||
$('endpoint').value = defaultSolanaEndpoint;
|
||||
|
||||
$('btnTopupDevnet').addEventListener('click', () => {
|
||||
try {
|
||||
if (!String($('endpoint').value || '').includes('devnet')) {
|
||||
throw new Error('Автопополнение доступно только для devnet. Для mainnet пополните device-кошелёк вручную.');
|
||||
}
|
||||
openDevnetTopup($('devPub').value);
|
||||
} catch (error) {
|
||||
setStatus($('status'), error?.message || String(error), 'error');
|
||||
}
|
||||
});
|
||||
|
||||
$('btnRefreshBalance').addEventListener('click', async () => {
|
||||
try {
|
||||
$('btnRefreshBalance').disabled = true;
|
||||
await refreshDeviceBalance({
|
||||
endpoint: $('endpoint').value,
|
||||
deviceAddress: $('devPub').value,
|
||||
targetNode: $('deviceBalance'),
|
||||
});
|
||||
} catch (error) {
|
||||
setStatus($('status'), error?.message || String(error), 'error');
|
||||
} finally {
|
||||
$('btnRefreshBalance').disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
$('btnGen').addEventListener('click', async () => {
|
||||
clearGenMessage($('genMsg'));
|
||||
clearStatus($('status'));
|
||||
$('btnGen').disabled = true;
|
||||
try {
|
||||
const login = validateLoginOrThrow($('login').value);
|
||||
const password = $('password').value;
|
||||
const { masterSecret32, keyBundle } = await deriveKeyBundleFromPassword({
|
||||
login,
|
||||
password,
|
||||
});
|
||||
fillKeyFields(fieldMap, keyBundle, masterSecret32);
|
||||
updateSolAddress(fieldMap);
|
||||
$('deviceBalance').textContent = 'Теперь можно проверить баланс device-аккаунта.';
|
||||
setGenMessage($('genMsg'), 'Ключи и master secret сгенерированы из логина и пароля. Транзакцию оплатит device-ключ.', 'ok');
|
||||
} catch (error) {
|
||||
setGenMessage($('genMsg'), error?.message || String(error), 'err');
|
||||
} finally {
|
||||
$('btnGen').disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
$('btnCreate').addEventListener('click', async () => {
|
||||
clearStatus($('status'));
|
||||
clearGenMessage($('genMsg'));
|
||||
$('btnCreate').disabled = true;
|
||||
try {
|
||||
const login = validateLoginOrThrow($('login').value);
|
||||
if (!login.includes('@')) throw new Error('Новая серверная регистрация требует полный логин, например server@shine');
|
||||
const endpoint = String($('endpoint').value || '').trim();
|
||||
if (!endpoint) throw new Error('Укажите Solana endpoint');
|
||||
setStatus($('status'), 'Проверка namespace в Solana...', 'info');
|
||||
const namespace = await getNamespace({ namespace: login.split('@')[1], solanaEndpoint: endpoint });
|
||||
assertLoginInNamespace(login, namespace);
|
||||
if (namespace.type !== 1) throw new Error('Сервер должен регистрироваться в платном namespace типа 1 (например @shine)');
|
||||
const namespaceFee = namespace.registrationFeeLamports.toString();
|
||||
$('namespaceInfo').textContent = `Namespace @${namespace.namespace} проверен · комиссия: ${namespaceFee} lamports. Депозит PDA включён в цену namespace; отдельно оплачивается комиссия сети Solana.`;
|
||||
const serverAddress = String($('serverAddress').value || '').trim();
|
||||
if (!serverAddress) throw new Error('Укажите адрес сервера');
|
||||
|
||||
setStatus($('status'), 'Проверка и сборка keyBundle...', 'info');
|
||||
const { keyBundle, normalized } = await buildKeyBundleFromForm(fieldMap);
|
||||
$('rootPub').value = normalized.rootPubB58;
|
||||
$('rootPriv').value = normalized.rootPrivB58;
|
||||
$('bchPub').value = normalized.bchPubB58;
|
||||
$('bchPriv').value = normalized.bchPrivB58;
|
||||
$('devPub').value = normalized.devPubB58;
|
||||
$('devPriv').value = normalized.devPrivB58;
|
||||
updateSolAddress(fieldMap);
|
||||
|
||||
setStatus($('status'), 'Отправка create_user_pda в Solana...', 'info');
|
||||
const result = await registerServerOnSolana({
|
||||
login,
|
||||
keyBundle,
|
||||
serverAddress,
|
||||
accessServers: parseLoginList($('accessServers').value),
|
||||
solanaEndpoint: endpoint,
|
||||
});
|
||||
|
||||
setStatus(
|
||||
$('status'),
|
||||
`✓ Сервер зарегистрирован!\n\nЛогин: ${login}\nPDA: ${result.pdaAddress}\nBlockchain: ${result.blockchainName}\nТранзакция: ${result.signature}`,
|
||||
'success',
|
||||
);
|
||||
} catch (error) {
|
||||
setStatus($('status'), error?.message || String(error), 'error');
|
||||
} finally {
|
||||
$('btnCreate').disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
document.body.dataset.ready = '1';
|
||||
@@ -0,0 +1,218 @@
|
||||
import { readShineUserPdaByRef } from '../../js/services/shine-user-pda-service.js';
|
||||
import { bytesToBase58 } from '../../js/services/crypto-utils.js';
|
||||
import { $, clearStatus, formatBigInt, formatTimestamp, setStatus } from './server-ui-shared.js';
|
||||
import { defaultSolanaEndpoint } from '../../js/deploy-config.js';
|
||||
|
||||
function hex(bytes) {
|
||||
const data = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes || []);
|
||||
return Array.from(data).map((x) => x.toString(16).padStart(2, '0')).join('');
|
||||
}
|
||||
|
||||
function base58(bytes) {
|
||||
const data = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes || []);
|
||||
return bytesToBase58(data);
|
||||
}
|
||||
|
||||
if ($('endpoint')) {
|
||||
$('endpoint').value = defaultSolanaEndpoint;
|
||||
}
|
||||
|
||||
function renderRows(rows) {
|
||||
const container = $('summaryRows');
|
||||
container.innerHTML = '';
|
||||
for (const row of rows) {
|
||||
const el = document.createElement('div');
|
||||
el.className = 'field-row';
|
||||
const label = document.createElement('div');
|
||||
label.className = 'field-label';
|
||||
label.textContent = row.label;
|
||||
const value = document.createElement('div');
|
||||
value.className = `field-value${row.muted ? ' muted' : ''}`;
|
||||
value.textContent = row.value;
|
||||
el.append(label, value);
|
||||
container.appendChild(el);
|
||||
}
|
||||
}
|
||||
|
||||
function renderMiniGrid(items) {
|
||||
const wrap = document.createElement('div');
|
||||
wrap.className = 'mini-grid';
|
||||
for (const item of items) {
|
||||
const node = document.createElement('div');
|
||||
node.className = 'mini-item';
|
||||
const label = document.createElement('div');
|
||||
label.className = 'mini-label';
|
||||
label.textContent = item.label;
|
||||
const value = document.createElement('div');
|
||||
value.className = 'mini-value';
|
||||
value.textContent = item.value;
|
||||
node.append(label, value);
|
||||
wrap.appendChild(node);
|
||||
}
|
||||
return wrap;
|
||||
}
|
||||
|
||||
function renderBlock(title, subtitle, items) {
|
||||
const card = document.createElement('div');
|
||||
card.className = 'block-card';
|
||||
const ttl = document.createElement('div');
|
||||
ttl.className = 'block-title';
|
||||
ttl.textContent = title;
|
||||
card.appendChild(ttl);
|
||||
if (subtitle) {
|
||||
const sub = document.createElement('div');
|
||||
sub.className = 'block-subtitle';
|
||||
sub.textContent = subtitle;
|
||||
card.appendChild(sub);
|
||||
}
|
||||
card.appendChild(renderMiniGrid(items));
|
||||
return card;
|
||||
}
|
||||
|
||||
function renderArrayLine(values, emptyLabel = '–') {
|
||||
const arr = Array.isArray(values) ? values : [];
|
||||
return arr.length ? arr.join(', ') : emptyLabel;
|
||||
}
|
||||
|
||||
function renderSessionList(sessions) {
|
||||
const list = document.createElement('div');
|
||||
list.className = 'details-wrap';
|
||||
const details = document.createElement('details');
|
||||
details.open = true;
|
||||
const summary = document.createElement('summary');
|
||||
summary.textContent = `Сессии (${Array.isArray(sessions) ? sessions.length : 0})`;
|
||||
const body = document.createElement('div');
|
||||
body.className = 'details-body';
|
||||
if (!Array.isArray(sessions) || sessions.length === 0) {
|
||||
body.innerHTML = '<div class="field-value muted">Сессий нет.</div>';
|
||||
} else {
|
||||
const grid = document.createElement('div');
|
||||
grid.className = 'block-list';
|
||||
sessions.forEach((session, idx) => {
|
||||
grid.appendChild(renderBlock(
|
||||
`Session #${idx + 1}`,
|
||||
`type=${session.sessionType}, version=${session.sessionVersion}`,
|
||||
[
|
||||
{ label: 'Имя', value: session.sessionName || '–' },
|
||||
{ label: 'PubKey', value: base58(session.sessionPubKey32) },
|
||||
],
|
||||
));
|
||||
});
|
||||
body.appendChild(grid);
|
||||
}
|
||||
details.append(summary, body);
|
||||
list.appendChild(details);
|
||||
return list;
|
||||
}
|
||||
|
||||
function renderParsed(parsed) {
|
||||
$('summaryCard').style.display = 'block';
|
||||
$('blocksCard').style.display = 'block';
|
||||
$('rawCard').style.display = 'block';
|
||||
|
||||
renderRows([
|
||||
{ label: 'PDA адрес', value: parsed.pdaAddress },
|
||||
{ label: 'Формат', value: `${parsed.formatMajor}.${parsed.formatMinor}` },
|
||||
{ label: 'Логин', value: parsed.login },
|
||||
{ label: 'Статус', value: parsed.isServer ? 'server' : 'not server' },
|
||||
{ label: 'recordNumber', value: String(parsed.recordNumber) },
|
||||
{ label: 'createdAtMs', value: `${parsed.createdAtMs} · ${formatTimestamp(parsed.createdAtMs)}` },
|
||||
{ label: 'updatedAtMs', value: `${parsed.updatedAtMs} · ${formatTimestamp(parsed.updatedAtMs)}` },
|
||||
{ label: 'recordLen', value: String(parsed.recordLen) },
|
||||
{ label: 'prevRecordHash32', value: hex(parsed.prevRecordHash) },
|
||||
{ label: 'signature64', value: base58(parsed.signature) },
|
||||
{ label: 'unsignedBytesLen', value: String(parsed.unsignedBytes?.length || 0) },
|
||||
]);
|
||||
|
||||
const badgeLine = $('badgeLine');
|
||||
badgeLine.innerHTML = '';
|
||||
const badges = [
|
||||
{ label: 'format=1.2', kind: 'ok' },
|
||||
{ label: `server=${parsed.isServer ? '1' : '0'}`, kind: parsed.isServer ? 'ok' : 'warn' },
|
||||
{ label: `forks=${Array.isArray(parsed.forks) ? parsed.forks.length : 0}`, kind: 'info' },
|
||||
{ label: `access=${Array.isArray(parsed.accessServers) ? parsed.accessServers.length : 0}`, kind: 'info' },
|
||||
];
|
||||
badges.forEach((item) => {
|
||||
const badge = document.createElement('span');
|
||||
badge.className = `badge ${item.kind}`;
|
||||
badge.textContent = item.label;
|
||||
badgeLine.appendChild(badge);
|
||||
});
|
||||
|
||||
const blocks = $('blocksList');
|
||||
blocks.innerHTML = '';
|
||||
blocks.appendChild(renderBlock('RootKeyBlock', 'block_type=1, version=0', [
|
||||
{ label: 'rootKey32', value: base58(parsed.rootKey) },
|
||||
]));
|
||||
blocks.appendChild(renderBlock('ClientKeyBlock', 'block_type=2, version=0', [
|
||||
{ label: 'clientKey32', value: base58(parsed.clientKey) },
|
||||
]));
|
||||
|
||||
const forkLines = (parsed.forks || []).map((fork, idx) =>
|
||||
`#${idx}: ${base58(fork.blockchainKey)} · created=${formatTimestamp(fork.createdAtMs)} · limit=${formatBigInt(fork.paidLimitBytes)}`,
|
||||
);
|
||||
blocks.appendChild(renderBlock('BlockchainRegistryBlock', 'block_type=3, version=0', [
|
||||
{ label: 'forkCount', value: String(parsed.forks?.length || 0) },
|
||||
{ label: 'forks', value: forkLines.length ? forkLines.join('\n') : '–' },
|
||||
]));
|
||||
|
||||
if (parsed.isServer) {
|
||||
const addressLines = (parsed.serverAddresses || []).map((item) =>
|
||||
`type=${item.addressFormatType}, v=${item.addressFormatVersion}: ${item.address}`,
|
||||
);
|
||||
blocks.appendChild(renderBlock('ServerProfileBlock', 'block_type=30, version=0', [
|
||||
{ label: 'addressCount', value: String(parsed.serverAddresses?.length || 0) },
|
||||
{ label: 'address', value: addressLines.length ? addressLines.join('\n') : '–' },
|
||||
]));
|
||||
}
|
||||
if (Array.isArray(parsed.accessServers) && parsed.accessServers.length) {
|
||||
blocks.appendChild(renderBlock('AccessServersBlock', 'block_type=40, version=0', [
|
||||
{ label: 'accessServersCount', value: String(parsed.accessServers.length) },
|
||||
{ label: 'accessServer', value: renderArrayLine(parsed.accessServers) },
|
||||
]));
|
||||
}
|
||||
|
||||
const raw = {
|
||||
pdaAddress: parsed.pdaAddress,
|
||||
format: `${parsed.formatMajor}.${parsed.formatMinor}`,
|
||||
login: parsed.login,
|
||||
isServer: parsed.isServer,
|
||||
recordNumber: parsed.recordNumber,
|
||||
createdAtMs: parsed.createdAtMs.toString(),
|
||||
updatedAtMs: parsed.updatedAtMs.toString(),
|
||||
recordLen: parsed.recordLen,
|
||||
prevRecordHash: hex(parsed.prevRecordHash),
|
||||
rootKey: base58(parsed.rootKey),
|
||||
clientKey: base58(parsed.clientKey),
|
||||
serverAddresses: (parsed.serverAddresses || []).map((a) => ({ ...a })),
|
||||
accessServers: parsed.accessServers || [],
|
||||
signature: base58(parsed.signature),
|
||||
};
|
||||
|
||||
$('rawJson').textContent = JSON.stringify(raw, null, 2);
|
||||
}
|
||||
|
||||
$('btnLoad').addEventListener('click', async () => {
|
||||
clearStatus($('status'));
|
||||
$('btnLoad').disabled = true;
|
||||
$('summaryCard').style.display = 'none';
|
||||
$('blocksCard').style.display = 'none';
|
||||
$('rawCard').style.display = 'none';
|
||||
try {
|
||||
const endpoint = String($('endpoint').value || '').trim();
|
||||
const ref = String($('ref').value || '').trim();
|
||||
if (!endpoint) throw new Error('Укажите Solana endpoint');
|
||||
if (!ref) throw new Error('Укажите логин или адрес PDA');
|
||||
|
||||
setStatus($('status'), 'Чтение PDA...', 'info');
|
||||
const parsed = await readShineUserPdaByRef({ value: ref, solanaEndpoint: endpoint });
|
||||
renderParsed(parsed);
|
||||
setStatus($('status'), 'PDA загружена.', 'success');
|
||||
} catch (error) {
|
||||
setStatus($('status'), error?.message || String(error), 'error');
|
||||
} finally {
|
||||
$('btnLoad').disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
document.body.dataset.ready = '1';
|
||||
@@ -0,0 +1,265 @@
|
||||
import {
|
||||
base58ToBytes,
|
||||
base64ToBytes,
|
||||
bytesToBase58,
|
||||
bytesToBase64,
|
||||
deriveEd25519FromMasterSecret,
|
||||
deriveMasterSecretFromPassword,
|
||||
publicKeyB64FromPkcs8Ed25519,
|
||||
} from '../../js/services/crypto-utils.js';
|
||||
import { formatSol, getBalanceSol } from '../../js/services/solana-wallet-service.js';
|
||||
|
||||
const LEGACY_LOGIN_RE = /^[a-z0-9_]{1,20}$/;
|
||||
const FULL_LOGIN_RE = /^[a-z0-9_]+@[a-z0-9_]+$/;
|
||||
const ED25519_PKCS8_PREFIX = new Uint8Array([
|
||||
0x30, 0x2e, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x04, 0x22, 0x04, 0x20,
|
||||
]);
|
||||
|
||||
export function $(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
export function normalizeLogin(login) {
|
||||
return String(login || '').trim().toLowerCase();
|
||||
}
|
||||
|
||||
export function validateLoginOrThrow(login) {
|
||||
const clean = normalizeLogin(login);
|
||||
if (clean.includes('@')) {
|
||||
if (!FULL_LOGIN_RE.test(clean) || new TextEncoder().encode(clean).length > 30) {
|
||||
throw new Error('Полный логин должен иметь вид server@shine, только a-z, 0-9, _, максимум 30 байт');
|
||||
}
|
||||
return clean;
|
||||
}
|
||||
if (!LEGACY_LOGIN_RE.test(clean)) {
|
||||
throw new Error('Старый логин должен содержать только a-z, 0-9, _ и быть длиной 1..20 символов');
|
||||
}
|
||||
return clean;
|
||||
}
|
||||
|
||||
export function parseLoginList(text) {
|
||||
return String(text || '')
|
||||
.split(/\r?\n/)
|
||||
.map((value) => value.trim().toLowerCase())
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
export function formatBigInt(value) {
|
||||
return BigInt(value || 0n).toString(10);
|
||||
}
|
||||
|
||||
export function formatTimestamp(value) {
|
||||
const ts = Number(BigInt(value || 0n));
|
||||
if (!Number.isFinite(ts) || ts <= 0) return '–';
|
||||
return new Date(ts).toLocaleString('ru-RU');
|
||||
}
|
||||
|
||||
export function setStatus(node, text, kind = 'info') {
|
||||
node.className = `status ${kind}`;
|
||||
node.textContent = String(text || '');
|
||||
}
|
||||
|
||||
export function clearStatus(node) {
|
||||
node.className = 'status';
|
||||
node.textContent = '';
|
||||
}
|
||||
|
||||
export function setGenMessage(node, text, kind) {
|
||||
node.className = `gen-msg ${kind}`;
|
||||
node.textContent = String(text || '');
|
||||
}
|
||||
|
||||
export function clearGenMessage(node) {
|
||||
node.className = 'gen-msg';
|
||||
node.textContent = '';
|
||||
}
|
||||
|
||||
export function setupPasswordEye(button, input) {
|
||||
button.addEventListener('click', () => {
|
||||
const nextType = input.type === 'password' ? 'text' : 'password';
|
||||
input.type = nextType;
|
||||
button.textContent = nextType === 'password' ? 'Показать' : 'Скрыть';
|
||||
});
|
||||
}
|
||||
|
||||
function ensure32Bytes(bytes) {
|
||||
const input = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes || []);
|
||||
if (input.length > 32) throw new Error(`Ожидалось максимум 32 байта, получено ${input.length}`);
|
||||
if (input.length === 32) return input;
|
||||
const out = new Uint8Array(32);
|
||||
out.set(input, 32 - input.length);
|
||||
return out;
|
||||
}
|
||||
|
||||
function pkcs8FromSeed32(seed32) {
|
||||
const seed = ensure32Bytes(seed32);
|
||||
const out = new Uint8Array(ED25519_PKCS8_PREFIX.length + seed.length);
|
||||
out.set(ED25519_PKCS8_PREFIX, 0);
|
||||
out.set(seed, ED25519_PKCS8_PREFIX.length);
|
||||
return out;
|
||||
}
|
||||
|
||||
async function pairFromSeedBase58(seedB58, explicitPubB58) {
|
||||
const seed32 = ensure32Bytes(base58ToBytes(seedB58));
|
||||
const privatePkcs8B64 = bytesToBase64(pkcs8FromSeed32(seed32));
|
||||
const publicKeyB64 = await publicKeyB64FromPkcs8Ed25519(privatePkcs8B64);
|
||||
const actualPubB58 = bytesToBase58(base64ToBytes(publicKeyB64));
|
||||
const expectedPubB58 = String(explicitPubB58 || '').trim();
|
||||
if (expectedPubB58 && actualPubB58 !== expectedPubB58) {
|
||||
throw new Error(`Публичный ключ не совпадает с приватным seed: ${expectedPubB58}`);
|
||||
}
|
||||
return {
|
||||
publicKeyB64,
|
||||
privatePkcs8B64,
|
||||
publicKeyB58: actualPubB58,
|
||||
privateSeedB58: bytesToBase58(seed32),
|
||||
};
|
||||
}
|
||||
|
||||
export async function buildKeyBundleFromForm(fieldMap, options = {}) {
|
||||
const requireBlockchain = options.requireBlockchain !== false;
|
||||
const root = await pairFromSeedBase58($(fieldMap.rootPriv).value, $(fieldMap.rootPub).value);
|
||||
const device = await pairFromSeedBase58($(fieldMap.devPriv).value, $(fieldMap.devPub).value);
|
||||
const blockchainPriv = String($(fieldMap.bchPriv).value || '').trim();
|
||||
const blockchainPub = String($(fieldMap.bchPub).value || '').trim();
|
||||
const hasBlockchainInput = Boolean(blockchainPriv || blockchainPub);
|
||||
let blockchain = null;
|
||||
if (requireBlockchain || hasBlockchainInput) {
|
||||
blockchain = await pairFromSeedBase58(blockchainPriv, blockchainPub);
|
||||
}
|
||||
return {
|
||||
keyBundle: {
|
||||
rootPair: { publicKeyB64: root.publicKeyB64, privatePkcs8B64: root.privatePkcs8B64 },
|
||||
blockchainPair: blockchain
|
||||
? { publicKeyB64: blockchain.publicKeyB64, privatePkcs8B64: blockchain.privatePkcs8B64 }
|
||||
: null,
|
||||
clientPair: { publicKeyB64: device.publicKeyB64, privatePkcs8B64: device.privatePkcs8B64 },
|
||||
},
|
||||
normalized: {
|
||||
rootPubB58: root.publicKeyB58,
|
||||
rootPrivB58: root.privateSeedB58,
|
||||
bchPubB58: blockchain?.publicKeyB58 || '',
|
||||
bchPrivB58: blockchain?.privateSeedB58 || '',
|
||||
devPubB58: device.publicKeyB58,
|
||||
devPrivB58: device.privateSeedB58,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export async function deriveKeyBundleFromPassword({ login, password, onProgress }) {
|
||||
const cleanLogin = validateLoginOrThrow(login);
|
||||
const cleanPassword = String(password ?? '');
|
||||
if (!cleanPassword) throw new Error('Введите пароль');
|
||||
|
||||
const masterSecret32 = await deriveMasterSecretFromPassword(cleanPassword, {
|
||||
login: cleanLogin,
|
||||
onProgress,
|
||||
});
|
||||
const [rootPair, blockchainPair, clientPair] = await Promise.all([
|
||||
deriveEd25519FromMasterSecret(masterSecret32, 'root.key'),
|
||||
deriveEd25519FromMasterSecret(masterSecret32, 'blockchain.key'),
|
||||
deriveEd25519FromMasterSecret(masterSecret32, 'client.key'),
|
||||
]);
|
||||
return {
|
||||
masterSecret32,
|
||||
keyBundle: { rootPair, blockchainPair, clientPair },
|
||||
};
|
||||
}
|
||||
|
||||
export function fillKeyFields(fieldMap, keyBundle, masterSecret32) {
|
||||
if (masterSecret32) {
|
||||
$(fieldMap.masterSecret).value = bytesToBase58(masterSecret32);
|
||||
}
|
||||
$(fieldMap.rootPub).value = bytesToBase58(base64ToBytes(keyBundle.rootPair.publicKeyB64));
|
||||
$(fieldMap.rootPriv).value = bytesToBase58(base64ToBytes(keyBundle.rootPair.privatePkcs8B64).slice(-32));
|
||||
$(fieldMap.bchPub).value = bytesToBase58(base64ToBytes(keyBundle.blockchainPair.publicKeyB64));
|
||||
$(fieldMap.bchPriv).value = bytesToBase58(base64ToBytes(keyBundle.blockchainPair.privatePkcs8B64).slice(-32));
|
||||
$(fieldMap.devPub).value = bytesToBase58(base64ToBytes(keyBundle.clientPair.publicKeyB64));
|
||||
$(fieldMap.devPriv).value = bytesToBase58(base64ToBytes(keyBundle.clientPair.privatePkcs8B64).slice(-32));
|
||||
}
|
||||
|
||||
export function updateSolAddress(fieldMap) {
|
||||
const box = $(fieldMap.solBox);
|
||||
const label = $(fieldMap.solAdr);
|
||||
const pubB58 = String($(fieldMap.devPub).value || '').trim();
|
||||
if (!pubB58) {
|
||||
box.classList.remove('show');
|
||||
label.textContent = '';
|
||||
return;
|
||||
}
|
||||
try {
|
||||
ensure32Bytes(base58ToBytes(pubB58));
|
||||
label.textContent = pubB58;
|
||||
box.classList.add('show');
|
||||
} catch {
|
||||
box.classList.remove('show');
|
||||
label.textContent = '';
|
||||
}
|
||||
}
|
||||
|
||||
export function setText(idOrNode, value) {
|
||||
const node = typeof idOrNode === 'string' ? $(idOrNode) : idOrNode;
|
||||
if (node) node.textContent = String(value || '');
|
||||
}
|
||||
|
||||
export function wireDeviceAddressPreview(fieldMap) {
|
||||
const update = () => updateSolAddress(fieldMap);
|
||||
$(fieldMap.devPub).addEventListener('input', update);
|
||||
update();
|
||||
}
|
||||
|
||||
export function publicKeyBytesToBase58(value) {
|
||||
return bytesToBase58(value instanceof Uint8Array ? value : new Uint8Array(value || []));
|
||||
}
|
||||
|
||||
export function compareExpectedPublicKeys(expected, actual) {
|
||||
const exp = String(expected || '').trim();
|
||||
const act = String(actual || '').trim();
|
||||
return {
|
||||
matches: Boolean(exp) && Boolean(act) && exp === act,
|
||||
expected: exp,
|
||||
actual: act,
|
||||
};
|
||||
}
|
||||
|
||||
export function summarizeKeyComparison(resultMap) {
|
||||
const labels = {
|
||||
root: 'root',
|
||||
blockchain: 'blockchain',
|
||||
device: 'device',
|
||||
};
|
||||
const mismatches = Object.entries(resultMap)
|
||||
.filter(([, result]) => !result.matches)
|
||||
.map(([key]) => labels[key] || key);
|
||||
return {
|
||||
allMatch: mismatches.length === 0,
|
||||
mismatches,
|
||||
};
|
||||
}
|
||||
|
||||
export async function refreshDeviceBalance({ endpoint, deviceAddress, targetNode }) {
|
||||
const cleanEndpoint = String(endpoint || '').trim();
|
||||
const cleanAddress = String(deviceAddress || '').trim();
|
||||
if (!cleanEndpoint) throw new Error('Укажите Solana endpoint');
|
||||
if (!cleanAddress) throw new Error('Сначала укажите device-адрес');
|
||||
const balance = await getBalanceSol({ endpoint: cleanEndpoint, address: cleanAddress });
|
||||
setText(targetNode, `Баланс device: ${formatSol(balance.sol, 6)} SOL (${balance.lamports} lamports)`);
|
||||
return balance;
|
||||
}
|
||||
|
||||
export function buildDevnetTopupUrl(walletAddress) {
|
||||
const cleanWallet = String(walletAddress || '').trim();
|
||||
const url = new URL('../devnet-topup-view', window.location.href);
|
||||
if (cleanWallet) {
|
||||
url.searchParams.set('wallet', cleanWallet);
|
||||
}
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
export function openDevnetTopup(walletAddress) {
|
||||
const cleanWallet = String(walletAddress || '').trim();
|
||||
if (!cleanWallet) {
|
||||
throw new Error('Сначала укажите device-адрес');
|
||||
}
|
||||
window.open(buildDevnetTopupUrl(cleanWallet), '_blank', 'noopener');
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
import { readShineUserPda, updateServerOnSolana } from '../../js/services/shine-user-pda-service.js';
|
||||
import {
|
||||
$,
|
||||
buildKeyBundleFromForm,
|
||||
clearGenMessage,
|
||||
clearStatus,
|
||||
compareExpectedPublicKeys,
|
||||
deriveKeyBundleFromPassword,
|
||||
fillKeyFields,
|
||||
formatBigInt,
|
||||
formatTimestamp,
|
||||
openDevnetTopup,
|
||||
publicKeyBytesToBase58,
|
||||
refreshDeviceBalance,
|
||||
setGenMessage,
|
||||
setStatus,
|
||||
setText,
|
||||
setupPasswordEye,
|
||||
summarizeKeyComparison,
|
||||
updateSolAddress,
|
||||
validateLoginOrThrow,
|
||||
wireDeviceAddressPreview,
|
||||
} from './server-ui-shared.js';
|
||||
import { defaultServerAddress, defaultServerLogin, defaultSolanaEndpoint } from '../../js/deploy-config.js';
|
||||
|
||||
const fieldMap = {
|
||||
masterSecret: 'masterSecret',
|
||||
rootPub: 'rootPub',
|
||||
rootPriv: 'rootPriv',
|
||||
bchPub: 'bchPub',
|
||||
bchPriv: 'bchPriv',
|
||||
devPub: 'devPub',
|
||||
devPriv: 'devPriv',
|
||||
solBox: 'solBox',
|
||||
solAdr: 'solAdr',
|
||||
};
|
||||
|
||||
let currentPda = null;
|
||||
|
||||
function resetExpectedKeysUi() {
|
||||
$('expectedKeysBox').style.display = 'none';
|
||||
setText('expectedRootPub', '');
|
||||
setText('expectedBchPub', '');
|
||||
setText('expectedDevPub', '');
|
||||
clearGenMessage($('expectedKeysStatus'));
|
||||
setText('deviceBalance', 'Баланс device ещё не запрашивался.');
|
||||
}
|
||||
|
||||
function renderExpectedKeys(parsed) {
|
||||
$('expectedKeysBox').style.display = 'block';
|
||||
setText('expectedRootPub', publicKeyBytesToBase58(parsed.rootKey));
|
||||
setText('expectedBchPub', publicKeyBytesToBase58(parsed.blockchain.blockchainPublicKey));
|
||||
setText('expectedDevPub', publicKeyBytesToBase58(parsed.clientKey));
|
||||
setGenMessage($('expectedKeysStatus'), 'После генерации ключей этот блок покажет, совпадают ли они с уже записанной PDA.', 'warn');
|
||||
}
|
||||
|
||||
function compareCurrentFormKeysWithPda() {
|
||||
if (!currentPda) throw new Error('Сначала загрузите PDA');
|
||||
const blockchainActual = String($('bchPub').value || '').trim();
|
||||
return {
|
||||
resultMap: {
|
||||
root: compareExpectedPublicKeys(publicKeyBytesToBase58(currentPda.rootKey), $('rootPub').value),
|
||||
blockchain: blockchainActual
|
||||
? compareExpectedPublicKeys(publicKeyBytesToBase58(currentPda.blockchain.blockchainPublicKey), blockchainActual)
|
||||
: { matches: true, expected: publicKeyBytesToBase58(currentPda.blockchain.blockchainPublicKey), actual: '' },
|
||||
device: compareExpectedPublicKeys(publicKeyBytesToBase58(currentPda.clientKey), $('devPub').value),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function renderComparisonStatus() {
|
||||
if (!currentPda) return false;
|
||||
try {
|
||||
const { resultMap } = compareCurrentFormKeysWithPda();
|
||||
const summary = summarizeKeyComparison(resultMap);
|
||||
if (summary.allMatch) {
|
||||
setGenMessage($('expectedKeysStatus'), 'Ключи совпадают с загруженной PDA. Похоже, пароль верный.', 'ok');
|
||||
return true;
|
||||
}
|
||||
setGenMessage(
|
||||
$('expectedKeysStatus'),
|
||||
`Не совпали ключи: ${summary.mismatches.join(', ')}. Похоже, пароль неверный или введены не те ключи.`,
|
||||
'err',
|
||||
);
|
||||
return false;
|
||||
} catch (error) {
|
||||
setGenMessage($('expectedKeysStatus'), error?.message || String(error), 'err');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
setupPasswordEye($('btnEye'), $('password'));
|
||||
wireDeviceAddressPreview(fieldMap);
|
||||
$('password').value = '';
|
||||
$('login').placeholder = defaultServerLogin;
|
||||
$('serverAddress').placeholder = defaultServerAddress;
|
||||
$('endpoint').value = defaultSolanaEndpoint;
|
||||
resetExpectedKeysUi();
|
||||
|
||||
$('btnTopupDevnet').addEventListener('click', () => {
|
||||
try {
|
||||
if (!String($('endpoint').value || '').includes('devnet')) {
|
||||
throw new Error('Автопополнение доступно только для devnet. Для mainnet пополните device-кошелёк вручную.');
|
||||
}
|
||||
openDevnetTopup($('devPub').value);
|
||||
} catch (error) {
|
||||
setStatus($('status'), error?.message || String(error), 'error');
|
||||
}
|
||||
});
|
||||
|
||||
$('btnRefreshBalance').addEventListener('click', async () => {
|
||||
try {
|
||||
$('btnRefreshBalance').disabled = true;
|
||||
await refreshDeviceBalance({
|
||||
endpoint: $('endpoint').value,
|
||||
deviceAddress: $('devPub').value,
|
||||
targetNode: $('deviceBalance'),
|
||||
});
|
||||
} catch (error) {
|
||||
setStatus($('status'), error?.message || String(error), 'error');
|
||||
} finally {
|
||||
$('btnRefreshBalance').disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
$('btnGen').addEventListener('click', async () => {
|
||||
clearGenMessage($('genMsg'));
|
||||
clearStatus($('status'));
|
||||
$('btnGen').disabled = true;
|
||||
try {
|
||||
const login = validateLoginOrThrow($('login').value);
|
||||
const password = $('password').value;
|
||||
const { masterSecret32, keyBundle } = await deriveKeyBundleFromPassword({ login, password });
|
||||
fillKeyFields(fieldMap, keyBundle, masterSecret32);
|
||||
updateSolAddress(fieldMap);
|
||||
$('deviceBalance').textContent = 'Теперь можно проверить баланс device-аккаунта.';
|
||||
const keysOk = renderComparisonStatus();
|
||||
setGenMessage(
|
||||
$('genMsg'),
|
||||
keysOk
|
||||
? 'Ключи и master secret сгенерированы из логина и пароля. Device-ключ оплатит транзакцию.'
|
||||
: 'Ключи сгенерированы, но не совпали с уже загруженной PDA. Скорее всего, пароль неверный.',
|
||||
keysOk ? 'ok' : 'err',
|
||||
);
|
||||
} catch (error) {
|
||||
setGenMessage($('genMsg'), error?.message || String(error), 'err');
|
||||
} finally {
|
||||
$('btnGen').disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
$('btnLoad').addEventListener('click', async () => {
|
||||
clearStatus($('status'));
|
||||
clearGenMessage($('genMsg'));
|
||||
$('btnLoad').disabled = true;
|
||||
currentPda = null;
|
||||
$('pdaInfo').style.display = 'none';
|
||||
$('updateForm').style.display = 'none';
|
||||
resetExpectedKeysUi();
|
||||
try {
|
||||
const login = validateLoginOrThrow($('login').value);
|
||||
const endpoint = String($('endpoint').value || '').trim();
|
||||
if (!endpoint) throw new Error('Укажите Solana endpoint');
|
||||
|
||||
setStatus($('status'), 'Загрузка PDA из Solana...', 'info');
|
||||
const parsed = await readShineUserPda({ login, solanaEndpoint: endpoint });
|
||||
if (!parsed.isServer) throw new Error('Эта PDA не является серверной');
|
||||
currentPda = parsed;
|
||||
|
||||
$('iAddr').textContent = parsed.pdaAddress;
|
||||
$('iVer').textContent = `#${parsed.recordNumber}`;
|
||||
$('iCreated').textContent = formatTimestamp(parsed.createdAtMs);
|
||||
$('iUpdated').textContent = formatTimestamp(parsed.updatedAtMs);
|
||||
$('iSrvAddr').textContent = parsed.serverAddress || '–';
|
||||
$('iBch').textContent = parsed.blockchain.blockchainName;
|
||||
$('iLimit').textContent = formatBigInt(parsed.blockchain.paidLimitBytes);
|
||||
|
||||
$('password').value = '';
|
||||
$('serverAddress').value = parsed.serverAddress || '';
|
||||
$('pdaInfo').style.display = 'block';
|
||||
$('updateForm').style.display = 'block';
|
||||
renderExpectedKeys(parsed);
|
||||
setStatus($('status'), 'PDA загружена. Можно менять адрес сервера.', 'success');
|
||||
} catch (error) {
|
||||
setStatus($('status'), error?.message || String(error), 'error');
|
||||
} finally {
|
||||
$('btnLoad').disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
$('btnUpdate').addEventListener('click', async () => {
|
||||
clearStatus($('status'));
|
||||
clearGenMessage($('genMsg'));
|
||||
$('btnUpdate').disabled = true;
|
||||
try {
|
||||
if (!currentPda) throw new Error('Сначала загрузите PDA');
|
||||
const endpoint = String($('endpoint').value || '').trim();
|
||||
if (!endpoint) throw new Error('Укажите Solana endpoint');
|
||||
const serverAddress = String($('serverAddress').value || '').trim();
|
||||
if (!serverAddress) throw new Error('Укажите адрес сервера');
|
||||
|
||||
setStatus($('status'), 'Проверка и сборка keyBundle...', 'info');
|
||||
const { keyBundle, normalized } = await buildKeyBundleFromForm(fieldMap, { requireBlockchain: true });
|
||||
$('rootPub').value = normalized.rootPubB58;
|
||||
$('rootPriv').value = normalized.rootPrivB58;
|
||||
$('bchPub').value = normalized.bchPubB58;
|
||||
$('bchPriv').value = normalized.bchPrivB58;
|
||||
$('devPub').value = normalized.devPubB58;
|
||||
$('devPriv').value = normalized.devPrivB58;
|
||||
updateSolAddress(fieldMap);
|
||||
if (!renderComparisonStatus()) {
|
||||
throw new Error('Ключи не совпадают с загруженной PDA. Проверьте пароль или введённые ключи.');
|
||||
}
|
||||
|
||||
setStatus($('status'), 'Отправка update_user_pda в Solana...', 'info');
|
||||
const result = await updateServerOnSolana({
|
||||
login: currentPda.login,
|
||||
keyBundle,
|
||||
serverAddress,
|
||||
addressFormatType: currentPda.addressFormatType ?? 1,
|
||||
addressFormatVersion: currentPda.addressFormatVersion ?? 0,
|
||||
solanaEndpoint: endpoint,
|
||||
});
|
||||
|
||||
setStatus(
|
||||
$('status'),
|
||||
`✓ PDA обновлена!\n\nЛогин: ${currentPda.login}\nPDA: ${result.pdaAddress}\nТранзакция: ${result.signature}`,
|
||||
'success',
|
||||
);
|
||||
currentPda = null;
|
||||
$('pdaInfo').style.display = 'none';
|
||||
$('updateForm').style.display = 'none';
|
||||
} catch (error) {
|
||||
setStatus($('status'), error?.message || String(error), 'error');
|
||||
} finally {
|
||||
$('btnUpdate').disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
document.body.dataset.ready = '1';
|
||||
@@ -0,0 +1,91 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Просмотр PDA – SHiNE Server Admin</title>
|
||||
<link rel="stylesheet" href="styles.css" />
|
||||
<style>
|
||||
.field-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
|
||||
.field-row:last-child { border-bottom: 0; }
|
||||
.field-label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
|
||||
.field-value { font-family: monospace; font-size: 12px; word-break: break-all; white-space: pre-wrap; }
|
||||
.field-value.muted { color: var(--text-muted); }
|
||||
.block-list { display: grid; gap: 12px; }
|
||||
.block-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: #121212; }
|
||||
.block-title { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 10px; }
|
||||
.block-subtitle { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
|
||||
.mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
|
||||
.mini-item { min-width: 0; }
|
||||
.mini-label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; text-transform: uppercase; letter-spacing: .04em; }
|
||||
.mini-value { font-family: monospace; font-size: 12px; word-break: break-all; white-space: pre-wrap; }
|
||||
.mono-box { font-family: monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; background: #0d0d0d; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
|
||||
.summary-grid { display: grid; gap: 0; }
|
||||
.badge-line { display: flex; gap: 8px; flex-wrap: wrap; }
|
||||
.badge { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; font-size: 11px; color: var(--text-muted); background: #0d0d0d; }
|
||||
.badge.ok { color: #7dcc7d; border-color: #2a4a2a; background: #1a2e1a; }
|
||||
.badge.warn { color: #ffd37a; border-color: transparent; background: #2f2614; }
|
||||
.badge.err { color: #f08080; border-color: #5a2a2a; background: #2e1a1a; }
|
||||
.details-wrap { margin-top: 12px; }
|
||||
.details-wrap details { border: 1px solid var(--border); border-radius: var(--radius); background: #121212; }
|
||||
.details-wrap summary { cursor: pointer; padding: 12px 14px; color: var(--accent); font-weight: 600; }
|
||||
.details-body { padding: 0 14px 14px; }
|
||||
.tight { margin-bottom: 8px; }
|
||||
@media (max-width: 720px) {
|
||||
.field-row { grid-template-columns: 1fr; gap: 4px; }
|
||||
.mini-grid { grid-template-columns: 1fr; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="nav-links">
|
||||
<a href="../server-ui.html">← Назад</a>
|
||||
<a href="create-server-pda.html">Создать PDA</a>
|
||||
<a href="update-server-pda.html">Обновить PDA</a>
|
||||
</div>
|
||||
|
||||
<h1>Просмотр PDA</h1>
|
||||
<p class="subtitle">Читает user_pda или server PDA по логину либо по адресу и показывает все поля</p>
|
||||
|
||||
<div class="card">
|
||||
<h2>Параметры Solana</h2>
|
||||
<div class="field">
|
||||
<label>Solana Endpoint</label>
|
||||
<input type="text" id="endpoint" value="https://solana-rpc.publicnode.com" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Источник PDA</h2>
|
||||
<div class="field">
|
||||
<label>Логин или адрес PDA</label>
|
||||
<input type="text" id="ref" placeholder="Логин сервера / пользователя или base58-адрес PDA" />
|
||||
<div class="hint">Если введён base58-адрес длиной 32 байта, он читается напрямую. Иначе значение трактуется как логин.</div>
|
||||
</div>
|
||||
<div class="btn-row">
|
||||
<button class="btn-primary" id="btnLoad">Загрузить PDA</button>
|
||||
</div>
|
||||
<div class="status" id="status"></div>
|
||||
</div>
|
||||
|
||||
<div class="card" id="summaryCard" style="display:none">
|
||||
<h2>Сводка</h2>
|
||||
<div class="summary-grid" id="summaryRows"></div>
|
||||
<div class="badge-line" style="margin-top:12px" id="badgeLine"></div>
|
||||
</div>
|
||||
|
||||
<div class="card" id="blocksCard" style="display:none">
|
||||
<h2>Блоки и поля</h2>
|
||||
<div class="block-list" id="blocksList"></div>
|
||||
</div>
|
||||
|
||||
<div class="card" id="rawCard" style="display:none">
|
||||
<h2>Raw JSON</h2>
|
||||
<pre class="mono-box" id="rawJson"></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="module" src="./js/read-pda-page.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,193 @@
|
||||
/* SHiNE Server Admin UI — тёмная тема */
|
||||
:root {
|
||||
--bg: #111;
|
||||
--surface: #1a1a1a;
|
||||
--border: #2a2a2a;
|
||||
--text: #e0e0e0;
|
||||
--text-muted: #888;
|
||||
--accent: #4a9eff;
|
||||
--accent-hover: #6ab4ff;
|
||||
--success: #4caf50;
|
||||
--error: #f44336;
|
||||
--warning: #ff9800;
|
||||
--radius: 8px;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
body {
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 640px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: var(--accent);
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 24px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 20px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.card h2 {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 16px;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.field {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 6px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
input[type="text"], input[type="password"], textarea {
|
||||
width: 100%;
|
||||
background: #0d0d0d;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
color: var(--text);
|
||||
font-family: monospace;
|
||||
font-size: 13px;
|
||||
padding: 10px 12px;
|
||||
outline: none;
|
||||
transition: border-color 0.15s;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
input[type="text"][readonly] {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
textarea {
|
||||
min-height: 80px;
|
||||
}
|
||||
|
||||
.hint {
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.btn-row {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: 20px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 10px 20px;
|
||||
border-radius: var(--radius);
|
||||
border: none;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.15s, background 0.15s;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
|
||||
|
||||
.btn-secondary {
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.btn-secondary:hover:not(:disabled) {
|
||||
border-color: var(--accent);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.status {
|
||||
padding: 12px 16px;
|
||||
border-radius: var(--radius);
|
||||
font-size: 13px;
|
||||
margin-top: 16px;
|
||||
word-break: break-all;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.status.info { display: block; background: #1a2433; border: 1px solid #2a4a6a; color: #7bb8ff; }
|
||||
.status.success { display: block; background: #1a2e1a; border: 1px solid #2a4a2a; color: #7dcc7d; }
|
||||
.status.error { display: block; background: #2e1a1a; border: 1px solid #5a2a2a; color: #f08080; }
|
||||
|
||||
.pda-info {
|
||||
display: none;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.pda-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 6px 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.pda-row:last-child { border-bottom: none; }
|
||||
|
||||
.pda-key { color: var(--text-muted); min-width: 160px; }
|
||||
.pda-value { color: var(--text); font-family: monospace; text-align: right; word-break: break-all; }
|
||||
|
||||
.nav-links {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.nav-links a {
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
margin-right: 16px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.nav-links a:hover { text-decoration: underline; }
|
||||
|
||||
.section-divider {
|
||||
border: none;
|
||||
border-top: 1px solid var(--border);
|
||||
margin: 20px 0;
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Обновление PDA сервера – SHiNE Server Admin</title>
|
||||
<link rel="stylesheet" href="styles.css" />
|
||||
<style>
|
||||
.pwd-wrap { display: flex; }
|
||||
.pwd-wrap input { flex: 1; border-radius: var(--radius) 0 0 var(--radius); }
|
||||
.btn-eye { border: 1px solid var(--border); border-left: none; background: #0d0d0d;
|
||||
color: var(--text-muted); border-radius: 0 var(--radius) var(--radius) 0;
|
||||
padding: 0 16px; cursor: pointer; font-size: 13px; }
|
||||
.btn-eye:hover { color: var(--accent); border-color: var(--accent); }
|
||||
.gen-msg { font-size: 12px; margin-top: 8px; padding: 8px 12px; border-radius: var(--radius); display: none; }
|
||||
.gen-msg.ok { display:block; background:#1a2e1a; border:1px solid #2a4a2a; color:#7dcc7d; }
|
||||
.gen-msg.err { display:block; background:#2e1a1a; border:1px solid #5a2a2a; color:#f08080; }
|
||||
.kp-title { font-size:11px; font-weight:700; color:var(--accent); text-transform:uppercase; letter-spacing:.06em; margin-bottom:8px; }
|
||||
.kp-row { display:flex; gap:8px; align-items:flex-start; margin-bottom:6px; }
|
||||
.kp-row:last-child { margin-bottom:0; }
|
||||
.kp-lbl { font-size:11px; color:var(--text-muted); min-width:60px; padding-top:10px; }
|
||||
.kp-inp { flex:1; font-size:11px; font-family:monospace; padding:8px 10px; }
|
||||
.kp-block { margin-bottom:14px; padding-bottom:14px; border-bottom:1px solid var(--border); }
|
||||
.kp-block:last-child { border-bottom:none; margin-bottom:0; padding-bottom:0; }
|
||||
.sec-lbl { font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.06em; margin:16px 0 10px; }
|
||||
.sol-box { margin-top:14px; background:#0d1a0d; border:1px solid #2a4a2a; border-radius:var(--radius); padding:10px 14px; display:none; }
|
||||
.sol-box.show { display:block; }
|
||||
.sol-ttl { font-size:12px; font-weight:600; color:#7dcc7d; }
|
||||
.sol-adr { font-family:monospace; font-size:12px; word-break:break-all; margin-top:4px; }
|
||||
.sol-ht { font-size:11px; color:var(--text-muted); margin-top:4px; }
|
||||
.muted { font-size:12px; color:var(--text-muted); margin-bottom:14px; line-height:1.6; }
|
||||
.sol-topup-btn { margin-top:10px; width:100%; }
|
||||
.sol-balance-btn { margin-top:10px; width:100%; }
|
||||
.sol-balance { font-size:11px; color:var(--text-muted); margin-top:8px; word-break:break-all; }
|
||||
.expected-card { margin-top:14px; background:#111520; border:1px solid #243147; border-radius:var(--radius); padding:12px 14px; }
|
||||
.expected-ttl { font-size:12px; font-weight:600; color:#9dc4ff; margin-bottom:8px; }
|
||||
.expected-row { margin-bottom:8px; }
|
||||
.expected-row:last-child { margin-bottom:0; }
|
||||
.expected-lbl { font-size:11px; color:var(--text-muted); margin-bottom:4px; }
|
||||
.expected-val { font-family:monospace; font-size:11px; word-break:break-all; }
|
||||
.gen-msg.warn { display:block; background:#2f2614; border: 1px solid transparent; color:#ffd37a; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="nav-links">
|
||||
<a href="../server-ui.html">← Назад</a>
|
||||
<a href="create-server-pda.html">Создать PDA</a>
|
||||
<a href="read-pda.html">Просмотреть PDA</a>
|
||||
</div>
|
||||
|
||||
<h1>Обновление PDA сервера</h1>
|
||||
<p class="subtitle">Меняет адрес SHiNE-сервера и другие поля PDA 1.2</p>
|
||||
|
||||
<div class="card">
|
||||
<h2>Параметры Solana</h2>
|
||||
<div class="field">
|
||||
<label>Solana Endpoint</label>
|
||||
<input type="text" id="endpoint" value="https://solana-rpc.publicnode.com" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Загрузить существующую PDA</h2>
|
||||
<div class="field">
|
||||
<label>Логин сервера</label>
|
||||
<input type="text" id="login" placeholder="server@shine" maxlength="30" autocomplete="off" autocapitalize="off" spellcheck="false" />
|
||||
</div>
|
||||
<div class="btn-row">
|
||||
<button class="btn-secondary" id="btnLoad">Загрузить PDA</button>
|
||||
</div>
|
||||
<div class="pda-info" id="pdaInfo">
|
||||
<hr class="section-divider" />
|
||||
<div class="pda-row"><span class="pda-key">PDA адрес</span><span class="pda-value" id="iAddr"></span></div>
|
||||
<div class="pda-row"><span class="pda-key">Версия</span><span class="pda-value" id="iVer"></span></div>
|
||||
<div class="pda-row"><span class="pda-key">Создан</span><span class="pda-value" id="iCreated"></span></div>
|
||||
<div class="pda-row"><span class="pda-key">Обновлён</span><span class="pda-value" id="iUpdated"></span></div>
|
||||
<div class="pda-row"><span class="pda-key">Адрес сервера</span><span class="pda-value" id="iSrvAddr"></span></div>
|
||||
<div class="pda-row"><span class="pda-key">Blockchain</span><span class="pda-value" id="iBch"></span></div>
|
||||
<div class="pda-row"><span class="pda-key">Paid limit</span><span class="pda-value" id="iLimit"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="updateForm" style="display:none">
|
||||
<div class="card">
|
||||
<h2>Новые параметры сервера</h2>
|
||||
<div class="field">
|
||||
<label>Арес сервера (URL) например shineup.me</label>
|
||||
<input type="text" id="serverAddress" placeholder="Адрес сервера" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Ключи для подписи и оплаты</h2>
|
||||
<p class="muted">Root-ключ подписывает новую PDA-запись. Device-ключ оплачивает транзакцию.<br/>Blockchain-ключ не нужен – подпись LastBlockState из PDA переиспользуется автоматически.</p>
|
||||
|
||||
<div class="field">
|
||||
<label>Пароль</label>
|
||||
<div class="pwd-wrap">
|
||||
<input type="password" id="password" name="server-ui-password-update" placeholder="Пароль аккаунта сервера" autocomplete="new-password" autocapitalize="off" spellcheck="false" />
|
||||
<button class="btn-eye" id="btnEye" type="button">Показать</button>
|
||||
</div>
|
||||
<div class="hint">Нажмите «Сгенерировать» – поля ниже заполнятся из логина + пароля.<br/>Или введите ключи вручную.</div>
|
||||
</div>
|
||||
<div class="btn-row">
|
||||
<button class="btn-secondary" id="btnGen" type="button">Сгенерировать ключи</button>
|
||||
</div>
|
||||
<div class="gen-msg" id="genMsg"></div>
|
||||
|
||||
<div class="sec-lbl">Секрет (master secret, base58)</div>
|
||||
<div class="field" style="margin-bottom:0">
|
||||
<input type="text" id="masterSecret" placeholder="32-байтовый master secret в base58 (~44 символа)" />
|
||||
</div>
|
||||
|
||||
<div class="sec-lbl">Ключевые пары (base58)</div>
|
||||
|
||||
<div class="kp-block">
|
||||
<div class="kp-title">Root Key – холодное восстановление / полный контроль PDA</div>
|
||||
<div class="kp-row"><span class="kp-lbl">Публичный</span><input class="kp-inp" type="text" id="rootPub" placeholder="base58, ~44 символа" /></div>
|
||||
<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 – справочно, при обновлении не используется</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-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-адрес (base58) device-ключа. С него оплачивается транзакция.</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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="expected-card" id="expectedKeysBox" style="display:none">
|
||||
<div class="expected-ttl">Какие ключи ожидаются по уже загруженной PDA</div>
|
||||
<div class="expected-row">
|
||||
<div class="expected-lbl">Ожидаемый root public key</div>
|
||||
<div class="expected-val" id="expectedRootPub"></div>
|
||||
</div>
|
||||
<div class="expected-row">
|
||||
<div class="expected-lbl">Ожидаемый blockchain public key</div>
|
||||
<div class="expected-val" id="expectedBchPub"></div>
|
||||
</div>
|
||||
<div class="expected-row">
|
||||
<div class="expected-lbl">Ожидаемый device public key</div>
|
||||
<div class="expected-val" id="expectedDevPub"></div>
|
||||
</div>
|
||||
<div class="gen-msg" id="expectedKeysStatus"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-row">
|
||||
<button class="btn-primary" id="btnUpdate">Обновить PDA</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="status" id="status"></div>
|
||||
</div>
|
||||
|
||||
<script type="module" src="./js/update-server-pda-page.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user