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

This commit is contained in:
wt committed 2025-02-11 03:24:55 +07:00
1 parent 0c4183843f
commit 6e85d8e922
21 files changed
+209 -254

No files matched your search

+1 -11
View File
@@ -31,10 +31,6 @@ namespace api
response.set_content(R"({"access":"reject"})", JSON_TYPE);
return;
}
// std::ifstream ftpfile("/etc/openrouter/ftp");
// int ftp_enabled;
// ftpfile >> ftp_enabled;
// ftpfile.close();
int ftp_enabled = config::config.getConfig()["settings"]["ftp"]["enabled"];
std::stringstream responsedata;
responsedata << R"({"enabled":")" << ftp_enabled << R"("})";
@@ -63,7 +59,6 @@ namespace api
response.set_content(R"({"access":"reject"})", JSON_TYPE);
return;
}
// std::ofstream ftpfileout("/etc/openrouter/ftp");
bool new_ftp_enabled = json_body["enabled"];
if (!new_ftp_enabled)
{
@@ -77,12 +72,7 @@ namespace api
system("rc add ftp");
syslog(LOG_INFO, "%s", "Ftp is enabled");
}
// ftpfileout << stoi(new_ftp_enabled);
// ftpfileout.close();
// std::ifstream ftpfile("/etc/openrouter/ftp");
// int ftp_enabled;
// ftpfile >> ftp_enabled;
// ftpfile.close();
config::config.setConfig(std::string("../config.json"));
nlohmann::json new_config = config::config.getConfig();
new_config["settings"]["ftp"]["enabled"] = new_ftp_enabled;
config::config.setConfig(new_config);