added full support for config file
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:
@@ -35,10 +35,6 @@ namespace api
|
||||
response.set_content(R"({"access":"reject"})", JSON_TYPE);
|
||||
return;
|
||||
}
|
||||
// std::ifstream telnetfile("/etc/openrouter/telnet/enabled");
|
||||
// int telnet_enabled;
|
||||
// telnetfile >> telnet_enabled;
|
||||
// telnetfile.close();
|
||||
int telnet_enabled = config::config.getConfig()["settings"]["telnet"]["enabled"];
|
||||
std::stringstream responsedata;
|
||||
responsedata << R"({"enabled":")" << telnet_enabled << R"("})";
|
||||
@@ -67,7 +63,6 @@ namespace api
|
||||
response.set_content(R"({"access":"reject"})", JSON_TYPE);
|
||||
return;
|
||||
}
|
||||
// std::ofstream telnetfileout("/etc/openrouter/telnet/enabled");
|
||||
bool new_telnet_enabled = json_body["enabled"];
|
||||
if (!new_telnet_enabled)
|
||||
{
|
||||
@@ -81,17 +76,12 @@ namespace api
|
||||
system("rc add telnet");
|
||||
syslog(LOG_INFO, "%s", "Telnet is enabled");
|
||||
}
|
||||
config::config.setConfig(std::string("../config.json"));
|
||||
nlohmann::json new_config = config::config.getConfig();
|
||||
new_config["settings"]["telnet"]["enabled"] = new_telnet_enabled;
|
||||
config::config.setConfig(new_config);
|
||||
config::config.saveConfig();
|
||||
int telnet_enabled = config::config.getConfig()["settings"]["telnet"]["enabled"];
|
||||
// telnetfileout << stoi(new_telnet_enabled);
|
||||
// telnetfileout.close();
|
||||
// std::ifstream telnetfile("/etc/openrouter/telnet/enabled");
|
||||
// int telnet_enabled;
|
||||
// telnetfile >> telnet_enabled;
|
||||
// telnetfile.close();
|
||||
std::stringstream responsedata;
|
||||
responsedata << R"({"enabled":")" << telnet_enabled << R"("})";
|
||||
response.set_content(responsedata.str(), JSON_TYPE);
|
||||
|
||||
Reference in New Issue
Block a user