From 5785614b247f64647d48e2980c2bbec8e2cdbc4b Mon Sep 17 00:00:00 2001 From: Miquel Lionel Date: Tue, 20 Jul 2021 20:39:04 +0100 Subject: fix links stable not having style - also add date when a link was created. It should be easy now to tell when a link was generated. - update the readme about nginx since index.html doesn't exist anymore, gpigeon does the job now - updated the dependencies in the readme --- README.md | 16 ++++++++++------ gpigeon-template.cgi | 20 +++++++++++++------- index.html | 32 -------------------------------- styles.css | 2 ++ 4 files changed, 25 insertions(+), 45 deletions(-) delete mode 100644 index.html diff --git a/README.md b/README.md index 6fd6439..14be24c 100644 --- a/README.md +++ b/README.md @@ -31,14 +31,14 @@ You will need perl and the following modules and my perl version is **v5.34.0**, - CGI - CGI::Carp -- CGI::Cookies +- CGI::Cookie - Crypt::Argon2 - DBI - DBD::SQLite -- Email::Valid -- File::Path (should be already here by default in recent perl installs) -- GPG -- HTML::Entities +- Email::Valid +- Mail::GPG +- MIME::Entity +- File::Path and File::stat (available by default in recent perl installs) - Net:SSLeay - Net::SMTP - Net::SMTPS @@ -86,7 +86,11 @@ server { ssl_certificate_key /etc/letsencrypt/live/ggon.example.com/privkey.pem; error_log /var/log/gpigeon.log; index index.html index.htm; - + + location = / { + return 301 /cgi-bin/gpigeon.cgi; + } + location = /cgi-bin/gpigeon.cgi { ssi off; gzip off; diff --git a/gpigeon-template.cgi b/gpigeon-template.cgi index 2acd59e..0e6b9c0 100755 --- a/gpigeon-template.cgi +++ b/gpigeon-template.cgi @@ -18,14 +18,15 @@ use warnings; use strict; -use Crypt::Argon2 qw(argon2id_verify); -use Email::Valid; -use String::Random; use DBI; +use Email::Valid; use CGI qw(param); use CGI::Cookie; use CGI::Carp qw(fatalsToBrowser); +use Crypt::Argon2 qw(argon2id_verify); use File::Path qw(mkpath rmtree); +use File::stat; +use String::Random; delete @ENV{qw(IFS PATH CDPATH BASH_ENV)}; $ENV{'PATH'} = q{bin_path_goes_here}; @@ -228,6 +229,7 @@ my %text_strings = ( theader_link => 'Link', theader_for => 'For', theader_deletion => 'Deletion', + theader_cdate => 'Created on', username_label => 'Username', web_title => 'GPIGEON.CGI - Main', web_greet_msg => 'Hi and welcome. What will you do today ?', @@ -367,6 +369,8 @@ if($loginok){ while (readdir $link_dir_handle) { if ($_ ne '.' and $_ ne '..'){ my $linkfile_fn = $_; + my $linkstats = stat("./l/$userid/$linkfile_fn"); + my $linkcdate = scalar localtime $linkstats->mtime; my $link_asker = undef; if (open my $linkfile_handle , '<', "./l/$userid/$linkfile_fn"){ for (1..2){ @@ -384,6 +388,7 @@ if($loginok){ qq{ ici $link_asker + $linkcdate
$hidden_loginfield @@ -437,11 +442,12 @@ if($loginok){
$deletion_notif - +
- - - + + + + @created_links
$text_strings{theader_link} 🔗$text_strings{theader_for} 📧$text_strings{theader_deletion} 🗑🔗 $text_strings{theader_link}📧 $text_strings{theader_for} 📅 $text_strings{theader_creationdate}❌ $text_strings{theader_deletion}
diff --git a/index.html b/index.html deleted file mode 100644 index eccc4d2..0000000 --- a/index.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - GPIGEON - Login - - - - - -

GPIGEON - Login

-
- - - - - - - - - - - - - - - -
Username :
Password :
-
- -

Source code here. It is similar to hawkpost.co.

- - diff --git a/styles.css b/styles.css index 50ab8ad..759edb0 100644 --- a/styles.css +++ b/styles.css @@ -19,6 +19,8 @@ h1, #msgbelow{ padding:10px; font-size:110%; margin:0; + border: 3px solid black; + border-bottom:none; } #linkstable td{ -- cgit v1.2.3-54-g00ecf