partial support for remove
This commit is contained in:
@@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
#include "cli/common.hpp"
|
#include "cli/common.hpp"
|
||||||
|
|
||||||
#include "utils/string.hpp"
|
|
||||||
#include "utils/time.hpp"
|
#include "utils/time.hpp"
|
||||||
|
|
||||||
namespace repertory::cli::actions {
|
namespace repertory::cli::actions {
|
||||||
|
|||||||
@@ -83,6 +83,9 @@ private:
|
|||||||
|
|
||||||
static void handle_get_available_locations(httplib::Response &res);
|
static void handle_get_available_locations(httplib::Response &res);
|
||||||
|
|
||||||
|
void handle_del_remove_mount(const httplib::Request &req,
|
||||||
|
httplib::Response &res);
|
||||||
|
|
||||||
void handle_get_mount(const httplib::Request &req,
|
void handle_get_mount(const httplib::Request &req,
|
||||||
httplib::Response &res) const;
|
httplib::Response &res) const;
|
||||||
|
|
||||||
|
|||||||
@@ -207,6 +207,10 @@ ui_server::ui_server(mgmt_app_config *config)
|
|||||||
: http_error_codes::internal_error;
|
: http_error_codes::internal_error;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
server_.Delete("/api/v1/remove_mount", [this](auto &&req, auto &&res) {
|
||||||
|
handle_del_remove_mount(req, res);
|
||||||
|
});
|
||||||
|
|
||||||
server_.Get("/api/v1/locations", [](auto && /* req */, auto &&res) {
|
server_.Get("/api/v1/locations", [](auto && /* req */, auto &&res) {
|
||||||
handle_get_available_locations(res);
|
handle_get_available_locations(res);
|
||||||
});
|
});
|
||||||
@@ -339,6 +343,21 @@ void ui_server::generate_config(provider_type prov, std::string_view name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ui_server::handle_del_remove_mount(const httplib::Request &req,
|
||||||
|
httplib::Response &res) {
|
||||||
|
auto prov = provider_type_from_string(req.get_param_value("type"));
|
||||||
|
auto name = req.get_param_value("name");
|
||||||
|
|
||||||
|
if (not data_directory_exists(prov, name)) {
|
||||||
|
res.status = http_error_codes::not_found;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lines = launch_process(prov, name, {"-rp", "-f"}, false);
|
||||||
|
res.status = lines.at(0U) == "0" ? http_error_codes::ok
|
||||||
|
: http_error_codes::internal_error;
|
||||||
|
}
|
||||||
|
|
||||||
void ui_server::handle_put_mount_auto_start(const httplib::Request &req,
|
void ui_server::handle_put_mount_auto_start(const httplib::Request &req,
|
||||||
httplib::Response &res) const {
|
httplib::Response &res) const {
|
||||||
auto prov = provider_type_from_string(req.get_param_value("type"));
|
auto prov = provider_type_from_string(req.get_param_value("type"));
|
||||||
|
|||||||
Reference in New Issue
Block a user