mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Initial commit
This commit is contained in:
parent
9bb2075b77
commit
7dcc177424
29
ajax/plugins/do_plugin_install.php
Executable file
29
ajax/plugins/do_plugin_install.php
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require '../../includes/csrf.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;
|
||||||
|
|
||||||
|
if (isset($plugin_uri) && isset($plugin_version)) {
|
||||||
|
$archiveUrl = rtrim($plugin_uri, '/') . '/archive/refs/tags/' . $plugin_version .'.zip';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$return = $pluginInstaller->installPlugin($archiveUrl);
|
||||||
|
echo json_encode($return);
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
http_response_code(500);
|
||||||
|
echo json_encode(['error' => $e->getMessage()]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
http_response_code(400);
|
||||||
|
echo json_encode(['error' => 'Plugin URI and version are required']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user