2026-06-28 12:34:55 -05:00
|
|
|
const ssid = document.getElementById('ssid');
|
|
|
|
|
const wifiPass = document.getElementById('wifiPass');
|
|
|
|
|
const admin = document.getElementById('admin');
|
|
|
|
|
const adminPass = document.getElementById('adminPass');
|
|
|
|
|
const out = document.getElementById('out');
|
|
|
|
|
|
2026-07-09 20:03:41 -05:00
|
|
|
async function loadAppInfo() {
|
|
|
|
|
try {
|
|
|
|
|
const response = await fetch('/api/app-info');
|
|
|
|
|
const json = await response.json();
|
|
|
|
|
const projectName = json.projectName || '';
|
|
|
|
|
document.title = projectName;
|
|
|
|
|
document.getElementById('setupTitle').textContent = projectName;
|
|
|
|
|
} catch (error) {}
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-28 12:34:55 -05:00
|
|
|
async function scan() {
|
|
|
|
|
const response = await fetch('/api/wifi/scan');
|
|
|
|
|
const json = await response.json();
|
|
|
|
|
ssid.innerHTML = json.networks.map(network => `<option>${network.ssid}</option>`).join('');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function save() {
|
|
|
|
|
const body = {ssid: ssid.value, wifiPass: wifiPass.value, admin: admin.value, adminPass: adminPass.value};
|
|
|
|
|
const response = await fetch('/api/setup', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(body)});
|
|
|
|
|
out.textContent = await response.text();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
document.getElementById('saveSetup').addEventListener('click', save);
|
2026-07-09 20:03:41 -05:00
|
|
|
loadAppInfo();
|
2026-06-28 12:34:55 -05:00
|
|
|
scan();
|