Skip to content

Commit

Permalink
wildcard and two stations blacklisted OK
Browse files Browse the repository at this point in the history
  • Loading branch information
richonguzman committed Jan 2, 2025
1 parent 56d63d0 commit b688391
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 17 deletions.
6 changes: 3 additions & 3 deletions data/igate_conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
"lowVoltageCutOff": 0,
"backupDigiMode": false,
"rebootMode": false,
"rebootModeTime": 6,
"blackList": ""
"rebootModeTime": 6
},
"personalNote": ""
"personalNote": "",
"blackList": ""
}
41 changes: 41 additions & 0 deletions data_embed/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,47 @@ <h5>
</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>
Expand Down
3 changes: 3 additions & 0 deletions data_embed/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 6 additions & 12 deletions src/station_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions src/web_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b688391

Please sign in to comment.