docs: добавлен settings cheat sheet

- docs/settings-cheatsheet.md — полный справочник всех CLI флагов
- Обновлён docs/README.md — добавлена ссылка на cheat sheet

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
2026-05-19 23:13:01 +03:00
co-authored by Qwen-Coder
parent adac79e765
commit d38719ad53
3 changed files with 324 additions and 35 deletions
+81 -35
View File
@@ -64,14 +64,94 @@
<h1>🛰️ Wyoming Satellite WebSocket</h1>
<div id="status" class="connecting">Connecting...</div>
</div>
<button class="clear-btn" onclick="clearLog()">Clear Log</button>
<div>
<button class="clear-btn" onclick="toggleSettings()">⚙️ Settings</button>
<button class="clear-btn" onclick="clearLog()">Clear Log</button>
</div>
</div>
<div id="settings" style="display:none; background:#0f0f1a; padding:15px; border-radius:4px; margin-bottom:15px;">
<label for="wsUrl" style="color:#00d9ff; font-weight:bold;">WebSocket URL:</label>
<input type="text" id="wsUrl" value="ws://localhost:8675"
style="width:100%; padding:8px; margin:5px 0; background:#1a1a2e; color:#eee; border:1px solid #333; border-radius:4px;">
<button class="clear-btn" onclick="connect()">Connect</button>
<label style="margin-left:10px; color:#aaa;">
<input type="checkbox" id="autoReconnect" checked> Auto-reconnect
</label>
</div>
<div id="log"></div>
<script>
const log = document.getElementById('log');
const status = document.getElementById('status');
const settingsPanel = document.getElementById('settings');
const wsUrlInput = document.getElementById('wsUrl');
const autoReconnectCheckbox = document.getElementById('autoReconnect');
let eventCount = 0;
let ws = null;
let autoReconnect = true;
function toggleSettings() {
settingsPanel.style.display = settingsPanel.style.display === 'none' ? 'block' : 'none';
}
function connect() {
const wsUrl = wsUrlInput.value.trim();
if (!wsUrl) {
addEvent('SYSTEM', { error: 'Please enter a WebSocket URL' });
return;
}
// Close existing connection
if (ws) {
ws.close();
}
ws = new WebSocket(wsUrl);
ws.onopen = () => {
status.textContent = 'Connected to ' + wsUrl;
status.className = 'connected';
addEvent('SYSTEM', { status: 'Connected to ' + wsUrl });
};
ws.onmessage = (event) => {
try {
const data = JSON.parse(event.data);
addEvent(data.type, data.data);
} catch (e) {
addEvent('RAW', { raw: event.data });
}
};
ws.onclose = () => {
status.textContent = 'Disconnected';
status.className = 'disconnected';
addEvent('SYSTEM', { status: 'Connection closed' });
// Auto-reconnect
if (autoReconnectCheckbox.checked) {
setTimeout(() => {
addEvent('SYSTEM', { status: 'Attempting to reconnect...' });
connect();
}, 3000);
}
};
ws.onerror = (err) => {
status.textContent = 'Error';
status.className = 'disconnected';
addEvent('SYSTEM', { error: 'WebSocket error', details: err.toString() });
};
}
// Auto-detect WebSocket URL from current page location on first load
window.addEventListener('load', () => {
const detectedUrl = `ws://${window.location.hostname}:8675`;
wsUrlInput.value = detectedUrl;
connect();
});
function addEvent(type, data) {
eventCount++;
@@ -93,40 +173,6 @@
log.innerHTML = '';
eventCount = 0;
}
// Auto-detect WebSocket host from current page location
const wsHost = window.location.hostname;
const wsPort = 8675;
const wsUrl = `ws://${wsHost}:${wsPort}`;
const ws = new WebSocket(wsUrl);
ws.onopen = () => {
status.textContent = 'Connected';
status.className = 'connected';
addEvent('SYSTEM', { status: 'Connected to ws://localhost:8675' });
};
ws.onmessage = (event) => {
try {
const data = JSON.parse(event.data);
addEvent(data.type, data.data);
} catch (e) {
addEvent('RAW', { raw: event.data });
}
};
ws.onclose = () => {
status.textContent = 'Disconnected';
status.className = 'disconnected';
addEvent('SYSTEM', { status: 'Connection closed' });
};
ws.onerror = (err) => {
status.textContent = 'Error';
status.className = 'disconnected';
addEvent('SYSTEM', { error: 'WebSocket error', details: err.toString() });
};
</script>
</body>
</html>