wildcard and two stations blacklisted OK

This commit is contained in:
richonguzman
2025-01-01 21:42:37 -03:00
parent 56d63d0389
commit b688391a0e
6 changed files with 57 additions and 17 deletions
+3 -3
View File
@@ -90,8 +90,8 @@
"lowVoltageCutOff": 0,
"backupDigiMode": false,
"rebootMode": false,
"rebootModeTime": 6,
"blackList": ""
"rebootModeTime": 6
},
"personalNote": ""
"personalNote": "",
"blackList": ""
}
+41
View File
@@ -573,6 +573,47 @@
</div>
<hr />
<div class="row my-5 d-flex align-items-top">
<div class="col-lg-3 col-sm-12">
<h5>
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
fill="currentColor"
class="bi bi-broadcast-pin"
viewBox="0 0 16 16"
>
<path
d="M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 0 1 .707.707m2.122 2.122a4 4 0 0 0 0 5.656.5.5 0 1 1-.708.708 5 5 0 0 1 0-7.072.5.5 0 0 1 .708.708m5.656-.708a.5.5 0 0 1 .708 0 5 5 0 0 1 0 7.072.5.5 0 1 1-.708-.708 4 4 0 0 0 0-5.656.5.5 0 0 1 0-.708m2.122-2.12a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.313.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707zM6 8a2 2 0 1 1 2.5 1.937V15.5a.5.5 0 0 1-1 0V9.937A2 2 0 0 1 6 8"
/>
</svg>
Black List
</h5>
<small>Add Callsigns with space between them to Black List them (* wild card allowed)</small>
</div>
<div class="col-9 mt-2">
<div class="row">
<div class="col-12">
<label
for="blackList"
class="form-label"
>Black List</label
>
<input
type="text"
name="blackList"
id="blackList"
class="form-control"
placeholder="Station Callsign"
oninput="this.value = this.value.toUpperCase();"
/>
</div>
</div>
</div>
</div>
<hr />
<div class="row my-5 d-flex align-items-top">
<div class="col-lg-3 col-sm-12">
<h5>
+3
View File
@@ -137,6 +137,9 @@ function loadSettings(settings) {
document.getElementById("beacon.gpsActive").checked = settings.beacon.gpsActive;
document.getElementById("beacon.gpsAmbiguity").checked = settings.beacon.gpsAmbiguity;
// Black List
document.getElementById("blackList").value = settings.blackList;
// Digi
document.getElementById("digi.mode").value = settings.digi.mode;
document.getElementById("digi.ecoMode").checked = settings.digi.ecoMode;
+2 -2
View File
@@ -221,9 +221,9 @@ bool Configuration::readFile() {
rebootMode = data["other"]["rebootMode"] | false;
rebootModeTime = data["other"]["rebootModeTime"] | 6;
personalNote = data["personalNote"] | "personal note here...";
personalNote = data["personalNote"] | "personal note here";
blackList = data["blackList"] | "";
blackList = data["blackList"] | "station callsign";
if (wifiAPs.size() == 0) { // If we don't have any WiFi's from config we need to add "empty" SSID for AUTO AP
WiFi_AP wifiap;
+6 -12
View File
@@ -35,23 +35,17 @@ namespace STATION_Utils {
}
callsigns.trim();
if (callsigns.length() > 0) blackList.push_back(callsigns); // Add the last word if available
// Print the vector
if (!blackList.empty()) {
for (int i = 0; i < blackList.size(); i++) {
Serial.println(blackList[i]);
}
}
//
}
}
bool checkBlackList(const String& callsign) {
if (!blackList.empty()) {
for (int i = 0; i < blackList.size(); i++) {
for (int i = 0; i < blackList.size(); i++) {
if (blackList[i].indexOf("*") >= 0) { // use wild card
String wildCard = blackList[i].substring(0, blackList[i].indexOf("*"));
if (callsign.startsWith(wildCard))return true;
} else {
if (blackList[i] == callsign) return true;
}
}
}
return false;
}
+2
View File
@@ -206,6 +206,8 @@ namespace WEB_Utils {
Config.personalNote = request->getParam("personalNote", true)->value();
Config.blackList = request->getParam("blackList", true)->value();
Config.webadmin.active = request->hasParam("webadmin.active", true);
if (Config.webadmin.active) {
Config.webadmin.username = request->getParam("webadmin.username", true)->value();