mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-28 16:52:33 +01:00
Prepare AutoAP enable/disable
This commit is contained in:
@@ -1853,46 +1853,68 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-12">
|
||||||
<label
|
<div class="form-check form-switch">
|
||||||
for="wifi.autoAP.password"
|
|
||||||
class="form-label"
|
|
||||||
>Password</label
|
|
||||||
>
|
|
||||||
<div class="input-group">
|
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="checkbox"
|
||||||
name="wifi.autoAP.password"
|
name="wifi.autoAP.enabled"
|
||||||
id="wifi.autoAP.password"
|
id="wifi.autoAP.enabled"
|
||||||
class="form-control"
|
class="form-check-input"
|
||||||
placeholder="1234567890"
|
|
||||||
required=""
|
|
||||||
/>
|
/>
|
||||||
</div>
|
<label
|
||||||
</div>
|
for="wifi.autoAP.enabled"
|
||||||
<div class="col-6">
|
class="form-label"
|
||||||
<label
|
>Enable Auto AP</label
|
||||||
for="wifi.autoAP.timeout"
|
|
||||||
class="form-label"
|
|
||||||
>WiFiAP timeout (to search again)</label
|
|
||||||
>
|
|
||||||
<div class="input-group">
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
name="wifi.autoAP.timeout"
|
|
||||||
id="wifi.autoAP.timeout"
|
|
||||||
class="form-control"
|
|
||||||
placeholder="10"
|
|
||||||
required=""
|
|
||||||
step="1"
|
|
||||||
min="0"
|
|
||||||
/>
|
|
||||||
<span class="input-group-text"
|
|
||||||
>minutes</span
|
|
||||||
>
|
>
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
Set to <strong>0</strong> if you don't
|
Create WiFi AP when no network is available
|
||||||
want WiFi AP to stop.
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="wifi-autoap-config" style="{{wifi.autoAP.enabled ? '' : 'display:none'}}">
|
||||||
|
<div class="row mt-3">
|
||||||
|
<div class="col-6">
|
||||||
|
<label
|
||||||
|
for="wifi.autoAP.password"
|
||||||
|
class="form-label"
|
||||||
|
>Password</label
|
||||||
|
>
|
||||||
|
<div class="input-group">
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
name="wifi.autoAP.password"
|
||||||
|
id="wifi.autoAP.password"
|
||||||
|
class="form-control"
|
||||||
|
placeholder="1234567890"
|
||||||
|
required=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<label
|
||||||
|
for="wifi.autoAP.timeout"
|
||||||
|
class="form-label"
|
||||||
|
>WiFiAP timeout (to search again)</label
|
||||||
|
>
|
||||||
|
<div class="input-group">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="wifi.autoAP.timeout"
|
||||||
|
id="wifi.autoAP.timeout"
|
||||||
|
class="form-control"
|
||||||
|
placeholder="10"
|
||||||
|
required=""
|
||||||
|
step="1"
|
||||||
|
min="0"
|
||||||
|
/>
|
||||||
|
<span class="input-group-text"
|
||||||
|
>minutes</span
|
||||||
|
>
|
||||||
|
<div class="form-text">
|
||||||
|
Set to <strong>0</strong> if you don't
|
||||||
|
want WiFi AP to stop.
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -237,8 +237,10 @@ function loadSettings(settings) {
|
|||||||
RebootModeTime.disabled = !RebootModeCheckbox.check;
|
RebootModeTime.disabled = !RebootModeCheckbox.check;
|
||||||
|
|
||||||
// WiFi Auto AP
|
// WiFi Auto AP
|
||||||
|
document.getElementById("wifi.autoAP.enabled").checked = settings.wifi.autoAP.enabled;
|
||||||
document.getElementById("wifi.autoAP.password").value = settings.wifi.autoAP.password;
|
document.getElementById("wifi.autoAP.password").value = settings.wifi.autoAP.password;
|
||||||
document.getElementById("wifi.autoAP.timeout").value = settings.wifi.autoAP.timeout;
|
document.getElementById("wifi.autoAP.timeout").value = settings.wifi.autoAP.timeout;
|
||||||
|
toggleWiFiAutoAPFields();
|
||||||
|
|
||||||
// OTA
|
// OTA
|
||||||
document.getElementById("ota.username").value = settings.ota.username;
|
document.getElementById("ota.username").value = settings.ota.username;
|
||||||
@@ -432,6 +434,18 @@ WebadminCheckbox.addEventListener("change", function () {
|
|||||||
WebadminPassword.disabled = !this.checked;
|
WebadminPassword.disabled = !this.checked;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// WiFi Auto AP Switches
|
||||||
|
const WiFiAutoAPCheckbox = document.querySelector('input[name="wifi.autoAP.enabled"]');
|
||||||
|
WiFiAutoAPCheckbox.addEventListener("change", function () {
|
||||||
|
toggleWiFiAutoAPFields();
|
||||||
|
});
|
||||||
|
|
||||||
|
function toggleWiFiAutoAPFields() {
|
||||||
|
const isEnabled = WiFiAutoAPCheckbox.checked;
|
||||||
|
const autoAPConfig = document.getElementById('wifi-autoap-config');
|
||||||
|
if (autoAPConfig) autoAPConfig.style.display = isEnabled ? 'block' : 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
document.querySelector(".new button").addEventListener("click", function () {
|
document.querySelector(".new button").addEventListener("click", function () {
|
||||||
const networksContainer = document.querySelector(".list-networks");
|
const networksContainer = document.querySelector(".list-networks");
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public:
|
|||||||
|
|
||||||
class WiFi_Auto_AP {
|
class WiFi_Auto_AP {
|
||||||
public:
|
public:
|
||||||
|
bool enabled; // Enable Auto AP
|
||||||
String password;
|
String password;
|
||||||
int timeout;
|
int timeout;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ bool Configuration::writeFile() {
|
|||||||
|
|
||||||
data["other"]["startupDelay"] = startupDelay;
|
data["other"]["startupDelay"] = startupDelay;
|
||||||
|
|
||||||
|
data["wifi"]["autoAP"]["enabled"] = wifiAutoAP.enabled;
|
||||||
data["wifi"]["autoAP"]["password"] = wifiAutoAP.password;
|
data["wifi"]["autoAP"]["password"] = wifiAutoAP.password;
|
||||||
data["wifi"]["autoAP"]["timeout"] = wifiAutoAP.timeout;
|
data["wifi"]["autoAP"]["timeout"] = wifiAutoAP.timeout;
|
||||||
|
|
||||||
@@ -214,8 +215,10 @@ bool Configuration::readFile() {
|
|||||||
if (!data["other"].containsKey("startupDelay")) needsRewrite = true;
|
if (!data["other"].containsKey("startupDelay")) needsRewrite = true;
|
||||||
startupDelay = data["other"]["startupDelay"] | 0;
|
startupDelay = data["other"]["startupDelay"] | 0;
|
||||||
|
|
||||||
if (!data["wifi"]["autoAP"].containsKey("password") ||
|
if (!data["wifi"]["autoAP"].containsKey("enabled") ||
|
||||||
|
!data["wifi"]["autoAP"].containsKey("password") ||
|
||||||
!data["wifi"]["autoAP"].containsKey("timeout")) needsRewrite = true;
|
!data["wifi"]["autoAP"].containsKey("timeout")) needsRewrite = true;
|
||||||
|
wifiAutoAP.enabled = data["wifi"]["autoAP"]["enabled"] | true;
|
||||||
wifiAutoAP.password = data["wifi"]["autoAP"]["password"] | "1234567890";
|
wifiAutoAP.password = data["wifi"]["autoAP"]["password"] | "1234567890";
|
||||||
wifiAutoAP.timeout = data["wifi"]["autoAP"]["timeout"] | 10;
|
wifiAutoAP.timeout = data["wifi"]["autoAP"]["timeout"] | 10;
|
||||||
|
|
||||||
@@ -446,6 +449,7 @@ void Configuration::setDefaultValues() {
|
|||||||
|
|
||||||
startupDelay = 0;
|
startupDelay = 0;
|
||||||
|
|
||||||
|
wifiAutoAP.enabled = true;
|
||||||
wifiAutoAP.password = "1234567890";
|
wifiAutoAP.password = "1234567890";
|
||||||
wifiAutoAP.timeout = 10;
|
wifiAutoAP.timeout = 10;
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ namespace WEB_Utils {
|
|||||||
|
|
||||||
Config.callsign = getParamStringSafe("callsign", Config.callsign);
|
Config.callsign = getParamStringSafe("callsign", Config.callsign);
|
||||||
Config.tacticalCallsign = getParamStringSafe("tacticalCallsign", Config.tacticalCallsign);
|
Config.tacticalCallsign = getParamStringSafe("tacticalCallsign", Config.tacticalCallsign);
|
||||||
|
Config.wifiAutoAP.enabled = request->hasParam("wifi.autoAP.enabled", true);
|
||||||
Config.wifiAutoAP.password = getParamStringSafe("wifi.autoAP.password", Config.wifiAutoAP.password);
|
Config.wifiAutoAP.password = getParamStringSafe("wifi.autoAP.password", Config.wifiAutoAP.password);
|
||||||
Config.wifiAutoAP.timeout = getParamIntSafe("wifi.autoAP.timeout", Config.wifiAutoAP.timeout);
|
Config.wifiAutoAP.timeout = getParamIntSafe("wifi.autoAP.timeout", Config.wifiAutoAP.timeout);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user