mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-07-10 22:27:40 +02:00
29 lines
1004 B
PHP
Executable File
29 lines
1004 B
PHP
Executable File
<?php
|
|
|
|
require '../../includes/csrf.php';
|
|
require_once '../../includes/session.php';
|
|
require_once '../../includes/config.php';
|
|
require_once '../../src/RaspAP/Auth/HTTPAuth.php';
|
|
require_once '../../includes/authenticate.php';
|
|
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, $plugin_version, $install_path)) {
|
|
try {
|
|
$return = $pluginInstaller->installPlugin($plugin_uri, $plugin_version, $install_path);
|
|
echo json_encode($return);
|
|
} catch (Exception $e) {
|
|
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, version, and install path are required']);
|
|
exit;
|
|
}
|
|
|