diff --git a/scripts/uninstall_plugin b/scripts/uninstall_plugin index b97b40cf0..0ce6a7f8e 100755 --- a/scripts/uninstall_plugin +++ b/scripts/uninstall_plugin @@ -10,7 +10,7 @@ then exit 1 fi -logOutput +teeOutput if [ -x "${PLUGINDIR}/$1/scripts/fpp_uninstall.sh" ] then diff --git a/www/api/controllers/plugin.php b/www/api/controllers/plugin.php index f8da2b2e4..05c916a3c 100644 --- a/www/api/controllers/plugin.php +++ b/www/api/controllers/plugin.php @@ -134,8 +134,9 @@ function GetPluginInfo() // DELETE /api/plugin/:RepoName function UninstallPlugin() { - global $settings, $fppDir, $SUDO; + global $settings, $fppDir, $SUDO, $_REQUEST; $result = Array(); + $stream = $_REQUEST['stream']; $plugin = params('RepoName'); @@ -152,11 +153,19 @@ function UninstallPlugin() exec("rm " . $settings['pluginDirectory'] . "/" . $data['linkName'], $output, $return_val); } - exec("export SUDO=\"" . $SUDO . "\"; export PLUGINDIR=\"" . $settings['pluginDirectory'] ."\"; $fppDir/scripts/uninstall_plugin $plugin", $output, $return_val); - unset($output); + if (isset($stream) && $stream != "false") { + DisableOutputBuffering(); + system("$fppDir/scripts/uninstall_plugin $plugin", $return_val); + } else { + exec("export SUDO=\"" . $SUDO . "\"; export PLUGINDIR=\"" . $settings['pluginDirectory'] ."\"; $fppDir/scripts/uninstall_plugin $plugin", $output, $return_val); + unset($output); + } if ($return_val == 0) { + if (isset($stream) && $stream != "false") { + return "\nDone\n"; + } $result['Status'] = 'OK'; $result['Message'] = ''; } diff --git a/www/plugins.php b/www/plugins.php index 008daf2c2..7249e529b 100644 --- a/www/plugins.php +++ b/www/plugins.php @@ -111,24 +111,9 @@ function InstallPlugin(plugin, branch, sha) { } function UninstallPlugin(plugin) { - var url = 'api/plugin/' + plugin; - $('html,body').css('cursor', 'wait'); - $.ajax({ - url: url, - type: 'DELETE', - dataType: 'json', - success: function (data) { - $('html,body').css('cursor', 'auto'); - if (data.Status == 'OK') - location.reload(true); - else - alert('ERROR: ' + data.Message); - }, - error: function () { - $('html,body').css('cursor', 'auto'); - alert('Error, API call to uninstall plugin failed'); - } - }); + var url = 'api/plugin/' + plugin + '?stream=true'; // Assuming your API supports streaming for uninstall + DisplayProgressDialog("pluginsProgressPopup", "Uninstall Plugin"); + StreamURL(url, 'pluginsProgressPopupText', 'PluginProgressDialogDone', 'PluginProgressDialogDone', 'DELETE'); } function ShowUninstallPluginPopup(plugin, pluginName) { @@ -550,4 +535,4 @@ class="form-control form-control-lg form-control-rounded has-shadow" - \ No newline at end of file +