From 217db1c3764b6065a674a49bb97d8cab40d9ec55 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Sun, 5 Mar 2023 05:40:09 -0700 Subject: [PATCH] create empty Clients, Peers, Users arrays in json --- README.md | 4 ++-- config/urfd.service | 2 +- reflector/Reflector.cpp | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f902664..9ef0b79 100644 --- a/README.md +++ b/README.md @@ -79,10 +79,10 @@ cp ../config/* . This will create seven files: 1. The `urfd.blacklist` file defines callsigns that are blocked from linking or transmitting. -2. The `urfd.whitelist` file defines callsigns that are allowed to link and transmit. Both of these files support the astrisk as a wild-card. The supplied blacklist and whitelist file are empty, which will allow any callsign to link and transmit, blocking no one. +2. The `urfd.whitelist` file defines callsigns that are allowed to link and transmit. Both of these files support the astrisk as a wild-card. The supplied blacklist and whitelist file are empty, which will allow any callsign to link and transmit, blocking no one. Both files support a limited wildcard feature. 3. The `urfd.interlink` file defines possible Brandmeister and URF linking. 4. The `urfd.terminal` file defines operations for Icom's Terminal and Access Point mode, sometimes called *G3*. This protocol requires significantly higher connection resources than any other mode, so it is possible to build a URF reflector without G3 support. -5. The `urfd.service` file is a systemd file that will start and stop *urfd*. Importantly, it contains the only reference to where the *urfd* initialization file is located. +5. The `urfd.service` file is a systemd file that will start and stop *urfd*. Importantly, it contains the only reference to where the *urfd* initialization file is located. Be sure to set a fully qualified path to your urfd.ini file on the `ExecStart` line. 6. The `urfd.mk` file contains compile-time options for *urfd*. If you change the `BINDIR`, you'll need to update how `urfd.service` starts *urfd*. 7. The `urfd.ini` file contains the run-time options for *urfd* and will be discussed below. diff --git a/config/urfd.service b/config/urfd.service index ada4503..0109457 100644 --- a/config/urfd.service +++ b/config/urfd.service @@ -5,7 +5,7 @@ After=systemd-user-session.service network.target [Service] Type=simple -ExecStart=/usr/local/bin/urfd +ExecStart=/usr/local/bin/urfd /PATH_TO_INI_FILE Restart=always [Install] diff --git a/reflector/Reflector.cpp b/reflector/Reflector.cpp index be99277..5b03a07 100644 --- a/reflector/Reflector.cpp +++ b/reflector/Reflector.cpp @@ -330,7 +330,7 @@ void CReflector::XmlReportThread() jsonFile.open(jsnpath, std::ios::out | std::ios::trunc); if (jsonFile.is_open()) { - jsonFile << jreport.dump(4); + jsonFile << jreport.dump(); jsonFile.close(); } } @@ -432,16 +432,19 @@ void CReflector::JsonReport(nlohmann::json &report) report["Configure"][item.key()] = item.value(); } + report["Peers"] = nlohmann::json::array(); auto peers = GetPeers(); for (auto pit=peers->cbegin(); pit!=peers->cend(); pit++) (*pit)->JsonReport(report); ReleasePeers(); + report["Clients"] = nlohmann::json::array(); auto clients = GetClients(); for (auto cit=clients->cbegin(); cit!=clients->cend(); cit++) (*cit)->JsonReport(report); ReleaseClients(); + report["Users"] = nlohmann::json::array(); auto users = GetUsers(); for (auto uid=users->begin(); uid!=users->end(); uid++) (*uid).JsonReport(report);