added animation toggle
Some checks failed
BlockStorage/repertory_mac/pipeline/head There was a failure building this commit
BlockStorage/repertory/pipeline/head There was a failure building this commit

This commit is contained in:
2025-09-08 07:47:04 -05:00
parent f0bd032cb9
commit d772a713a2
6 changed files with 80 additions and 22 deletions

View File

@@ -395,6 +395,7 @@ using meta_provider_callback = std::function<void(directory_item &)>;
inline constexpr auto JSON_ACCESS_KEY{"AccessKey"};
inline constexpr auto JSON_AGENT_STRING{"AgentString"};
inline constexpr auto JSON_ANIMATIONS{"Animations"};
inline constexpr auto JSON_API_PARENT{"ApiParent"};
inline constexpr auto JSON_API_PASSWORD{"ApiPassword"};
inline constexpr auto JSON_API_PATH{"ApiPath"};

View File

@@ -24,7 +24,6 @@
#include "types/repertory.hpp"
#include "utils/atomic.hpp"
#include <unordered_map>
namespace repertory::ui {
class mgmt_app_config final {
@@ -36,6 +35,7 @@ private:
std::atomic<bool> launch_only_{false};
private:
std::atomic<bool> animations_{true};
utils::atomic<std::string> api_password_{"repertory"};
std::atomic<std::uint16_t> api_port_{default_ui_mgmt_port};
utils::atomic<std::string> api_user_{"repertory"};
@@ -53,6 +53,8 @@ private:
public:
[[nodiscard]] auto to_json() const -> nlohmann::json;
[[nodiscard]] auto get_animations() const -> bool { return animations_; }
[[nodiscard]] auto get_api_password() const -> std::string {
return api_password_;
}
@@ -77,6 +79,8 @@ public:
std::string_view name) const
-> std::string;
void set_animations(bool animations);
void set_api_password(std::string_view api_password);
void set_api_port(std::uint16_t api_port);

View File

@@ -720,7 +720,9 @@ void handlers::handle_put_setting(const httplib::Request &req,
auto name = req.get_param_value("name");
auto value = req.get_param_value("value");
if (name == JSON_AUTO_START) {
if (name == JSON_ANIMATIONS) {
config_->set_animations(utils::string::to_bool(value));
} else if (name == JSON_AUTO_START) {
config_->set_auto_start(utils::string::to_bool(value));
}

View File

@@ -97,7 +97,14 @@ mgmt_app_config::mgmt_app_config(bool hidden, bool launch_only)
api_user_ = data.at(JSON_API_USER).get<std::string>();
auto should_save{not data.contains(JSON_AUTO_START)};
auto_start_ = should_save ? false : data.at(JSON_AUTO_START).get<bool>();
auto_start_ =
should_save ? auto_start_ : data.at(JSON_AUTO_START).get<bool>();
if (data.contains(JSON_ANIMATIONS)) {
animations_ = data.at(JSON_ANIMATIONS).get<bool>();
} else {
should_save = true;
}
if (data.contains(JSON_MOUNT_AUTO_START)) {
mount_auto_start_ = from_json<bool>(data.at(JSON_MOUNT_AUTO_START));
@@ -378,6 +385,7 @@ void mgmt_app_config::set_mount_location(provider_type prov,
auto mgmt_app_config::to_json() const -> nlohmann::json {
nlohmann::json data;
data[JSON_ANIMATIONS] = animations_;
data[JSON_API_PASSWORD] = api_password_;
data[JSON_API_PORT] = api_port_;
data[JSON_API_USER] = api_user_;