Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions includes/page_actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ function handleCorePageAction(string $page, array &$extraFooterScripts): void
break;
case "/restapi_conf":
DisplayRestAPI();
break;
case "/plugin_conf":
DisplayPlugins();
break;
case "/about":
DisplayAbout();
Expand Down
21 changes: 21 additions & 0 deletions includes/plugins.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

require_once 'includes/functions.php';
require_once 'config.php';

/**
*
*/
function DisplayPlugins()
{
$status = new \RaspAP\Messages\StatusMessage;
$pluginInstaller = \RaspAP\Plugins\PluginInstaller::getInstance();
$plugins = $pluginInstaller->getUserPlugins();
$pluginsTable = $pluginInstaller->getHTMLPluginsTable($plugins);

echo renderTemplate("plugins", compact(
"status",
"pluginsTable"
));

}
1 change: 1 addition & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
require_once 'includes/wireguard.php';
require_once 'includes/provider.php';
require_once 'includes/restapi.php';
require_once 'includes/plugins.php';

initializeApp();
?>
Expand Down
3 changes: 3 additions & 0 deletions src/RaspAP/UI/Sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public function __construct() {
);
$this->addItem(_('RestAPI'), 'fas fa-puzzle-piece', 'restapi_conf', 120,
fn() => RASPI_RESTAPI_ENABLED
);
$this->addItem(_('Plugins'), 'fas fa-plug-circle-bolt', 'plugin_conf', 125,
fn() => RASPI_PLUGINS_ENABLED
);
$this->addItem(_('System'), 'fas fa-cube', 'system_info', 130,
fn() => RASPI_SYSTEM_ENABLED
Expand Down
117 changes: 117 additions & 0 deletions templates/plugins.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col">
<i class="fas fa-plug-circle-bolt me-2"></i><?php echo _("Plugins"); ?>
</div>
</div><!-- /.row -->
</div><!-- /.card-header -->
<div class="card-body">
<?php $status->showMessages(); ?>
<h4 class="mt-3"><?php echo _("Plugins") ;?></h4>
<?php echo \RaspAP\Tokens\CSRF::hiddenField(); ?>
<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>
<?php if (!RASPI_MONITOR_ENABLED) : ?>
<div class="small mt-2">
<?php echo _("Choose <strong>Details</strong> for more information and to install a plugin."); ?>
</div>
<?php endif ?>
<?php echo $pluginsTable; ?>
</div>
</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-plug me-2"></i><?php echo _("Plugin details"); ?></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-1"></p>
<p id="plugin-additional" class="mb-3"></p>

<table class="table table-bordered">
<tbody>
<tr>
<th><?php echo _("Plugin docs"); ?></th>
<td><span id="plugin-docs"></span></td>
</tr>
<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><small><code><span id="plugin-locale"></span></span></code></td>
</tr>
<tr>
<th><?php echo _("Configuration files"); ?></th>
<td><small><code><span id="plugin-configuration" class="mb-0"></span></code></small></td>
</tr>
<tr>
<th><?php echo _("Signed Packages"); ?></th>
<td><small><code><span id="plugin-packages" class="mb-0"></span></code></small></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 _("JavaScript"); ?></th>
<td><small><code><span id="plugin-javascript" class="mb-0"></span></code></small></td>
</tr>
<tr>
<th><?php echo _("Sudoers"); ?></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" id="js-install-plugin-confirm" class="btn btn-outline-success btn-activate"></button>
</div>
</div>
</div>
</div>

<!-- modal plugin-install-progress -->
<div class="modal fade" id="install-plugin-progress" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true">
<div class="modal-dialog" 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 _("Installing plugin"); ?></div>
</div>
<div class="modal-body">
<div class="col-md-12 mb-3 mt-1" data-message="<?php echo _("Plugin install completed."); ?>" id="plugin-install-message"><?php echo _("Plugin installation in progress..."); ?><i class="fas fa-cog fa-spin link-secondary ms-2"></i></div>
</div>
<div class="modal-footer">
<button type="button" id="js-install-plugin-ok" class="btn btn-outline-success btn-activate" disabled><?php echo _("OK"); ?></button>
</div>
</div>
</div>
</div>

94 changes: 0 additions & 94 deletions templates/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
<li role="presentation" class="nav-item"><a class="nav-link" id="themetab" href="#theme" aria-controls="theme" role="tab" data-bs-toggle="tab"><?php echo _("Theme"); ?></a></li>
<li role="presentation" class="nav-item"><a class="nav-link" id="advancedtab" href="#advanced" aria-controls="advanced" role="tab" data-bs-toggle="tab"><?php echo _("Advanced"); ?></a></li>
<li role="presentation" class="nav-item"><a class="nav-link" id="toolstab" href="#tools" aria-controls="tools" role="tab" data-bs-toggle="tab"><?php echo _("Tools"); ?></a></li>
<?php if (RASPI_PLUGINS_ENABLED) : ?>
<li role="presentation" class="nav-item"><a class="nav-link" id="pluginstab" href="#plugins" aria-controls="plugins" role="tab" data-bs-toggle="tab"><?php echo _("Plugins"); ?></a></li>
<?php endif ?>
</ul>
<!-- Tab panes -->
<div class="tab-content">
Expand All @@ -29,9 +26,6 @@
<?php echo renderTemplate("system/theme", $__template_data) ?>
<?php echo renderTemplate("system/advanced", $__template_data) ?>
<?php echo renderTemplate("system/tools", $__template_data) ?>
<?php if (RASPI_PLUGINS_ENABLED) : ?>
<?php echo renderTemplate("system/plugins", $__template_data) ?>
<?php endif ?>
</div><!-- /.tab-content -->
</form>
</div><!-- /.card-body -->
Expand Down Expand Up @@ -111,91 +105,3 @@
</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-plug me-2"></i><?php echo _("Plugin details"); ?></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-1"></p>
<p id="plugin-additional" class="mb-3"></p>

<table class="table table-bordered">
<tbody>
<tr>
<th><?php echo _("Plugin docs"); ?></th>
<td><span id="plugin-docs"></span></td>
</tr>
<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><small><code><span id="plugin-locale"></span></span></code></td>
</tr>
<tr>
<th><?php echo _("Configuration files"); ?></th>
<td><small><code><span id="plugin-configuration" class="mb-0"></span></code></small></td>
</tr>
<tr>
<th><?php echo _("Signed Packages"); ?></th>
<td><small><code><span id="plugin-packages" class="mb-0"></span></code></small></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 _("JavaScript"); ?></th>
<td><small><code><span id="plugin-javascript" class="mb-0"></span></code></small></td>
</tr>
<tr>
<th><?php echo _("Sudoers"); ?></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" id="js-install-plugin-confirm" class="btn btn-outline-success btn-activate"></button>
</div>
</div>
</div>
</div>

<!-- modal plugin-install-progress -->
<div class="modal fade" id="install-plugin-progress" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true">
<div class="modal-dialog" 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 _("Installing plugin"); ?></div>
</div>
<div class="modal-body">
<div class="col-md-12 mb-3 mt-1" data-message="<?php echo _("Plugin install completed."); ?>" id="plugin-install-message"><?php echo _("Plugin installation in progress..."); ?><i class="fas fa-cog fa-spin link-secondary ms-2"></i></div>
</div>
<div class="modal-footer">
<button type="button" id="js-install-plugin-ok" class="btn btn-outline-success btn-activate" disabled><?php echo _("OK"); ?></button>
</div>
</div>
</div>
</div>

19 changes: 0 additions & 19 deletions templates/system/plugins.php

This file was deleted.

Loading