Доработать меню настроек и проверку серверов

This commit is contained in:
AidarKC
2026-11-30 11:36:39 +03:00
parent 10d9d0a45a
commit 1621537d77
8 changed files with 113 additions and 123 deletions
+6 -27
View File
@@ -23,11 +23,11 @@ export function render({navigate, chrome}) {
shineServerLogin: state.entrySettings.shineServerLogin,
shineServerHttp: state.entrySettings.shineServerHttp,
arweaveServer: state.entrySettings.arweaveServer,
callPreflightTimeoutMs: Number(state.entrySettings.callPreflightTimeoutMs || 6000),
statuses: { ...state.entrySettings.statuses },
};
const timers = new Map();
const checks = [];
const introCard = document.createElement('div');
introCard.className = 'settings-intro';
@@ -100,12 +100,16 @@ export function render({navigate, chrome}) {
});
applyStatus(next);
}
} catch {
applyStatus('unavailable');
} finally {
checkButton.disabled = false;
checkButton.textContent = t('screens.server_settings_view.text_008');
}
};
checks.push(runCheck);
applyStatus(draft.statuses[field.key]);
checkButton.addEventListener('click', runCheck);
@@ -132,32 +136,7 @@ export function render({navigate, chrome}) {
body.append(block);
});
const callSettings = document.createElement('div');
callSettings.className = 'stack';
const callTimeoutLabel = document.createElement('label');
callTimeoutLabel.className = 'field-label';
callTimeoutLabel.textContent = t('screens.server_settings_view.text_009');
const callTimeoutInput = document.createElement('input');
callTimeoutInput.className = 'input';
callTimeoutInput.type = 'number';
callTimeoutInput.min = '1000';
callTimeoutInput.max = '20000';
callTimeoutInput.step = '500';
callTimeoutInput.value = String(Math.max(1000, Math.min(20000, Number(draft.callPreflightTimeoutMs) || 6000)));
callTimeoutInput.addEventListener('input', () => {
const n = Number(callTimeoutInput.value);
if (!Number.isFinite(n)) return;
draft.callPreflightTimeoutMs = Math.max(1000, Math.min(20000, Math.round(n)));
});
const callTimeoutHint = document.createElement('p');
callTimeoutHint.className = 'meta-muted';
callTimeoutHint.textContent = t('screens.server_settings_view.text_010');
callSettings.append(callTimeoutLabel, callTimeoutInput, callTimeoutHint);
body.append(callSettings);
checks.forEach((check) => { void check(); });
const actions = document.createElement('div');
actions.className = 'action-pair';