added config mangager
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Waiting to run
This commit is contained in:
1 parent
ee517632e4
commit
0c4183843f
21 files changed
+282
-203
No files matched your search
@@ -9,6 +9,7 @@
|
||||
#include <syslog.h>
|
||||
#include <auth/auth.hpp>
|
||||
#include <helpers.hpp>
|
||||
#include <config/config.hpp>
|
||||
|
||||
#define WIFI_CHANNEL_REQUIRED_STRING R"({"required":"[token,channel]"})"
|
||||
|
||||
@@ -34,19 +35,20 @@ namespace api
|
||||
response.set_content(R"({"access":"reject"})", JSON_TYPE);
|
||||
return;
|
||||
}
|
||||
std::ifstream wifisettingsfile(WIFI_SETTINGS_PATH);
|
||||
std::string wifi_channel;
|
||||
std::string wifisettingsbuffer;
|
||||
while (std::getline(wifisettingsfile, wifisettingsbuffer))
|
||||
{
|
||||
if (wifisettingsbuffer.find("channel=") == 0)
|
||||
{
|
||||
wifi_channel = wifisettingsbuffer;
|
||||
wifi_channel.erase(0, 8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
wifisettingsfile.close();
|
||||
// std::ifstream wifisettingsfile(WIFI_SETTINGS_PATH);
|
||||
// std::string wifi_channel;
|
||||
// std::string wifisettingsbuffer;
|
||||
// while (std::getline(wifisettingsfile, wifisettingsbuffer))
|
||||
// {
|
||||
// if (wifisettingsbuffer.find("channel=") == 0)
|
||||
// {
|
||||
// wifi_channel = wifisettingsbuffer;
|
||||
// wifi_channel.erase(0, 8);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// wifisettingsfile.close();
|
||||
int wifi_channel = config::config.getConfig()["settings"]["wifi"]["channel"];
|
||||
std::stringstream responsedata;
|
||||
responsedata << R"({"channel":")" << wifi_channel << R"("})";
|
||||
response.set_content(responsedata.str(), JSON_TYPE);
|
||||
|
||||
Reference in new issue
Block a user