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
+15
-13
@@ -9,6 +9,7 @@
|
||||
#include <syslog.h>
|
||||
#include <auth/auth.hpp>
|
||||
#include <helpers.hpp>
|
||||
#include <config/config.hpp>
|
||||
|
||||
#define WIFI_NAME_REQUIRED_STRING R"({"required":"[token,name]"})"
|
||||
|
||||
@@ -34,19 +35,20 @@ namespace api
|
||||
response.set_content(R"({"access":"reject"})", JSON_TYPE);
|
||||
return;
|
||||
}
|
||||
std::ifstream wifisettingsfile(WIFI_SETTINGS_PATH);
|
||||
std::string wifi_name;
|
||||
std::string wifisettingsbuffer;
|
||||
while (std::getline(wifisettingsfile, wifisettingsbuffer))
|
||||
{
|
||||
if (wifisettingsbuffer.find("ssid=") == 0)
|
||||
{
|
||||
wifi_name = wifisettingsbuffer;
|
||||
wifi_name.erase(0, 5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
wifisettingsfile.close();
|
||||
// std::ifstream wifisettingsfile(WIFI_SETTINGS_PATH);
|
||||
// std::string wifi_name;
|
||||
// std::string wifisettingsbuffer;
|
||||
// while (std::getline(wifisettingsfile, wifisettingsbuffer))
|
||||
// {
|
||||
// if (wifisettingsbuffer.find("ssid=") == 0)
|
||||
// {
|
||||
// wifi_name = wifisettingsbuffer;
|
||||
// wifi_name.erase(0, 5);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// wifisettingsfile.close();
|
||||
std::string wifi_name = config::config.getConfig()["settings"]["wifi"]["name"];
|
||||
std::stringstream responsedata;
|
||||
responsedata << R"({"name":")" << wifi_name << R"("})";
|
||||
response.set_content(responsedata.str(), JSON_TYPE);
|
||||
|
||||
Reference in new issue
Block a user