Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
lbr38 committed Jan 2, 2025
1 parent 4ca4dd1 commit 7a8dabc
Show file tree
Hide file tree
Showing 23 changed files with 100 additions and 96 deletions.
4 changes: 2 additions & 2 deletions www/controllers/App/Config/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public static function get()
$message = '<span>A new release is available: ';
}

$message .= '<a href="' . PROJECT_GIT_REPO . '/releases/latest" target="_blank" rel="noopener noreferrer" title="See changelog"><code>' . GIT_VERSION . '</code> <img src="/assets/icons/external-link.svg" class="icon" /></a>';
$message .= '<br><br><span>Please update your docker image by following the steps documented <b><a href="' . PROJECT_UPDATE_DOC_URL . '" target="_blank" rel="noopener noreferrer"><code>here</code></b> <img src="/assets/icons/external-link.svg" class="icon" /></a></span>';
$message .= '<a href="' . PROJECT_GIT_REPO . '/releases/latest" target="_blank" rel="noopener noreferrer" title="See changelog"><code>' . GIT_VERSION . '</code> <img src="/assets/icons/external-link.svg" class="icon-small" /></a>';
$message .= '<br><br><span>Please update your docker image by following the steps documented <b><a href="' . PROJECT_UPDATE_DOC_URL . '" target="_blank" rel="noopener noreferrer"><code>here</code></b> <img src="/assets/icons/external-link.svg" class="icon-small" /></a></span>';

$NOTIFICATION_MESSAGES[] = array('Title' => 'Update available', 'Message' => $message);
$NOTIFICATION++;
Expand Down
4 changes: 2 additions & 2 deletions www/controllers/Repo/Repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ public function setGpgCheck(string $gpgCheck)
$this->gpgCheck = $gpgCheck;
}

public function setGpgSign(string $gpgResign)
public function setGpgSign(string $gpgSign)
{
$this->gpgSign = $gpgResign;
$this->gpgSign = $gpgSign;
}

public function setArch(array $arch)
Expand Down
4 changes: 2 additions & 2 deletions www/controllers/Task/Form/Param/GpgSign.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

