1
0
Fork 0
mirror of https://github.com/24eme/signaturepdf synced 2026-03-14 13:55:44 +01:00

Merge branch 'master' of github.com:24eme/signaturepdf

This commit is contained in:
Vincent LAURENT 2024-08-01 15:44:04 +02:00
commit 708e141493
4 changed files with 39 additions and 8 deletions

10
app.php
View file

@ -52,10 +52,10 @@ if($f3->get('DISABLE_ORGANIZATION')) {
$f3->set('disableOrganization', $f3->get('DISABLE_ORGANIZATION'));
}
if ($f3->get('APP_DEBUG_AUTHORIZED_IP')) {
$ips = explode(' ', $f3->get('APP_DEBUG_AUTHORIZED_IP'));
$f3->set('AUTHORIZED_IP', $ips);
}
$f3->set('ADMIN_AUTHORIZED_IP', array_merge(["localhost", "127.0.0.1", "::1"], $f3->get('ADMIN_AUTHORIZED_IP')));
$f3->set('IS_ADMIN', in_array(@$_SERVER["REMOTE_ADDR"], $f3->get('ADMIN_AUTHORIZED_IP')));
if ($f3->get('GET.lang')) {
selectLanguage($f3->get('GET.lang'), $f3, true);
@ -381,7 +381,7 @@ $f3->route('GET /metadata',
$f3->route ('GET /administration',
function ($f3) {
if (!in_array(@$_SERVER["REMOTE_ADDR"], array("127.0.0.1", "::1")) ) {
if (! $f3->get('IS_ADMIN')) {
die('You ('.$_SERVER['REMOTE_ADDR'].') are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
$f3->set('activeTab','admin');

View file

@ -23,3 +23,6 @@ PDF_STORAGE_PATH=/path/to/folder
;NSS3_DIRECTORY=/path/to/nss3
;NSS3_PASSWORD="my secret password"
;NSS3_NICK="certificate nick"
; Authorize these IP to use debug mode (separate IP adresses with ',')
;ADMIN_AUTHORIZED_IP=

View file

@ -116,6 +116,34 @@
<?php endif; ?>
</td>
</tr>
<tr>
<th class="align-top">CertUtil</th>
<?php $certUtil = NSSCryptography::isCertUtilInstalled(); ?>
<td class="text-muted"><?php if ($certUtil) { echo $certUtil; } ?></td>
<td>
<?php if ($certUtil): ?>
<i class="bi bi-check-square text-success"></i>
<?php else: ?>
<span class="text-warning">
<i class="bi bi-exclamation-octagon-fill"></i> (<?php echo _("Package libnss3-tools missing"); ?>)
</span>
<?php endif; ?>
</td>
</tr>
<tr>
<th class="align-top">Pdfsig</th>
<?php $pdfsig = NSSCryptography::isPDFSigInstalled(); ?>
<td class="text-muted"><?php if ($pdfsig) { echo $pdfsig; } ?></td>
<td>
<?php if ($pdfsig): ?>
<i class="bi bi-check-square text-success"></i>
<?php else: ?>
<span class="text-warning">
<i class="bi bi-exclamation-octagon-fill"></i> (<?php echo _("Package poppler-utils missing"); ?>)
</span>
<?php endif; ?>
</td>
</tr>
@ -123,8 +151,8 @@
</table>
<h5 class="py-2"><?php echo _("List of authorized IP for debugging purposes : "); ?></h4>
<p>
<?php foreach ($AUTHORIZED_IP as $ip): ?>
<?php echo $ip . ' '; ?>
<?php foreach ($ADMIN_AUTHORIZED_IP as $ip): ?>
<?php echo $ip . ','; ?>
<?php endforeach; ?>
</p>

View file

@ -1,5 +1,5 @@
<?php if(!$disableOrganization): ?>
<?php if (in_array(@$_SERVER["REMOTE_ADDR"], array_merge($AUTHORIZED_IP, array("127.0.0.1", "::1"))) ): ?>
<?php if ($IS_ADMIN): ?>
<div class="position-absolute top-0 start-0 mt-2 ms-2">
<a class="btn btn-outline-secondary btn-sm <?php if($activeTab === 'admin'): ?>active<?php endif; ?>" href="<?php echo $REVERSE_PROXY_URL; ?>/administration"><i class="bi bi-wrench-adjustable"></i> <span class="d-none d-sm-inline-block"><?php echo _("Administration panel"); ?></span></a>
</div>