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:
commit
1252fc6e09
10 changed files with 301 additions and 3 deletions
12
.debian/apache.conf
Normal file
12
.debian/apache.conf
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# signaturepdf default Apache configuration
|
||||
|
||||
Alias /signaturepdf /usr/share/signaturepdf/public
|
||||
|
||||
DocumentRoot /usr/share/signaturepdf/public
|
||||
|
||||
<Directory /usr/share/signaturepdf/public>
|
||||
Options SymLinksIfOwnerMatch
|
||||
DirectoryIndex index.php
|
||||
AllowOverride All
|
||||
</Directory>
|
||||
|
||||
18
.debian/postinst
Normal file
18
.debian/postinst
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
# postinstall script for signature pdf
|
||||
|
||||
set -e
|
||||
|
||||
# Droits sur les fichiers
|
||||
chgrp -R www-data /usr/share/signaturepdf/data
|
||||
chgrp -R www-data /usr/share/signaturepdf/pdf
|
||||
|
||||
chmod -R g+rwx /usr/share/signaturepdf/data
|
||||
chmod -R g+rwx /usr/share/signaturepdf/pdf
|
||||
|
||||
# Activation de la conf apache2
|
||||
mkdir -p /etc/apache2/conf-available
|
||||
ln -sf ../../signaturepdf/apache.conf /etc/apache2/conf-available/signaturepdf.conf
|
||||
|
||||
a2enconf signaturepdf
|
||||
systemctl reload apache2
|
||||
45
.github/workflows/build.yaml
vendored
Normal file
45
.github/workflows/build.yaml
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
name: Build debian package (.deb)
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: install git
|
||||
run: sudo apt install git
|
||||
|
||||
- name: Copie des fichiers dans le dossier debian
|
||||
run: |
|
||||
mkdir -p .debian/usr/share/signaturepdf
|
||||
git clone . .debian/usr/share/signaturepdf
|
||||
rm -rf .debian/usr/share/signaturepdf/.git
|
||||
|
||||
mkdir -p .debian/etc/signaturepdf
|
||||
cp .debian/apache.conf .debian/etc/signaturepdf
|
||||
|
||||
- name: Set date / time
|
||||
run: |
|
||||
echo "RELEASE_DATE=$(date +%Y%m%d-%H%M)" >> $GITHUB_ENV
|
||||
|
||||
- name: build-deb-action
|
||||
uses: jiro4989/build-deb-action@v3
|
||||
with:
|
||||
package: signaturepdf
|
||||
package_root: .debian
|
||||
maintainer: 24ème <equipe@24eme.fr>
|
||||
version: ${{ env.RELEASE_DATE }}
|
||||
depends: php, pdftk, librsvg2-bin, imagemagick, potrace, ghostscript, locales
|
||||
arch: all
|
||||
desc: Outils de signature PDF en ligne libre et open-source
|
||||
|
||||
- name: Upload package
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: signaturepdf-${{ env.RELEASE_DATE }}-${{ github.ref_name }}.deb
|
||||
path: ./*.deb
|
||||
|
||||
16
app.php
16
app.php
|
|
@ -4,6 +4,8 @@ setlocale(LC_ALL, "");
|
|||
require(__DIR__.'/lib/GPGCryptography.class.php');
|
||||
require(__DIR__.'/lib/NSSCryptography.class.php');
|
||||
require(__DIR__.'/lib/PDFSignature.class.php');
|
||||
require(__DIR__.'/lib/Image2SVG.class.php');
|
||||
require(__DIR__.'/lib/Compression.class.php');
|
||||
|
||||
$f3 = require(__DIR__.'/vendor/fatfree/base.php');
|
||||
|
||||
|
|
@ -50,6 +52,11 @@ 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);
|
||||
}
|
||||
|
||||
if ($f3->get('GET.lang')) {
|
||||
selectLanguage($f3->get('GET.lang'), $f3, true);
|
||||
} elseif (isset($_COOKIE['LANGUAGE'])) {
|
||||
|
|
@ -371,6 +378,15 @@ $f3->route('GET /metadata',
|
|||
}
|
||||
);
|
||||
|
||||
$f3->route ('GET /administration',
|
||||
function ($f3) {
|
||||
if (!in_array(@$_SERVER["REMOTE_ADDR"], array("127.0.0.1", "::1")) ) {
|
||||
die('You ('.$_SERVER['REMOTE_ADDR'].') are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
|
||||
}
|
||||
$f3->set('activeTab','admin');
|
||||
echo View::instance()->render('admin_setup.html.php');
|
||||
});
|
||||
|
||||
$f3->route('GET /compress',
|
||||
function($f3) {
|
||||
$f3->set('error_message', "none");
|
||||
|
|
|
|||
16
lib/Compression.class.php
Normal file
16
lib/Compression.class.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
class Compression
|
||||
{
|
||||
public static function isgsInstalled() {
|
||||
$output = null;
|
||||
$returnCode = null;
|
||||
|
||||
exec('gs --version', $output, $returnCode);
|
||||
|
||||
if (!$output) {
|
||||
return array(false);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
|
@ -107,9 +107,9 @@ class GPGCryptography
|
|||
|
||||
exec('gpg --version', $output, $returnCode);
|
||||
|
||||
if ($returnCode == 0) {
|
||||
return true;
|
||||
if (!$output) {
|
||||
return array(false);
|
||||
}
|
||||
return false;
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
28
lib/Image2SVG.class.php
Normal file
28
lib/Image2SVG.class.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
class Image2SVG
|
||||
{
|
||||
public static function isimageMagickInstalled() {
|
||||
$output = null;
|
||||
$returnCode = null;
|
||||
|
||||
exec('convert --version', $output, $returnCode);
|
||||
|
||||
if (!$output) {
|
||||
return array(false);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
public static function ispotraceInstalled() {
|
||||
$output = null;
|
||||
$returnCode = null;
|
||||
|
||||
exec('potrace --version', $output, $returnCode);
|
||||
|
||||
if (!$output) {
|
||||
return array(false);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
|
@ -110,4 +110,28 @@ class PDFSignature
|
|||
}
|
||||
}
|
||||
|
||||
public static function isrsvgConvertInstalled() {
|
||||
$output = null;
|
||||
$returnCode = null;
|
||||
|
||||
exec('rsvg-convert --version', $output, $returnCode);
|
||||
|
||||
if (!$output) {
|
||||
return array(false);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
public static function ispdftkInstalled() {
|
||||
$output = null;
|
||||
$returnCode = null;
|
||||
|
||||
exec('pdftk --version', $output, $returnCode);
|
||||
|
||||
if (!$output) {
|
||||
return array(false);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
134
templates/admin_setup.html.php
Normal file
134
templates/admin_setup.html.php
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
<!doctype html>
|
||||
<html lang="<?php echo $TRANSLATION_LANGUAGE ?>" dir="<?php echo $DIRECTION_LANGUAGE ?>" style="direction: <?php echo $DIRECTION_LANGUAGE ?>;" class="<?php echo $DIRECTION_LANGUAGE ?>">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="Logiciel libre de signature de PDF en ligne">
|
||||
<link href="<?php echo $REVERSE_PROXY_URL; ?>/vendor/bootstrap.<?php echo $DIRECTION_LANGUAGE ?>.min.css?5.1.1" rel="stylesheet">
|
||||
<link href="<?php echo $REVERSE_PROXY_URL; ?>/vendor/bootstrap-icons.css?1.11.1" rel="stylesheet">
|
||||
<link href="<?php echo $REVERSE_PROXY_URL; ?>/css/app.css?<?php echo ($COMMIT) ? $COMMIT : filemtime($ROOT."/public/css/app.css") ?>" rel="stylesheet">
|
||||
<title><?php echo _("Administration panel"); ?></title>
|
||||
</head>
|
||||
<body>
|
||||
<?php include('components/navtab.html.php'); ?>
|
||||
<div class="row">
|
||||
<div class="col-2"></div>
|
||||
<div class="col-8">
|
||||
<h1 class="px-4 py-4 display-5 fw-bold mb-0 mt-3 text-center"><i class="bi bi-wrench-adjustable"></i> <?php echo _("Configuration"); ?></h1>
|
||||
<h2 class="my-4"><?php echo _("Server installation"); ?></h2>
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="align-top">PHP</th>
|
||||
<td class="text-muted"><?php echo 'PHP version ' . phpversion(); ?></td>
|
||||
<td>
|
||||
<?php if (version_compare(phpversion(), "5.6.0", ">=")): ?>
|
||||
<i class="bi bi-check-square text-success" title="<?php echo _("Minimal version required : 5.6.0"); ?>"></i>
|
||||
<?php else: ?>
|
||||
<span class="text-danger">
|
||||
<i class="bi bi-exclamation-octagon-fill"></i> (Minimal version required : 5.6.0)
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-top">rsvg-convert</th>
|
||||
<?php $rsvgConvert = implode(PDFSignature::isrsvgConvertInstalled()); ?>
|
||||
<td class="text-muted"><?php echo $rsvgConvert; ?></td>
|
||||
<td>
|
||||
<?php if ($rsvgConvert): ?>
|
||||
<i class="bi bi-check-square text-success"></i>
|
||||
<?php else: ?>
|
||||
<span class="text-danger">
|
||||
<i class="bi bi-exclamation-octagon-fill"></i> (<?php echo _("Package librsvg2-bin required"); ?>)
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-top">pdftk</th>
|
||||
<?php $pdftk = implode(PDFSignature::ispdftkInstalled()); ?>
|
||||
<td class="text-muted"><?php if ($pdftk) { echo substr($pdftk, 0, 24); }; ?></td>
|
||||
<td>
|
||||
<?php if ($pdftk): ?>
|
||||
<i class="bi bi-check-square text-success"></i>
|
||||
<?php else: ?>
|
||||
<span class="text-danger">
|
||||
<i class="bi bi-exclamation-octagon-fill"></i> (<?php echo _("Package pdftk required"); ?>)
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-top">image magick</th>
|
||||
<?php $imageMagick = implode(Image2SVG::isimageMagickInstalled()); ?>
|
||||
<td class="text-muted"><?php if ($imageMagick) { echo substr($imageMagick, 9, 21); }; ?></td>
|
||||
<td>
|
||||
<?php if ($imageMagick): ?>
|
||||
<i class="bi bi-check-square text-success"></i>
|
||||
<?php else: ?>
|
||||
<span class="text-danger">
|
||||
<i class="bi bi-exclamation-octagon-fill"></i> (<?php echo _("Package imagemagick required"); ?>)
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-top">potrace</th>
|
||||
<?php $potrace = implode(Image2SVG::ispotraceInstalled()); ?>
|
||||
<td class="text-muted"><?php if ($potrace) { echo substr($potrace, 0, 12); } ?></td>
|
||||
<td>
|
||||
<?php if ($potrace): ?>
|
||||
<i class="bi bi-check-square text-success"></i>
|
||||
<?php else: ?>
|
||||
<span class="text-danger">
|
||||
<i class="bi bi-exclamation-octagon-fill"></i> (<?php echo _("Package potrace required"); ?>)
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-top">ghostscript</th>
|
||||
<?php $ghostscript = implode(Compression::isgsInstalled()); ?>
|
||||
<td class="text-muted"><?php if ($ghostscript) { echo 'Ghostscript version ' . $ghostscript; } ?></td>
|
||||
<td>
|
||||
<?php if ($ghostscript): ?>
|
||||
<i class="bi bi-check-square text-success"></i>
|
||||
<?php else: ?>
|
||||
<span class="text-danger">
|
||||
<i class="bi bi-exclamation-octagon-fill"></i> (<?php echo _("Package ghostscript required"); ?>)
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-top">gpg</th>
|
||||
<?php $gpg = implode(GPGCryptography::isGpgInstalled()); ?>
|
||||
<td class="text-muted"><?php if ($gpg) { echo substr($gpg, 0, 18); } ?></td>
|
||||
<td>
|
||||
<?php if ($gpg): ?>
|
||||
<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 gpg missing"); ?>)
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</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 endforeach; ?>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,4 +1,9 @@
|
|||
<?php if(!$disableOrganization): ?>
|
||||
<?php if (in_array(@$_SERVER["REMOTE_ADDR"], array_merge($AUTHORIZED_IP, array("127.0.0.1", "::1"))) ): ?>
|
||||
<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>
|
||||
<?php endif; ?>
|
||||
<div class="dropdown position-absolute top-0 end-0 mt-2 me-2">
|
||||
<button class="btn btn-outline-secondary btn-sm dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<span class="d-none d-md-inline"><i class='bi bi-translate'></i> <?php echo _("Language"); ?></span>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue