Compare commits
9 Commits
96b21fb850
...
fee27a0311
Author | SHA1 | Date |
---|---|---|
Vincent LAURENT | fee27a0311 | |
Étienne Deparis | a1509a554f | |
Vincent LAURENT | 30e7ffef89 | |
Vincent LAURENT | ada82de930 | |
Vincent LAURENT | 4646ad35a7 | |
Vincent LAURENT | c19f1af646 | |
Vincent LAURENT | d6b6b43ac2 | |
xgaia | 7d4ae2907f | |
xgaia | c119d8d1cd |
|
@ -4,7 +4,7 @@ ENV SERVERNAME=localhost
|
|||
ENV UPLOAD_MAX_FILESIZE=24M
|
||||
ENV POST_MAX_SIZE=24M
|
||||
ENV MAX_FILE_UPLOADS=201
|
||||
ENV PDF_STORAGE_PATH=
|
||||
ENV PDF_STORAGE_PATH=/data
|
||||
ENV DISABLE_ORGANIZATION=false
|
||||
ENV PDF_DEMO_LINK=true
|
||||
|
||||
|
@ -14,15 +14,11 @@ RUN apt update && \
|
|||
|
||||
COPY . /usr/local/signaturepdf
|
||||
|
||||
RUN chown -R www-data:www-data /usr/local/signaturepdf && chmod 750 -R /usr/local/signaturepdf && \
|
||||
chmod 775 -R /usr/local/signaturepdf/entrypoint.sh && \
|
||||
envsubst < /usr/local/signaturepdf/config/php.ini > /usr/local/etc/php/conf.d/uploads.ini && \
|
||||
RUN envsubst < /usr/local/signaturepdf/config/php.ini > /usr/local/etc/php/conf.d/uploads.ini && \
|
||||
envsubst < /usr/local/signaturepdf/config/apache.conf > /etc/apache2/sites-available/signaturepdf.conf && \
|
||||
envsubst < /usr/local/signaturepdf/config/config.ini.tpl > /usr/local/signaturepdf/config/config.ini && \
|
||||
a2enmod rewrite && a2ensite signaturepdf
|
||||
|
||||
WORKDIR /usr/local/signaturepdf
|
||||
|
||||
USER www-data
|
||||
|
||||
CMD /usr/local/signaturepdf/entrypoint.sh
|
||||
|
|
41
README.md
41
README.md
|
@ -11,7 +11,7 @@ Liste des instances permettant d'utiliser ce logiciel :
|
|||
- [pdf.hostux.net](https://pdf.hostux.net)
|
||||
- [pdf.nebulae.co](https://pdf.nebulae.co)
|
||||
|
||||
*N'hésitez pas à rajouter la votre via une issue ou une pull request*
|
||||
_N'hésitez pas à rajouter la votre via une issue ou une pull request_
|
||||
|
||||
## License
|
||||
|
||||
|
@ -23,7 +23,7 @@ Logiciel libre sous license AGPL V3
|
|||
|
||||
Dépendances :
|
||||
|
||||
- php >= 5.6
|
||||
- php >= 5.6
|
||||
- rsvg-convert
|
||||
- pdftk
|
||||
- imagemagick
|
||||
|
@ -75,13 +75,13 @@ DocumentRoot /path/to/signaturepdf/public
|
|||
|
||||
```bash
|
||||
docker build -t signaturepdf .
|
||||
````
|
||||
```
|
||||
|
||||
#### Lancement d'un conteneur
|
||||
|
||||
```bash
|
||||
docker run -d --name=signaturepdf -p 8080:80 signaturepdf
|
||||
````
|
||||
```
|
||||
|
||||
[localhost:8080](http://localhost:8080)
|
||||
|
||||
|
@ -89,15 +89,15 @@ docker run -d --name=signaturepdf -p 8080:80 signaturepdf
|
|||
|
||||
Les variables suivantes permettent de configurer le déployement :
|
||||
|
||||
|Variable|description|exemple|defaut|
|
||||
|-----|-----|-----|-----|
|
||||
|`SERVERNAME`|url de déploiement|`pdf.24eme.fr`|localhost|
|
||||
|`UPLOAD_MAX_FILESIZE`|Taille maximum du fichier PDF à signer|48M|24M|
|
||||
|`POST_MAX_SIZE`|Taille maximum du fichier PDF à signer|48M|24M|
|
||||
|`MAX_FILE_UPLOADS`|Nombre de pages maximum du PDF, ici 200 pages + le PDF d'origine|401|201|
|
||||
|`PDF_STORAGE_PATH`|chemin vers lequel les fichiers pdf uploadés pourront être stockés|/data||
|
||||
|`DISABLE_ORGANIZATION`|Desactiver la route Organiser|true|false|
|
||||
|`PDF_DEMO_LINK`|Afficher, retirer ou changer le lien de PDF de démo|false, `link` or `relative path`|true|
|
||||
| Variable | description | exemple | defaut |
|
||||
| ---------------------- | ------------------------------------------------------------------ | -------------------------------- | --------- |
|
||||
| `SERVERNAME` | url de déploiement | `pdf.24eme.fr` | localhost |
|
||||
| `UPLOAD_MAX_FILESIZE` | Taille maximum du fichier PDF à signer | 48M | 24M |
|
||||
| `POST_MAX_SIZE` | Taille maximum du fichier PDF à signer | 48M | 24M |
|
||||
| `MAX_FILE_UPLOADS` | Nombre de pages maximum du PDF, ici 200 pages + le PDF d'origine | 401 | 201 |
|
||||
| `PDF_STORAGE_PATH` | chemin vers lequel les fichiers pdf uploadés pourront être stockés | /data | /data |
|
||||
| `DISABLE_ORGANIZATION` | Desactiver la route Organiser | true | false |
|
||||
| `PDF_DEMO_LINK` | Afficher, retirer ou changer le lien de PDF de démo | false, `link` or `relative path` | true |
|
||||
|
||||
```bash
|
||||
docker run -d --name=signaturepdf -p 8080:80 -e SERVERNAME=pdf.example.org -e UPLOAD_MAX_FILESIZE=48M -e POST_MAX_SIZE=48M -e MAX_FILE_UPLOADS=401 -e PDF_STORAGE_PATH=/data signaturepdf
|
||||
|
@ -109,6 +109,7 @@ Voici un script permettant d'installer la solution sous Linux Alpine (testé en
|
|||
Pensez à éditer la variable "domain" en début de script pour correspondre à l'URL avec laquelle elle sera appelée.
|
||||
|
||||
Les composants principaux sont :
|
||||
|
||||
- php 8 + php-fpm
|
||||
- Nginx
|
||||
- pdftk (installation "manuelle" nécessitant openjdk8)
|
||||
|
@ -117,6 +118,7 @@ Les composants principaux sont :
|
|||
- librsvg
|
||||
|
||||
Ce que fait le script :
|
||||
|
||||
- Installation des dépendances
|
||||
- Configuration de php et php-fpm
|
||||
- Configuration d'Nginx
|
||||
|
@ -128,7 +130,7 @@ Ce que fait le script :
|
|||
|
||||
domain='sign.example.com'
|
||||
|
||||
apk update
|
||||
apk update
|
||||
apk add bash nginx git php8 php8-fpm php8-session php8-gd php8-fileinfo openjdk8 imagemagick potrace librsvg
|
||||
|
||||
cd /tmp
|
||||
|
@ -164,7 +166,7 @@ server {
|
|||
server_name ${domain};
|
||||
|
||||
client_max_body_size 0;
|
||||
|
||||
|
||||
root /var/www/signaturepdf/public/;
|
||||
|
||||
index index.php index.html;
|
||||
|
@ -185,7 +187,7 @@ server {
|
|||
fastcgi_buffers 128 128k;
|
||||
fastcgi_param PATH_INFO \$fastcgi_path_info;
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
|
||||
}
|
||||
|
||||
|
@ -223,11 +225,13 @@ cp config/config.ini{.example,}
|
|||
```
|
||||
|
||||
Dans ce fichier `config/config.ini`, il suffit ce configurer la variable `PDF_STORAGE_PATH` avec le chemin vers lequel les fichiers pdf uploadés pourront être stockés :
|
||||
|
||||
```
|
||||
PDF_STORAGE_PATH=/path/to/folder
|
||||
```
|
||||
|
||||
Créer ce dossier :
|
||||
|
||||
```
|
||||
mkdir /path/to/folder
|
||||
```
|
||||
|
@ -235,6 +239,7 @@ mkdir /path/to/folder
|
|||
Le serveur web devra avoir les droits en écriture sur ce dossier.
|
||||
|
||||
Par exemple pour apache :
|
||||
|
||||
```
|
||||
chown www-data /path/to/folder/to/store/pdf
|
||||
```
|
||||
|
@ -296,6 +301,7 @@ DEBUG=1 make test
|
|||
- **OpenType.js** outils de transformation d'un texte et sa police en chemin : https://github.com/opentypejs/opentype.js (MIT)
|
||||
- **ImageMagick** ensemble d'outils de manipulation d'images : https://imagemagick.org/ (Apache-2.0)
|
||||
- **Caveat** police de caractères style écriture à la main : https://github.com/googlefonts/caveat (OFL-1.1)
|
||||
- **PDF-LIB** librairie js permettant de manipuler un PDF qui est utilisé pour écrire dans les métadonnées : https://pdf-lib.js.org/ (MIT)
|
||||
|
||||
Pour les tests :
|
||||
|
||||
|
@ -313,6 +319,3 @@ Pour les tests :
|
|||
Logilab a apporté une contribution financière de 1 365 € TTC à la société 24ème pour développer le mode multi signature.
|
||||
|
||||
Le développement du logiciel a principalement été réalisé sur le temps de travail de salariés du 24ème.
|
||||
|
||||
|
||||
|
||||
|
|
2
app.php
2
app.php
|
@ -16,7 +16,7 @@ if($f3->get('PDF_STORAGE_PATH') && !preg_match('|/$|', $f3->get('PDF_STORAGE_PAT
|
|||
$f3->set('PDF_STORAGE_PATH', $f3->get('PDF_STORAGE_PATH').'/');
|
||||
}
|
||||
|
||||
if(!$f3->get('PDF_DEMO_LINK') && $f3->get('PDF_DEMO_LINK') !== false) {
|
||||
if($f3->get('PDF_DEMO_LINK') === null || $f3->get('PDF_DEMO_LINK') === true) {
|
||||
$f3->set('PDF_DEMO_LINK', 'https://raw.githubusercontent.com/24eme/signaturepdf/master/tests/files/document.pdf');
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ PDF_STORAGE_PATH=/path/to/folder
|
|||
; Disable organization tab and routes
|
||||
;DISABLE_ORGANIZATION=false
|
||||
|
||||
; Manage demo link pdf : true (by default, show), false (hide), or custom link
|
||||
; Manage demo link pdf : true (by default, show with default link), false (hide), or custom link
|
||||
;PDF_DEMO_LINK=true
|
||||
|
||||
; Metadata default fields
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
#! /bin/bash
|
||||
|
||||
envsubst < /usr/local/signaturepdf/config/apache.conf > /etc/apache2/sites-available/signaturepdf.conf
|
||||
|
||||
envsubst < /usr/local/signaturepdf/config/php.ini > /usr/local/etc/php/conf.d/uploads.ini
|
||||
|
||||
envsubst < /usr/local/signaturepdf/config/config.ini.tpl > /usr/local/signaturepdf/config/config.ini
|
||||
|
||||
chown -R www-data:www-data /usr/local/signaturepdf && chmod 750 -R /usr/local/signaturepdf
|
||||
|
||||
if [[ ! -z $PDF_STORAGE_PATH ]] ; then
|
||||
mkdir -p $PDF_STORAGE_PATH
|
||||
chown -R www-data:www-data $PDF_STORAGE_PATH
|
||||
chmod 750 -R $PDF_STORAGE_PATH
|
||||
fi
|
||||
|
||||
apache2-foreground
|
||||
|
|
|
@ -246,7 +246,14 @@ var pageUpload = async function() {
|
|||
document.getElementById('page-upload').classList.remove('d-none');
|
||||
document.getElementById('page-metadata').classList.add('d-none');
|
||||
document.getElementById('input_pdf_upload').focus();
|
||||
const cache = await caches.open('pdf');
|
||||
let cache;
|
||||
try {
|
||||
cache = await caches.open('pdf');
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
alert("Erreur d'accès au cache. Cette application ne fonctionne pas en mode de navigation privée");
|
||||
return;
|
||||
}
|
||||
document.getElementById('input_pdf_upload').addEventListener('change', async function(event) {
|
||||
let filename = document.getElementById('input_pdf_upload').files[0].name;
|
||||
let response = new Response(document.getElementById('input_pdf_upload').files[0], { "status" : 200, "statusText" : "OK" });
|
||||
|
|
|
@ -740,7 +740,14 @@ var pageUpload = async function() {
|
|||
document.getElementById('page-upload').classList.remove('d-none');
|
||||
document.getElementById('page-organization').classList.add('d-none');
|
||||
document.getElementById('input_pdf_upload').focus();
|
||||
const cache = await caches.open('pdf');
|
||||
let cache;
|
||||
try {
|
||||
cache = await caches.open('pdf');
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
alert("Erreur d'accès au cache. Cette application ne fonctionne pas en mode de navigation privée");
|
||||
return;
|
||||
}
|
||||
document.getElementById('input_pdf_upload').addEventListener('change', async function(event) {
|
||||
if(document.getElementById('input_pdf_upload').files[0].size > maxSize) {
|
||||
|
||||
|
|
|
@ -996,7 +996,14 @@ var pageUpload = async function() {
|
|||
document.getElementById('page-upload').classList.remove('d-none');
|
||||
document.getElementById('page-signature').classList.add('d-none');
|
||||
document.getElementById('input_pdf_upload').focus();
|
||||
const cache = await caches.open('pdf');
|
||||
let cache;
|
||||
try {
|
||||
cache = await caches.open('pdf');
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
alert("Erreur d'accès au cache. Cette application ne fonctionne pas en mode de navigation privée");
|
||||
return;
|
||||
}
|
||||
document.getElementById('input_pdf_upload').addEventListener('change', async function(event) {
|
||||
if(document.getElementById('input_pdf_upload').files[0].size > maxSize) {
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<p class="fw-light mb-3 subtitle text-dark text-nowrap" style="overflow: hidden; text-overflow: ellipsis;">Ajouter, modifier ou supprimer les métadonnées d'un PDF</p>
|
||||
<div class="col-md-6 col-lg-5 col-xl-4 col-xxl-3 mx-auto">
|
||||
<div class="col-12">
|
||||
<label class="form-label mt-3" for="input_pdf_upload">Choisir un PDF <small class="opacity-75" style="cursor: help" title="Le PDF ne doit pas dépasser <?php echo round($maxSize / 1024 / 1024) ?> Mo"><i class="bi bi-info-circle"></i></small></label>
|
||||
<label class="form-label mt-3" for="input_pdf_upload">Choisir un PDF</label>
|
||||
<input id="input_pdf_upload" placeholder="Choisir un PDF" class="form-control form-control-lg" type="file" accept=".pdf,application/pdf" />
|
||||
<p class="mt-2 small fw-light text-dark"> </p>
|
||||
<?php if($PDF_DEMO_LINK): ?>
|
||||
|
@ -102,6 +102,6 @@
|
|||
<script>
|
||||
var defaultFields = <?php echo json_encode(isset($METADATA_DEFAULT_FIELDS) ? $METADATA_DEFAULT_FIELDS : array()); ?>;
|
||||
</script>
|
||||
<script src="/js/metadata.js?202304201611"></script>
|
||||
<script src="/js/metadata.js?202304030148"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -157,6 +157,6 @@
|
|||
<script>
|
||||
var maxSize = <?php echo $maxSize ?>;
|
||||
</script>
|
||||
<script src="/js/organization.js?202212070154"></script>
|
||||
<script src="/js/organization.js?202304030148"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -265,6 +265,6 @@
|
|||
hash = "<?php echo $hash ?>";
|
||||
<?php endif; ?>
|
||||
</script>
|
||||
<script src="/js/signature.js?202204270035"></script>
|
||||
<script src="/js/signature.js?202304030148"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue