Not better.
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 1m29s

This commit is contained in:
Your Name
2025-05-25 19:31:43 +12:00
parent 8f06fc31ae
commit e7558be416
3 changed files with 46 additions and 26 deletions

View File

@@ -120,14 +120,14 @@ bool config::is_agent_installed()
return std::filesystem::exists(localfile::bb64());
}
std::vector<std::string> config::get_template_registry_urls() {
nlohmann::json template_registry_urls = mConfig["template_registry_URLs"];
std::vector<std::string> urls;
for (auto &url : template_registry_urls) {
if (url.is_string() && !url.empty())
urls.push_back(url);
std::vector<tRegistryEntry> config::get_template_registry_urls() {
nlohmann::json template_registries = mConfig["template_registries"];
std::vector<tRegistryEntry> registries;
for (auto &registry : template_registries) {
if (registry.is_object() && !registry.empty())
registries.push_back(tRegistryEntry(registry));
}
return urls;
return registries;
}
std::vector<std::string> config::get_local_template_paths()
@@ -167,22 +167,31 @@ std::string config::get_template_create_path()
return paths[0];
}
std::string config::get_template_upload_url()
{
std::vector<std::string> urls = get_template_registry_urls();
if (urls.empty())
return "";
return urls[0];
}
std::string config::get_template_upload_token() {
return mConfig["template_upload_token"];
}
std::string config::get_backups_path()
{
return mConfig["backups_path"];
}
dropshell::tRegistryEntry::tRegistryEntry(nlohmann::json json)
{
if (json.is_object() && !json.empty()) {
for (auto &[key, value] : json.items()) {
if (tolower(key) == "name") {
name = value;
} else if (tolower(key) == "url") {
url = value;
} else if (tolower(key) == "token") {
token = value;
}
}
valid = true;
} else {
valid = false;
}
}
tRegistryEntry::~tRegistryEntry()
{
}
} // namespace dropshell