From 68be39ed233fe686935792098f1c6375bc621586 Mon Sep 17 00:00:00 2001 From: Vincent LAURENT Date: Sat, 18 Mar 2023 00:24:29 +0100 Subject: [PATCH] feat: Added option to remove or edit demo pdf link --- Dockerfile | 1 + README.md | 1 + app.php | 4 ++++ config/config.ini.example | 2 ++ config/config.ini.tpl | 1 + templates/organization.html.php | 4 +++- templates/signature.html.php | 4 +++- 7 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6644508..d126284 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ ENV POST_MAX_SIZE=24M ENV MAX_FILE_UPLOADS=201 ENV PDF_STORAGE_PATH= ENV DISABLE_ORGANIZATION=false +ENV PDF_DEMO_LINK=true RUN apt update && \ apt install -y gettext-base librsvg2-bin pdftk imagemagick potrace && \ diff --git a/README.md b/README.md index a4eb5d9..8182be4 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ Les variables suivantes permettent de configurer le déployement : |`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| ```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 diff --git a/app.php b/app.php index 2e9f7f9..454ea71 100644 --- a/app.php +++ b/app.php @@ -16,6 +16,10 @@ 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) { + $f3->set('PDF_DEMO_LINK', 'https://raw.githubusercontent.com/24eme/signaturepdf/master/tests/files/document.pdf'); +} + $f3->set('disableOrganization', false); if($f3->get('DISABLE_ORGANIZATION')) { $f3->set('disableOrganization', $f3->get('DISABLE_ORGANIZATION')); diff --git a/config/config.ini.example b/config/config.ini.example index 0058a92..5a4000e 100644 --- a/config/config.ini.example +++ b/config/config.ini.example @@ -4,3 +4,5 @@ # To deactivate this mode, simply do not configure it or leave it empty PDF_STORAGE_PATH=/path/to/folder DISABLE_ORGANIZATION=false +; Manage demo link pdf : true (by default, show), false (hide), or custom link +;PDF_DEMO_LINK=true diff --git a/config/config.ini.tpl b/config/config.ini.tpl index 158ca36..895608f 100644 --- a/config/config.ini.tpl +++ b/config/config.ini.tpl @@ -4,3 +4,4 @@ # To deactivate this mode, simply do not configure it or leave it empty PDF_STORAGE_PATH=${PDF_STORAGE_PATH} DISABLE_ORGANIZATION=${DISABLE_ORGANIZATION} +PDF_DEMO_LINK=${PDF_DEMO_LINK} diff --git a/templates/organization.html.php b/templates/organization.html.php index fd9856f..e940a2c 100644 --- a/templates/organization.html.php +++ b/templates/organization.html.php @@ -35,7 +35,9 @@

Le PDF sera traité par le serveur sans être conservé ni stocké

- Tester avec un PDF de démo + + Tester avec un PDF de démo + diff --git a/templates/signature.html.php b/templates/signature.html.php index 0107509..d49e967 100644 --- a/templates/signature.html.php +++ b/templates/signature.html.php @@ -35,7 +35,9 @@

Le PDF sera traité par le serveur sans être conservé ni stocké

- Tester avec un PDF de démo + + Tester avec un PDF de démo +