mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Create modal install-user-plugin dialog, update template text
This commit is contained in:
parent
c3968ba42e
commit
2cb66660c5
@ -1,32 +0,0 @@
|
||||
<?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;
|
||||
|
||||
if (isset($plugin_uri)) {
|
||||
$manifestUrl = rtrim($plugin_uri, '/') .'/blob/master/manifest.json?raw=true';
|
||||
|
||||
try {
|
||||
$manifest = $pluginInstaller->getPluginManifest($manifestUrl);
|
||||
if ($manifest) {
|
||||
echo json_encode($manifest);
|
||||
} else {
|
||||
http_response_code(404);
|
||||
echo json_encode(['error' => 'Plugin manifest not found']);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => 'An unexpected error occurred']);
|
||||
}
|
||||
} else {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'Plugin URI is required']);
|
||||
exit;
|
||||
}
|
||||
|
@ -107,3 +107,62 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- modal install-plugin -->
|
||||
<div class="modal fade" id="install-user-plugin" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<div class="modal-title" id="ModalLabel"><i class="fas fa-download me-2"></i><?php echo _("Install user plugin"); ?></div>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<i id="plugin-icon" class="fas fa-plug link-secondary me-2"></i><span id="plugin-name" class="h4 mb-0"></span>
|
||||
<p id="plugin-description" class="mb-3"></p>
|
||||
|
||||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?php echo _("Version"); ?></th>
|
||||
<td><span id="plugin-version"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo _("Author"); ?></th>
|
||||
<td><span id="plugin-author"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo _("License"); ?></th>
|
||||
<td><span id="plugin-license"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo _("Language locale"); ?></th>
|
||||
<td><span id="plugin-locale"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo _("Configuration files"); ?></th>
|
||||
<td><span id="plugin-configuration" class="mb-0"></span></td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo _("Dependencies"); ?></th>
|
||||
<td><small><code><span id="plugin-dependencies" class="mb-0"></span></code></small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo _("Permissions"); ?></th>
|
||||
<td><small><code><span id="plugin-sudoers" class="mb-0"></span></code></small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo _("Non-privileged users"); ?></th>
|
||||
<td><small><code><span id="plugin-user-name"></span></small></code></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal"><?php echo _("Cancel"); ?></button>
|
||||
<button type="button" class="btn btn-outline-success btn-activate"><?php echo _("Install now"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -3,19 +3,17 @@
|
||||
<h4 class="mt-3"><?php echo _("Plugins") ;?></h4>
|
||||
<?php if (!RASPI_MONITOR_ENABLED) : ?>
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-8 col-md-8">
|
||||
<label>
|
||||
<?php echo _("The following user plugins are available to extend RaspAP's functionality."); ?>
|
||||
</label>
|
||||
<div class="small mt-3">
|
||||
<?php echo _("Choose <strong>Install</strong> to download and activate a plugin from the list. <strong>Uninstall</strong> removes an existing plugin."); ?>
|
||||
<div class="small mt-2">
|
||||
<?php echo _("Choose <strong>Details</strong> for more information and to install a plugin. <strong>Uninstall</strong> removes an existing plugin."); ?>
|
||||
</div>
|
||||
<?php echo $pluginsTable; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user