aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Lionel <lionel@les-miquelots.net>2021-07-20 20:25:10 +0100
committerMiquel Lionel <lionelmiquel@sfr.fr>2021-07-20 20:26:29 +0100
commita3d9855538e97901b8d70140e985d1ac530fbf29 (patch)
tree1be9968619d44ee0a3ae98bcdd1704626454b064
parent1208e3e3ffb1cc263d879f996b22e18c8b024d33 (diff)
downloadgpigeon-a3d9855538e97901b8d70140e985d1ac530fbf29.tar.gz
gpigeon-a3d9855538e97901b8d70140e985d1ac530fbf29.zip
fix Makefile and gpg key export during it.
- esthetic improvments too, in particular the links table: Added the correct id on the linkstable, the styles from css weren't applied. - some variables were used but not declared beforehand in the cookie check function in gpigeon-template.cgi. we fix that
-rw-r--r--README.md4
-rwxr-xr-xgpigeon-template.cgi18
-rw-r--r--nginx-example.conf4
-rw-r--r--styles.css2
4 files changed, 22 insertions, 6 deletions
diff --git a/README.md b/README.md
index 8ed4cea..bdd47ad 100644
--- a/README.md
+++ b/README.md
@@ -79,6 +79,10 @@ server {
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 9eb82d5..dda7d62 100755
--- a/gpigeon-template.cgi
+++ b/gpigeon-template.cgi
@@ -19,9 +19,10 @@
use warnings;
use strict;
use File::Path qw(mkpath rmtree);
-use Crypt::Argon2 qw(argon2id_verify);
+use File::stat;
use Email::Valid;
use String::Random;
+use Crypt::Argon2 qw(argon2id_verify);
use CGI qw(param);
use CGI::Cookie;
use CGI::Carp qw(fatalsToBrowser);
@@ -148,6 +149,7 @@ my %text_strings = (
theader_link => 'Link',
theader_for => 'For',
theader_deletion => 'Deletion',
+ theader_cdate => 'Created on',
web_greet_msg => 'Hi and welcome.',
);
my $cgi_query_get = CGI->new;
@@ -245,6 +247,8 @@ if (ValidCookie($id_cookie, $cookies_dir) or argon2id_verify($argon2id_hash,$pw)
while (readdir $link_dir_handle) {
if ($_ ne '.' and $_ ne '..'){
my $linkfile_fn = $_;
+ my $linkstats = stat("./l/$linkfile_fn");
+ my $linkcdate = scalar localtime $linkstats->mtime;
if (open my $linkfile_handle , '<', "./l/$linkfile_fn"){
for (1..2){
$link_asker = readline $linkfile_handle;
@@ -258,6 +262,7 @@ if (ValidCookie($id_cookie, $cookies_dir) or argon2id_verify($argon2id_hash,$pw)
qq{<tr>
<td><a target="_blank" rel="noopener noreferrer nofollow" href="/cgi-bin/l/$linkfile_fn">$text_strings{here}</a></td>
<td><a href="mailto:$link_asker?subject=$text_strings{mailto_subject}&body=$text_strings{mailto_body} http://$hostname/cgi-bin/l/$linkfile_fn">$link_asker</a></td>
+ <td>$linkcdate</td>
<td>
<form method="POST">
$hidden_pwfield
@@ -312,11 +317,12 @@ if (ValidCookie($id_cookie, $cookies_dir) or argon2id_verify($argon2id_hash,$pw)
<input id="deleteallbtn" type="submit" value="$text_strings{delete_links_btn_text}">
</form>
$deletion_notif
- <table>
+ <tablei 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_cdate}</th>
+ <th>&#10060; $text_strings{theader_deletion}</th>
</tr>
@created_links
</table>
@@ -364,7 +370,7 @@ qq{<!DOCTYPE html>
</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>
+ title="gpigeon download link">Source code here.</a> It is similar to <a target="_blank" rel="noopener nofollow noreferrer" href="https://hawkpost.co/">hawkpost.co</a>.</p>
</body>
</html>};
diff --git a/nginx-example.conf b/nginx-example.conf
index 9f7d355..c4b1a83 100644
--- a/nginx-example.conf
+++ b/nginx-example.conf
@@ -17,6 +17,10 @@ server {
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/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{