class GpgSign
{
public static function check(string $gpgResign) : void
public static function check(string $gpgSign) : void
{
if ($gpgResign !== 'true' and $gpgResign !== 'false') {
if ($gpgSign !== 'true' and $gpgSign !== 'false') {
throw new Exception('GPG signature is invalid');
}
}
Expand Down
2 changes: 1 addition & 1 deletion www/controllers/Task/Log/SubStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function completed(string|null $message = '', string|null $identifier = '
/**
* Set a warning message for the latest sub-step
*/
public function warning(string $message) : void
public function warning(string $message, string|null $outputType = null) : void
{
/**
* Get latest step Id
Expand Down
2 changes: 1 addition & 1 deletion www/controllers/Task/Repo/Metadata/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private function createMetadata()
$mymetadata->setDist($this->repo->getDist());
$mymetadata->setSection($this->repo->getSection());
$mymetadata->setArch($this->repo->getArch());
$mymetadata->setGpgResign($this->repo->getGpgSign());
$mymetadata->setGpgSign($this->repo->getGpgSign());
$mymetadata->create();
}
} catch (Exception $e) {
Expand Down
15 changes: 7 additions & 8 deletions www/controllers/Task/Repo/Metadata/Deb.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Deb extends Metadata
private $dist;
private $section;
private $arch;
private $gpgResign = false;
private $gpgSign = false;
private $aptftparchive = '/usr/bin/apt-ftparchive';
private $pid;
private $task;
Expand Down Expand Up @@ -41,9 +41,9 @@ public function setArch(array $arch)
$this->arch = $arch;
}

public function setGpgResign(string $gpgResign)
public function setGpgSign(string $gpgSign)
{
$this->gpgResign = $gpgResign;
$this->gpgSign = $gpgSign;
}

/**
Expand Down Expand Up @@ -164,9 +164,7 @@ public function create()
$this->taskLogSubStepController->output($output, 'pre');

if ($myprocess->getExitCode() != 0) {
echo '<img src="/assets/icons/error.svg" class="icon margin-left-5 margin-right-5 vertical-align-text-top" /><span class="redtext">failed to generate Packages metadata file</span><br>';
echo $output;
throw new Exception('Failed to generate Packages metadata file');
throw new Exception('Failed to generate Packages metadata file.');
}

$myprocess->close();
Expand Down Expand Up @@ -212,9 +210,10 @@ public function create()
}

/**
* Quit here if GPG resign is not enabled
* Quit here if GPG signature is not enabled
*/
if ($this->gpgResign != 'true') {
if ($this->gpgSign != 'true') {
$this->taskLogSubStepController->completed();
return;
}

Expand Down
21 changes: 13 additions & 8 deletions www/controllers/Task/Repo/Package/Sign.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,21 @@ private function signPackage()
$myprocess->close();

/**
* Specific case, we will display a warning if the following message has been detected in the logs
* Specific case, we will display a warning if "warning:" has been detected in the logs
*/
if (preg_match("/gpg: WARNING:/", $output)) {
$this->taskLogSubStepController->warning($output);
if (preg_match("/warning:/i", $output)) {
// If the warning is about an identical signature, we skip the package and mark the substep as completed
if (preg_match("/already contains identical signature, skipping/", $output)) {
$this->taskLogSubStepController->completed('Identical signature already present, skipping');

// Otherwise, we display the warning and mark the substep as completed
} else {
$this->taskLogSubStepController->warning('Warning detected during package signing');
$this->taskLogSubStepController->output($output, 'pre');
}
} else {
$this->taskLogSubStepController->completed();
}
if (preg_match("/warning:/", $output)) {
$this->taskLogSubStepController->warning($output);
}

$this->taskLogSubStepController->completed();

$packageCounter++;
}
Expand Down
9 changes: 4 additions & 5 deletions www/controllers/Task/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Task
private $time;
private $repoName;
private $gpgCheck;
private $gpgResign;
private $gpgSign;
private $timeStart;
private $timeEnd;

Expand Down Expand Up @@ -426,10 +426,9 @@ public function execute(array $tasksParams)
*/
public function executeId(int $id)
{
// TODO debug
// $myprocess = new \Controllers\Process('/usr/bin/php ' . ROOT . '/tasks/execute.php --id="' . $id . '" >/dev/null 2>/dev/null &');
// $myprocess->execute();
// $myprocess->close();
$myprocess = new \Controllers\Process('/usr/bin/php ' . ROOT . '/tasks/execute.php --id="' . $id . '" >/dev/null 2>/dev/null &');
$myprocess->execute();
$myprocess->close();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions www/public/resources/js/repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ $(document).on('click','.client-configuration-btn',function () {
var commands = 'echo -e "[' + repo_conf_files_prefix + '' + repoName + '_' + repoEnv + ']\nname=' + repoName + ' repo on ' + www_hostname + '\nbaseurl=' + repo_dir_url + '/' + repoName + '_' + repoEnv + '\nenabled=1\ngpgkey=' + repo_dir_url + '/gpgkeys/' + www_hostname + '.pub\ngpgcheck=1" > /etc/yum.repos.d/' + repo_conf_files_prefix + '' + repoName + '.repo';
}
if (packageType == "deb") {
var commands = 'curl -sS ' + repo_dir_url + '/gpgkeys/' + www_hostname + '.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/' + www_hostname + '.gpg\n\n';
var commands = 'curl -sS ' + repo_dir_url + '/gpgkeys/' + www_hostname + '.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/' + www_hostname + '.gpg\n';
commands += 'echo "deb ' + repo_dir_url + '/' + repoName + '/' + repoDist + '/' + repoSection + '_' + repoEnv + ' ' + repoDist + ' ' + repoSection + '" > /etc/apt/sources.list.d/' + repo_conf_files_prefix + '' + repoName + '_' + repoDistFormatted + '_' + repoSection + '.list';

/**
Expand All @@ -275,7 +275,7 @@ $(document).on('click','.client-configuration-btn',function () {
/**
* Generation of the div
*/
$('body').append('<div class="divReposConf hide"><span><img title="Close" class="divReposConf-close close-btn lowopacity" src="/assets/icons/close.svg" /></span><h3>INSTALLATION</h3><h5>Use the code below to install the repo on a host:</h5><div id="divReposConfCommands-container"><pre id="divReposConfCommands">' + commands + '</pre><img src="/assets/icons/duplicate.svg" class="icon-lowopacity" title="Copy to clipboard" onclick="copyToClipboard(divReposConfCommands)" /></div></div>');
$('body').append('<div class="divReposConf hide"><span><img title="Close" class="divReposConf-close close-btn lowopacity" src="/assets/icons/close.svg" /></span><h3>INSTALLATION</h3><p class="note">Use the commands below to install the repository on a host.</p><div id="divReposConfCommands-container"><pre id="divReposConfCommands">' + commands + '</pre><img src="/assets/icons/duplicate.svg" class="icon-lowopacity" title="Copy to clipboard" onclick="copyToClipboard(divReposConfCommands)" /></div></div>');

/**
* Print
Expand Down
2 changes: 1 addition & 1 deletion www/public/resources/styles/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pre.codeblock {
.font-size-10{font-size:10px !important}.font-size-11{font-size: 11px !important}.font-size-12{font-size: 12px !important}.font-size-13{font-size: 13px !important}.font-size-14{font-size: 14px !important}.font-size-15{font-size: 15px !important}.font-size-16{font-size: 16px !important}.font-size-17{font-size: 17px !important}.font-size-18{font-size: 18px !important}.font-size-20{font-size: 20px !important}.font-size-22{font-size: 22px !important}
.mediumopacity,.mediumopacity-cst{
color: #97a5b4;
filter: brightness(0) saturate(100%) invert(72%) sepia(2%) saturate(2168%) hue-rotate(169deg) brightness(89%) contrast(95%);
filter: brightness(0) saturate(100%) invert(72%) sepia(2%) saturate(2168%) hue-rotate(169deg) brightness(95%) contrast(95%);
}
.lowopacity,.lowopacity-cst{
color: #8A99AA;
Expand Down
20 changes: 3 additions & 17 deletions www/public/resources/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ article {

.item-arrow-up span {
position: absolute;
top: -61px;
top: -64px;
left: 15px;
height: 72.5px;
height: 77.5px;
width: 30px;
border-left: 1px solid #8A99AA;
border-bottom: 1px solid #8A99AA;
Expand Down Expand Up @@ -408,21 +408,7 @@ article {
margin-bottom: 30px;
background-color: #1d3349;
border: 1px solid #24405c;
}

/* Menu gestion des profils */
/* input qui ont le même fond que la couleur de fond de leur conteneur permettant que le cadre de l'input soit 'invisible' */
input[type=text].invisibleInput, input[type=text].invisibleInput-blue {
border: none;
}

input[type=text].invisibleInput {
background-color: #2b2b2b;
}

input[type=text].invisibleInput-blue {
background-color: #1d3349;
width: 100%;
line-height: 1.5;
}

input::placeholder {
Expand Down
4 changes: 2 additions & 2 deletions www/views/includes/containers/host/history.inc.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<section class="flex-div-50 div-generic-blue reloadable-container" container="host/history">
<h5>HISTORY</h5>
<h6 class="margin-top-0">HISTORY</h6>

<p class="lowopacity-cst">Packages events history (installation, update, uninstallation...)</p>
<p class="note">Packages events history (installation, update, uninstallation...).</p>
<br>

<?php
Expand Down
26 changes: 14 additions & 12 deletions www/views/includes/containers/host/packages.inc.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
<section class="flex-div-50 div-generic-blue reloadable-container" container="host/packages">
<h5>PACKAGES</h5>
<h6 class="margin-top-0">PACKAGES INVENTORY</h6>
<p class="note">Packages installed and available updates.</p>

<div class="grid grid-2">
<div id="available-packages-btn" class="flex align-item-center column-gap-5 pointer">
<div class="grid grid-2 margin-bottom-15">
<div>
<h6>INSTALLED</h6>
<span id="installed-packages-btn" class="label-white pointer"><?= $packagesInstalledCount ?></span>
</div>

<div>
<h6>TO UPDATE</h6>

<?php
$labelColor = 'white';

Expand All @@ -12,13 +20,7 @@
$labelColor = 'yellow';
} ?>

<span class="label-<?= $labelColor ?>"><?= $packagesAvailableTotal ?></span>
<span><b>To update</b></span>
</div>

<div id="installed-packages-btn" class="flex align-item-center column-gap-5 pointer">
<span class="label-white"><?= $packagesInstalledCount ?></span>
<span><b>Total installed</b></span>
<span id="available-packages-btn" class="label-<?= $labelColor ?> pointer"><?= $packagesAvailableTotal ?></span>
</div>
</div>

Expand All @@ -36,9 +38,9 @@
</div>

<div id="installed-packages-div" class="hide">
<p class="margin-top-15 margin-bottom-15"><?= count($packagesInventored) ?> packages inventored</p>
<p class="mediumopacity-cst margin-top-15 margin-bottom-15"><?= count($packagesInventored) ?> packages inventored</p>

<input type="text" id="installed-packages-search" onkeyup="filterPackage()" autocomplete="off" placeholder="Search package">
<input type="text" id="installed-packages-search" class="margin-bottom-5" onkeyup="filterPackage()" autocomplete="off" placeholder="Search package">

<div id="installed-packages-container">
<?php
Expand Down
2 changes: 1 addition & 1 deletion www/views/includes/containers/host/requests.inc.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<section class="flex-div-50 div-generic-blue reloadable-container" container="host/requests">
<div class="flex justify-space-between">
<h5>REQUESTS</h5>
<h6 class="margin-top-0">REQUESTS</h6>

<div id="host-request-btn" class="slide-btn" host-id="<?= $id ?>" title="Request">
<img src="/assets/icons/rocket.svg">
Expand Down
45 changes: 29 additions & 16 deletions www/views/includes/containers/host/summary.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@
<div class="grid grid-3 column-gap-30">
<div>
<h6 class="margin-top-0">IP</h6>
<p class="copy"><?= $ip ?></p>
<p class="mediumopacity-cst copy"><?= $ip ?></p>

<h6>OS</h6>
<p class="flex align-item-center column-gap-5">
<div class="flex align-item-center column-gap-5">
<?php
if (!empty($os)) {
echo \Controllers\Common::printOsIcon($os);
echo $os;
echo '<p class="mediumopacity-cst">' . $os . '</p>';
} else {
echo 'Unknown';
echo '<p class="mediumopacity-cst">Unknown</p>';
} ?>
</p>
</div>

<h6>OS VERSION</h6>
<p class="copy">
<p class="mediumopacity-cst copy">
<?php
if (!empty($osVersion)) {
echo $osVersion;
Expand All @@ -49,7 +49,7 @@

<div>
<h6 class="margin-top-0">PROFILE</h6>
<p class="copy">
<p class="mediumopacity-cst copy">
<?php
if (!empty($profile)) {
echo $profile;
Expand All @@ -71,27 +71,40 @@

<div>
<h6 class="margin-top-0">AGENT STATUS</h6>
<p class="flex align-item-center column-gap-5">
<div class="flex align-item-center column-gap-5">
<?php
if ($agentStatus == 'running') {
echo '<img src="/assets/icons/check.svg" class="icon" title="Agent state on this host: ' . $agentStatus . ' (' . $agentLastSendStatusMsg . ')." /> Running';
$status = 'running';
$statusTitle = 'Running';
$icon = 'check.svg';
}
if ($agentStatus == "disabled") {
echo '<img src="/assets/icons/warning-red.svg" class="icon" title="Agent state on this host: ' . $agentStatus . ' (' . $agentLastSendStatusMsg . ')." /> Disabled';
$status = 'disabled';
$statusTitle = 'Disabled';
$icon = 'warning-red.svg';
}
if ($agentStatus == "stopped") {
echo '<img src="/assets/icons/warning-red.svg" class="icon" title="Agent state on this host: ' . $agentStatus . ' (' . $agentLastSendStatusMsg . ')." /> Stopped';
$status = 'stopped';
$statusTitle = 'Stopped';
$icon = 'warning-red.svg';
}
if ($agentStatus == "seems-stopped") {
echo '<img src="/assets/icons/warning-red.svg" class="icon" title="Agent state on this host: ' . $agentStatus . ' (' . $agentLastSendStatusMsg . ')." /> Seems stopped';
$status = 'seems-stopped';
$statusTitle = 'Seems stopped';
$icon = 'warning-red.svg';
}
if ($agentStatus == "unknown") {
echo '<img src="/assets/icons/warning-red.svg" class="icon" title="Agent state on this host: ' . $agentStatus . '." /> Unknown';
} ?>
</p>
$status = 'unknown';
$statusTitle = 'Unknown';
$icon = 'warning-red.svg';
}

echo '<img src="/assets/icons/' . $icon . '" class="icon" title="Agent state on this host: ' . $status . ' (' . $agentLastSendStatusMsg . ')." />';
echo '<p class="mediumopacity-cst">' . $statusTitle . '</p>'; ?>
</div>

<h6>AGENT VERSION</h6>
<p class="copy">
<p class="mediumopacity-cst copy">
<?php
if (!empty($agentVersion)) {
echo $agentVersion;
Expand Down
2 changes: 1 addition & 1 deletion www/views/includes/containers/hosts/list.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

<?php
if ($totalHosts == 0) : ?>
<p class="note">No host registered yet!<br>Install <a href="https://github.com/lbr38/linupdate" target="_blank" rel="noopener noreferrer" class="font-size-13"><b>linupdate</b> <img src="/assets/icons/external-link.svg" class="icon" /></a> on your hosts to register them to Repomanager. This page will display dashboards and informations about the hosts and their packages (installed, available, updated...). See <a href="https://github.com/lbr38/linupdate/wiki/Module:-reposerver#quick-setup-example" class="font-size-13"><b>quick setup example</b> <img src="/assets/icons/external-link.svg" class="icon" /></a>.
<p class="note">No host registered yet!<br>Install <a href="https://github.com/lbr38/linupdate" target="_blank" rel="noopener noreferrer" class="font-size-13"><b>linupdate</b> <img src="/assets/icons/external-link.svg" class="icon-small" /></a> on your hosts to register them to Repomanager. This page will display dashboards and informations about the hosts and their packages (installed, available, updated...). See <a href="https://github.com/lbr38/linupdate/wiki/Module:-reposerver#quick-setup-example" class="font-size-13"><b>quick setup example</b> <img src="/assets/icons/external-link.svg" class="icon-small" /></a>.
<?php
endif;

Expand Down
2 changes: 1 addition & 1 deletion www/views/includes/containers/settings/settings.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@

if (CVE_IMPORT == 'true') : ?>
<h6>ACCESS CVEs PAGE (beta)</h6>
<p><a href="/cves" target="_blank" rel="noopener noreferrer">CVEs page (beta)<img src="/assets/icons/external-link.svg" class="icon margin-left-5" /></a></p>
<p><a href="/cves" target="_blank" rel="noopener noreferrer">CVEs page (beta)<img src="/assets/icons/external-link.svg" class="icon-small margin-left-5" /></a></p>
<?php
endif ?>

Expand Down
2 changes: 1 addition & 1 deletion www/views/includes/footer.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<h5>HELP</h5>
<a target="_blank" rel="noopener noreferrer" href="https://github.com/lbr38/repomanager/wiki">
<span class="lowopacity">Documentation <img src="/assets/icons/external-link.svg" class="icon" /></span>
<span class="lowopacity">Documentation <img src="/assets/icons/external-link.svg" class="icon-small" /></span>
</a>

<br><br>
Expand Down
Loading

0 comments on commit 7a8dabc

Please sign in to comment.