Add premium plugin detection and user guidance for manual downloads

This commit is contained in:
Rbanh committed 2025-03-30 19:55:33 -04:00
1 parent a5e7b766ac
commit 057bba0c56
4 files changed
+251 -63

No files matched your search

@@ -65,13 +65,25 @@ pub async fn replace_plugin(
// Download the new plugin version
let server_type = server_info.as_ref().map(|info| &info.server_type);
crate::lib_download_plugin_from_repository(
let download_result = crate::lib_download_plugin_from_repository(
&plugin_id,
&version,
repository,
&download_path.to_string_lossy(),
server_type
).await?;
).await;
// Check for premium resource indicator
if let Err(error) = &download_result {
if error.starts_with("PREMIUM_RESOURCE:") {
// Extract the resource URL from the error
let resource_url = error.strip_prefix("PREMIUM_RESOURCE:").unwrap_or_default();
return Err(format!("PREMIUM_RESOURCE:{}:{}:{}", plugin_id, version, resource_url));
}
}
// If other error, propagate it
let _ = download_result?;
// Backup the original file
backup_plugin(current_file_path.clone()).await?;