mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-11 16:03:58 +01:00
Prepare AutoAP enable/disable
This commit is contained in:
parent
9775c601bb
commit
d8b658df30
|
|
@ -1853,46 +1853,68 @@
|
|||
</div>
|
||||
<div class="col-9">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<label
|
||||
for="wifi.autoAP.password"
|
||||
class="form-label"
|
||||
>Password</label
|
||||
>
|
||||
<div class="input-group">
|
||||
<div class="col-12">
|
||||
<div class="form-check form-switch">
|
||||
<input
|
||||
type="password"
|
||||
name="wifi.autoAP.password"
|
||||
id="wifi.autoAP.password"
|
||||
class="form-control"
|
||||
placeholder="1234567890"
|
||||
required=""
|
||||
type="checkbox"
|
||||
name="wifi.autoAP.enabled"
|
||||
id="wifi.autoAP.enabled"
|
||||
class="form-check-input"
|
||||
/>
|
||||
</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
|
||||
<label
|
||||
for="wifi.autoAP.enabled"
|
||||
class="form-label"
|
||||
>Enable Auto AP</label
|
||||
>
|
||||
<div class="form-text">
|
||||
Set to <strong>0</strong> if you don't
|
||||
want WiFi AP to stop.
|
||||
Create WiFi AP when no network is available
|
||||
</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>
|
||||
|
|
|
|||
|
|
@ -237,8 +237,10 @@ function loadSettings(settings) {
|
|||
RebootModeTime.disabled = !RebootModeCheckbox.check;
|
||||
|
||||
// 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.timeout").value = settings.wifi.autoAP.timeout;
|
||||
toggleWiFiAutoAPFields();
|
||||
|
||||
// OTA
|
||||
document.getElementById("ota.username").value = settings.ota.username;
|
||||
|
|
@ -432,6 +434,18 @@ WebadminCheckbox.addEventListener("change", function () {
|
|||
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 () {
|
||||
const networksContainer = document.querySelector(".list-networks");
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ public:
|
|||
|
||||
class WiFi_Auto_AP {
|
||||
public:
|
||||
bool enabled; // Enable Auto AP
|
||||
String password;
|
||||
int timeout;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ bool Configuration::writeFile() {
|
|||
|
||||
data["other"]["startupDelay"] = startupDelay;
|
||||
|
||||
data["wifi"]["autoAP"]["enabled"] = wifiAutoAP.enabled;
|
||||
data["wifi"]["autoAP"]["password"] = wifiAutoAP.password;
|
||||
data["wifi"]["autoAP"]["timeout"] = wifiAutoAP.timeout;
|
||||
|
||||
|
|
@ -214,8 +215,10 @@ bool Configuration::readFile() {
|
|||
if (!data["other"].containsKey("startupDelay")) needsRewrite = true;
|
||||
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;
|
||||
wifiAutoAP.enabled = data["wifi"]["autoAP"]["enabled"] | true;
|
||||
wifiAutoAP.password = data["wifi"]["autoAP"]["password"] | "1234567890";
|
||||
wifiAutoAP.timeout = data["wifi"]["autoAP"]["timeout"] | 10;
|
||||
|
||||
|
|
@ -446,6 +449,7 @@ void Configuration::setDefaultValues() {
|
|||
|
||||
startupDelay = 0;
|
||||
|
||||
wifiAutoAP.enabled = true;
|
||||
wifiAutoAP.password = "1234567890";
|
||||
wifiAutoAP.timeout = 10;
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ namespace WEB_Utils {
|
|||
|
||||
Config.callsign = getParamStringSafe("callsign", Config.callsign);
|
||||
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.timeout = getParamIntSafe("wifi.autoAP.timeout", Config.wifiAutoAP.timeout);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue