Remove cloud deletion of owned plugins from the plugin dialog (#14946)

Owned ("Mine") cloud plugins now offer the same local-only Delete as local
plugins: it removes the installed package and leaves the plugin in the cloud,
still reinstallable. Deleting a plugin from the cloud belongs on the plugin hub
and is no longer reachable from OrcaSlicer, so the whole cloud-delete chain is
removed down to the REST binding.

The deleted row is restored locally instead of via a blocking cloud refetch, so
it survives being offline, and it comes back without the deleted package's error
state.
This commit is contained in:
SoftFever
2026-07-25 22:31:40 +08:00
committed by GitHub
parent 9a72dda79a
commit a62fb17e03
8 changed files with 20 additions and 161 deletions

View File

@@ -113,39 +113,6 @@ bool CloudPluginService::request_cloud_unsubscribe(const PluginDescriptor& plugi
return true;
}
bool CloudPluginService::request_cloud_delete(const PluginDescriptor& plugin, std::string& error) const
{
if (!m_orca_agent) {
error = "No cloud agent.";
return false;
}
if (!plugin.is_cloud_plugin()) {
error = "Only cloud plugins can be deleted.";
return false;
}
const std::string cloud_uuid = plugin.cloud_uuid();
if (cloud_uuid.empty()) {
error = "Cloud plugin key is missing UUID.";
return false;
}
if (!plugin.cloud.has_value() || !plugin.cloud->is_mine) {
error = "Only your own plugins can be deleted from the cloud.";
return false;
}
int result = m_orca_agent->delete_my_plugin(cloud_uuid);
if (result != 0) {
error = "Failed to delete plugin from cloud, see logs for more info.";
return false;
}
return true;
}
bool CloudPluginService::download_cloud_plugin(PluginDescriptor& entry,
const std::string& requested_version,
CloudPluginDownload& download,

View File

@@ -29,7 +29,6 @@ public:
std::vector<std::string>& unauthorized) const;
bool request_cloud_subscribe(const std::string& plugin_uuid, std::string& error) const;
bool request_cloud_unsubscribe(const PluginDescriptor& plugin, std::string& error) const;
bool request_cloud_delete(const PluginDescriptor& plugin, std::string& error) const;
bool download_cloud_plugin(PluginDescriptor& entry,
const std::string& requested_version,
CloudPluginDownload& download,

View File

@@ -1857,7 +1857,7 @@ bool PluginManager::unsubscribe_cloud_plugin(const std::string& plugin_key, std:
}
if (descriptor.cloud && descriptor.cloud->is_mine) {
error = "Cannot unsubscribe your own plugins. Use Delete from Cloud instead.";
error = "Cannot unsubscribe your own plugins.";
set_plugin_error(plugin_key, error);
return false;
}
@@ -1890,7 +1890,7 @@ bool PluginManager::delete_and_unsubscribe_cloud_plugin(const std::string& plugi
}
if (descriptor.cloud->is_mine) {
error = "Use Delete local and cloud for owned plugins.";
error = "Cannot unsubscribe your own plugins. Use Delete to remove the local files.";
set_plugin_error(plugin_key, error);
return false;
}
@@ -1903,72 +1903,6 @@ bool PluginManager::delete_and_unsubscribe_cloud_plugin(const std::string& plugi
return finalize_cloud_plugin_removal(descriptor, false, error);
}
bool PluginManager::delete_mine_plugin_from_cloud(const std::string& plugin_key, std::string& error)
{
if (!wait_for_discovery(std::chrono::milliseconds::max(), error))
return false;
error.clear();
PluginDescriptor descriptor;
if (!try_get_plugin_descriptor(plugin_key, descriptor)) {
error = "Plugin not found: " + plugin_key;
return false;
}
if (!descriptor.is_cloud_plugin()) {
error = "Only owned cloud plugins can be deleted from the cloud.";
set_plugin_error(plugin_key, error);
return false;
}
if (!descriptor.cloud->is_mine) {
error = "Only your own plugins can be deleted from the cloud.";
set_plugin_error(plugin_key, error);
return false;
}
if (!m_cloud_service.request_cloud_delete(descriptor, error)) {
set_plugin_error(plugin_key, error);
return false;
}
return finalize_cloud_plugin_removal(descriptor, true, error);
}
bool PluginManager::delete_mine_local_and_cloud_plugin(const std::string& plugin_key, std::string& error)
{
if (!wait_for_discovery(std::chrono::milliseconds::max(), error))
return false;
error.clear();
PluginDescriptor descriptor;
if (!try_get_plugin_descriptor(plugin_key, descriptor)) {
error = "Plugin not found: " + plugin_key;
return false;
}
if (!descriptor.is_cloud_plugin()) {
error = "Only owned cloud plugins can be deleted from local and cloud.";
set_plugin_error(plugin_key, error);
return false;
}
if (!descriptor.cloud->is_mine) {
error = "Only your own plugins can be deleted from local and cloud.";
set_plugin_error(plugin_key, error);
return false;
}
if (!m_cloud_service.request_cloud_delete(descriptor, error)) {
set_plugin_error(plugin_key, error);
return false;
}
return finalize_cloud_plugin_removal(descriptor, false, error);
}
ExecutionResult PluginManager::run_script_capability(const std::string& plugin_key, const std::string& capability_name, std::string& error)
{
if (plugin_key.empty() || capability_name.empty()) {

View File

@@ -196,8 +196,6 @@ public:
bool delete_plugin(const std::string& plugin_key, std::string& error);
bool unsubscribe_cloud_plugin(const std::string& plugin_key, std::string& error);
bool delete_and_unsubscribe_cloud_plugin(const std::string& plugin_key, std::string& error);
bool delete_mine_plugin_from_cloud(const std::string& plugin_key, std::string& error);
bool delete_mine_local_and_cloud_plugin(const std::string& plugin_key, std::string& error);
ExecutionResult run_script_capability(const std::string& plugin_key, const std::string& capability_name, std::string& error);