mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-07-30 12:09:26 +02:00
Set install_path, revise parameters used w/ installPlugin()
This commit is contained in:
parent
335491124f
commit
b89fe7c6b8
@ -10,20 +10,19 @@ require_once '../../src/RaspAP/Plugins/PluginInstaller.php';
|
||||
$pluginInstaller = \RaspAP\Plugins\PluginInstaller::getInstance();
|
||||
$plugin_uri = $_POST['plugin_uri'] ?? null;
|
||||
$plugin_version = $_POST['plugin_version'] ?? null;
|
||||
$install_path = $_POST['install_path'] ?? null;
|
||||
|
||||
if (isset($plugin_uri) && isset($plugin_version)) {
|
||||
$archiveUrl = rtrim($plugin_uri, '/') . '/archive/refs/tags/' . $plugin_version .'.zip';
|
||||
|
||||
if (isset($plugin_uri, $plugin_version, $install_path)) {
|
||||
try {
|
||||
$return = $pluginInstaller->installPlugin($archiveUrl);
|
||||
$return = $pluginInstaller->installPlugin($plugin_uri, $plugin_version, $install_path);
|
||||
echo json_encode($return);
|
||||
} catch (Exception $e) {
|
||||
http_response_code(422); // Unprocessable Content
|
||||
http_response_code(422); // unprocessable content
|
||||
echo json_encode(['error' => $e->getMessage()]);
|
||||
}
|
||||
} else {
|
||||
http_response_code(400); // Bad Request
|
||||
echo json_encode(['error' => 'Plugin URI and version are required']);
|
||||
echo json_encode(['error' => 'Plugin URI, version, and install path are required']);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user