diff options
-rw-r--r-- | README.md | 16 | ||||
-rwxr-xr-x | gpigeon-template.cgi | 20 | ||||
-rw-r--r-- | index.html | 32 | ||||
-rw-r--r-- | styles.css | 2 |
4 files changed, 25 insertions, 45 deletions
@@ -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{<tr> <td><a href="/cgi-bin/l/$userid/$linkfile_fn" target="_blank" rel="noopener noreferrer nofollow">ici</a></td> <td><a href="mailto:$link_asker?subject=$text_strings{mailto_subject}&body=$text_strings{mailto_body} http://$hostname/cgi-bin/l/$userid/$linkfile_fn">$link_asker</a></td> + <td>$linkcdate</td> <td> <form method="POST"> $hidden_loginfield @@ -437,11 +442,12 @@ if($loginok){ <input id="deleteallbtn" type="submit" value="$text_strings{delete_links_btn_text}"> </form> $deletion_notif - <table> + <table id="linkstable"> <tr> - <th>$text_strings{theader_link} 🔗</th> - <th>$text_strings{theader_for} 📧</th> - <th>$text_strings{theader_deletion} 🗑</th> + <th>🔗 $text_strings{theader_link}</th> + <th>📧 $text_strings{theader_for} </th> + <th>📅 $text_strings{theader_creationdate}</th> + <th>❌ $text_strings{theader_deletion}</th> </tr> @created_links </table> diff --git a/index.html b/index.html deleted file mode 100644 index eccc4d2..0000000 --- a/index.html +++ /dev/null @@ -1,32 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <title>GPIGEON - Login</title> - <meta charset="utf-8"> - <link rel="icon" type="image/x-icon" href="/favicon.ico"> - <link rel="stylesheet" type="text/css" href="styles.css"> - </head> - <body> - <h1>GPIGEON - Login</h1> - <form action="/cgi-bin/gpigeon.cgi" method="POST"> - <table id="loginbox"> - <tbody> - <tr> - <td>Username :</td> - <td><input type="text" name="username"></td> - </tr> - <tr> - <td>Password :</td> - <td><input type="password" name="password"></td> - </tr> - <tr id="authbtn"> - <td></td> - <td><input type="submit" value="S'authentifier"></td> - </tr> - </tbody> - </table> - </form> - - <p><a href="http://git.les-miquelots.net/gpigeon" title="gpigeon download link">Source code here.</a> It is similar to <a href="https://hawkpost.co/">hawkpost.co</a>.</p> - </body> -</html> @@ -19,6 +19,8 @@ h1, #msgbelow{ padding:10px; font-size:110%; margin:0; + border: 3px solid black; + border-bottom:none; } #linkstable td{ |