Добавить установщик XLX системы и веб-панель
Этот коммит содержится в:
@@ -0,0 +1,90 @@
|
||||
const tokenInput = document.querySelector('#adminToken');
|
||||
const form = document.querySelector('#settingsForm');
|
||||
const envPreview = document.querySelector('#envPreview');
|
||||
const adminResult = document.querySelector('#adminResult');
|
||||
const loadButton = document.querySelector('#loadSettings');
|
||||
const saveButton = document.querySelector('#saveSettings');
|
||||
const applyButton = document.querySelector('#applySettings');
|
||||
|
||||
function token() {
|
||||
return tokenInput.value.trim();
|
||||
}
|
||||
|
||||
function setResult(text) {
|
||||
adminResult.textContent = text;
|
||||
}
|
||||
|
||||
function formData() {
|
||||
return Object.fromEntries(new FormData(form).entries());
|
||||
}
|
||||
|
||||
function fillForm(settings) {
|
||||
for (const [key, value] of Object.entries(settings)) {
|
||||
const input = form.elements.namedItem(key);
|
||||
if (input) {
|
||||
input.value = value ?? '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function loadSettings() {
|
||||
setResult('Загружаем...');
|
||||
const response = await fetch('/api/admin/xlxd/settings', {
|
||||
headers: { 'X-Admin-Token': token() },
|
||||
});
|
||||
const payload = await response.json();
|
||||
if (!payload.ok) {
|
||||
setResult(payload.error || 'Ошибка загрузки');
|
||||
return;
|
||||
}
|
||||
|
||||
fillForm(payload.data.settings);
|
||||
envPreview.textContent = payload.data.env;
|
||||
setResult('Настройки загружены.');
|
||||
}
|
||||
|
||||
async function saveSettings(apply) {
|
||||
setResult(apply ? 'Сохраняем и применяем...' : 'Сохраняем...');
|
||||
const response = await fetch('/api/admin/xlxd/settings', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Admin-Token': token(),
|
||||
},
|
||||
body: JSON.stringify({ settings: formData(), apply }),
|
||||
});
|
||||
const payload = await response.json();
|
||||
if (!payload.ok) {
|
||||
setResult(payload.error || 'Ошибка сохранения');
|
||||
return;
|
||||
}
|
||||
|
||||
envPreview.textContent = payload.data.env;
|
||||
setResult(payload.data.message);
|
||||
}
|
||||
|
||||
loadButton?.addEventListener('click', loadSettings);
|
||||
saveButton?.addEventListener('click', () => saveSettings(false));
|
||||
applyButton?.addEventListener('click', () => saveSettings(true));
|
||||
|
||||
form?.addEventListener('input', () => {
|
||||
const data = formData();
|
||||
const lines = {
|
||||
XLX_REFLECTOR_NAME: data.reflector_name,
|
||||
XLX_SERVER_HOST: data.server_host,
|
||||
XLX_SYSOP_CALLSIGN: data.sysop_callsign,
|
||||
XLX_SYSOP_EMAIL: data.sysop_email,
|
||||
XLX_COUNTRY: data.country,
|
||||
XLX_DASHBOARD_PORT: data.dashboard_port,
|
||||
XLX_DMR_PORT: data.dmr_port,
|
||||
XLX_YSF_PORT: data.ysf_port,
|
||||
XLX_DEFAULT_MODULE: data.default_module,
|
||||
XLX_MODULES: data.modules,
|
||||
XLX_INSTALL_PATH: data.install_path,
|
||||
XLX_SOURCE_PATH: data.source_path,
|
||||
XLX_LOG_PATH: data.log_path,
|
||||
XLX_SERVICE_NAME: data.service_name,
|
||||
XLX_REPO_URL: data.repo_url,
|
||||
};
|
||||
envPreview.textContent = Object.entries(lines).map(([key, value]) => `${key}=${value || ''}`).join('\n');
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
const form = document.querySelector('#registerForm');
|
||||
const result = document.querySelector('#registerResult');
|
||||
|
||||
form?.addEventListener('submit', async (event) => {
|
||||
event.preventDefault();
|
||||
result.textContent = 'Отправляем заявку...';
|
||||
|
||||
const data = Object.fromEntries(new FormData(form).entries());
|
||||
const response = await fetch('/api/register', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
const payload = await response.json();
|
||||
|
||||
if (!payload.ok) {
|
||||
result.textContent = payload.error || 'Ошибка регистрации';
|
||||
return;
|
||||
}
|
||||
|
||||
const payment = payload.data.payment || {};
|
||||
const lines = [
|
||||
`Заявка создана: ${payload.data.callsign}`,
|
||||
`Статус: ${payload.data.status}`,
|
||||
];
|
||||
if (payment.confirmation_url) {
|
||||
lines.push(`YooKassa: ${payment.confirmation_url}`);
|
||||
}
|
||||
if (payment.manual_transfer?.instructions) {
|
||||
lines.push(`Перевод по чеку: ${payment.manual_transfer.instructions}`);
|
||||
lines.push(`ID платежа для чека: ${payment.id}`);
|
||||
}
|
||||
|
||||
result.textContent = lines.join('\n');
|
||||
});
|
||||
@@ -0,0 +1,244 @@
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
--bg: #07080d;
|
||||
--panel: #111522;
|
||||
--panel-2: #171d2d;
|
||||
--text: #f6f7fb;
|
||||
--muted: #aeb7c9;
|
||||
--line: #2a3347;
|
||||
--accent: #5ee0b8;
|
||||
--accent-2: #88a7ff;
|
||||
--danger: #ff7d7d;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
background: radial-gradient(circle at top left, #17253c 0, transparent 34rem), var(--bg);
|
||||
color: var(--text);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.shell {
|
||||
width: min(1180px, calc(100% - 32px));
|
||||
margin: 0 auto;
|
||||
padding: 36px 0 56px;
|
||||
}
|
||||
|
||||
.hero {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
|
||||
gap: 28px;
|
||||
align-items: stretch;
|
||||
min-height: 420px;
|
||||
}
|
||||
|
||||
.hero.compact {
|
||||
min-height: 260px;
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
margin: 0 0 18px;
|
||||
color: var(--accent);
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: .08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2 {
|
||||
margin: 0;
|
||||
line-height: .98;
|
||||
}
|
||||
|
||||
h1 {
|
||||
max-width: 900px;
|
||||
font-size: clamp(44px, 7vw, 86px);
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
.lead {
|
||||
max-width: 720px;
|
||||
margin: 22px 0 0;
|
||||
color: var(--muted);
|
||||
font-size: 22px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
margin-top: 28px;
|
||||
}
|
||||
|
||||
.button {
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
padding: 14px 20px;
|
||||
background: var(--accent);
|
||||
color: #04120f;
|
||||
font: inherit;
|
||||
font-weight: 800;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.button.ghost {
|
||||
border: 1px solid var(--line);
|
||||
background: transparent;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.status-panel,
|
||||
.tile,
|
||||
.panel {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
background: color-mix(in srgb, var(--panel) 92%, transparent);
|
||||
}
|
||||
|
||||
.status-panel {
|
||||
display: grid;
|
||||
align-content: end;
|
||||
gap: 14px;
|
||||
padding: 22px;
|
||||
}
|
||||
|
||||
.status-panel div {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 18px;
|
||||
padding-bottom: 14px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.status-panel div:last-child {
|
||||
border-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.status-panel span,
|
||||
.tile p,
|
||||
label {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.status-panel strong {
|
||||
font-size: 34px;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.tile {
|
||||
padding: 22px;
|
||||
}
|
||||
|
||||
.num {
|
||||
display: block;
|
||||
margin-bottom: 34px;
|
||||
color: var(--accent-2);
|
||||
font-size: 18px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.tile p {
|
||||
margin: 16px 0 0;
|
||||
font-size: 18px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.panel {
|
||||
margin-top: 24px;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.panel.split {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(340px, .8fr);
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.form,
|
||||
.settings-form {
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.settings-form {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
label {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
padding: 14px;
|
||||
background: var(--panel-2);
|
||||
color: var(--text);
|
||||
font: inherit;
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.result {
|
||||
min-height: 72px;
|
||||
overflow: auto;
|
||||
margin: 0;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
padding: 14px;
|
||||
background: #06070b;
|
||||
color: var(--text);
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.env-preview {
|
||||
min-height: 420px;
|
||||
}
|
||||
|
||||
@media (max-width: 880px) {
|
||||
.hero,
|
||||
.grid,
|
||||
.panel.split,
|
||||
.settings-form {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 44px;
|
||||
}
|
||||
}
|
||||
Ссылка в новой задаче
Block a user