aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Lionel <lionel@les-miquelots.net>2021-07-20 20:39:04 +0100
committerMiquel Lionel <lionelmiquel@sfr.fr>2021-07-20 20:42:20 +0100
commit5785614b247f64647d48e2980c2bbec8e2cdbc4b (patch)
tree185461f512b0a0061fed7b5fdfeb1cc05fbbdaa7
parent3cbe6fe46483ca5c4483bc2d39c4c568fda9a187 (diff)
downloadgpigeon-5785614b247f64647d48e2980c2bbec8e2cdbc4b.tar.gz
gpigeon-5785614b247f64647d48e2980c2bbec8e2cdbc4b.zip
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
-rw-r--r--README.md16
-rwxr-xr-xgpigeon-template.cgi20
-rw-r--r--index.html32
-rw-r--r--styles.css2
4 files changed, 25 insertions, 45 deletions
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{<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} &#128279;</th>
- <th>$text_strings{theader_for} &#128231;</th>
- <th>$text_strings{theader_deletion} &#128465;</th>
+ <th>&#x1f517; $text_strings{theader_link}</th>
+ <th>&#x1f4e7; $text_strings{theader_for} </th>
+ <th>&#x1f4c5; $text_strings{theader_creationdate}</th>
+ <th>&#10060; $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>
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{