A guestbook with Perl, CGI and email. whooo

This commit is contained in:
Yorhel 2022-03-28 16:08:30 +02:00
parent edb6edb5b6
commit 5e5225a172
8 changed files with 68 additions and 5 deletions

2
.gitignore vendored
View file

@ -69,6 +69,8 @@ pub/globster/ctl.html
pub/globster/daemon.html pub/globster/daemon.html
pub/globster/feed.atom pub/globster/feed.atom
pub/globster/launch.html pub/globster/launch.html
pub/guestbook.html
pub/guestbook/thanks.html
pub/index.html pub/index.html
pub/ncdc.html pub/ncdc.html
pub/ncdc/changes.html pub/ncdc/changes.html

View file

@ -31,6 +31,8 @@ PAGES=\
"dump/grenamr.md"\ "dump/grenamr.md"\
"dump/insbench.md"\ "dump/insbench.md"\
"dump/nccolour.md"\ "dump/nccolour.md"\
"guestbook.md"\
"guestbook/thanks.md"\
"globster.md"\ "globster.md"\
"globster/api.pod https://g.blicky.net/globster.git/plain/doc/api.pod The Globster D-Bus API"\ "globster/api.pod https://g.blicky.net/globster.git/plain/doc/api.pod The Globster D-Bus API"\
"globster/ctl.pod https://g.blicky.net/globster.git/plain/doc/globsterctl.pod The globsterctl(1) Man Page"\ "globster/ctl.pod https://g.blicky.net/globster.git/plain/doc/globsterctl.pod The globsterctl(1) Man Page"\

20
dat/guestbook.md Normal file
View file

@ -0,0 +1,20 @@
% Guestbook
It's 2022 and I figured this little site could use a guestbook. Want to leave a
message? Fill out the form below. Messages are added manually, so it may take a
day or two for yours to show up. Markdown is supported.
This guestbook exists just for sillyness; if you have a question or want to
report feedback for a particular project, better open an issue at the
respective issue tracker or send a mail to
[projects@yorhel.nl](mailto:projects@yorhel.nl) instead.
<form method="POST" action="/cgi-bin/guestbook.cgi">
<input type="text" name="name" placeholder="Your name (optional)">
<textarea name="message" placeholder="Message" required cols=50 rows=5></textarea>
<input type="submit" value="Submit">
</form>
# Entries
The guestbook is empty, be the first to post!

3
dat/guestbook/thanks.md Normal file
View file

@ -0,0 +1,3 @@
% Message submitted!
Thanks for posting to my guestbook! It may take a day or two for your message to show up.

View file

@ -13,15 +13,16 @@ Zig version (stable)
See the [beta release announcement](/doc/ncdu2) for information about the See the [beta release announcement](/doc/ncdu2) for information about the
motivation for the rewrite and some of the differences with the C version. motivation for the rewrite and some of the differences with the C version.
Contrary to popular belief, version 2.x does **not** yet implement parallel
scanning, so don't expect any order-of-magnitude performance
improvements... yet.
Note that the [Zig language](https://ziglang.org/) and compiler are still Note that the [Zig language](https://ziglang.org/) and compiler are still
very much unstable. This version of ncdu will *only* work with the version very much unstable. This version of ncdu will *only* work with the version
of the Zig compiler noted above. Use the ncdu 1.x branch if this does not of the Zig compiler noted above. Use the ncdu 1.x branch if this does not
work for you or if you need a more stable compilation environment. work for you or if you need a more stable compilation environment.
**Linux users/distros** may want to apply [this patch to
Zig](https://github.com/ziglang/zig/pull/11295) to fix a [possible
crash](https://code.blicky.net/yorhel/ncdu/issues/192).
Convenient static binaries for Linux: Convenient static binaries for Linux:
[i486](/download/ncdu-2.1.1-linux-i386.tar.gz), [i486](/download/ncdu-2.1.1-linux-i386.tar.gz),
[x86_64](/download/ncdu-2.1.1-linux-x86_64.tar.gz), [x86_64](/download/ncdu-2.1.1-linux-x86_64.tar.gz),

32
pub/cgi-bin/guestbook.cgi Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/perl
use v5.26;
use CGI::Minimal;
die if !$ENV{CONTENT_LENGTH};
CGI::Minimal::max_read_size(128*1024);
my $cgi = CGI::Minimal->new;
die if $cgi->truncated;
open my $S, '|-', qw'/usr/sbin/sendmail -t -f dev@yorhel.nl' or die $!;
printf $S <<'_', $cgi->param('name'), $cgi->param('message');
To: dev@yorhel.nl
From: dev@yorhel.nl
Subject: Guestbook post
Content-Type: text/plain; charset='UTF-8'
Name: %s
Message:
%s
_
close $S or die;
print <<'_';
Status: 303
Content-Type: text/plain
Location: https://dev.yorhel.nl/guestbook/thanks
Redirecting...
_

View file

@ -54,7 +54,7 @@ main h3 { font-size: 120%; color: #000; margin: 1em 0 .3em 0; text-decoration: n
main code { font-family: monospace } main code { font-family: monospace }
main pre { font-family: monospace; font-size: 80%; margin: 0 0 10px 18px; display: block; padding: 0 0 0 15px; border-left: 1px dotted #999; overflow-x: auto } main pre { font-family: monospace; font-size: 80%; margin: 0 0 10px 18px; display: block; padding: 0 0 0 15px; border-left: 1px dotted #999; overflow-x: auto }
main pre * { font-size: inherit; font-family: inherit } main pre * { font-size: inherit; font-family: inherit }
main p, main figure, main ul, main ol, main dl, main pre, main figure, main table { margin-bottom: 0.7em; margin-left: 1em } main p, main figure, main ul, main ol, main dl, main pre, main figure, main table, main form { margin-bottom: 0.7em; margin-left: 1em }
main ul ul { margin-bottom: 0.5em } main ul ul { margin-bottom: 0.5em }
main ul, main ol { margin-left: 2.5em } main ul, main ol { margin-left: 2.5em }
main li { margin-bottom: .1em } main li { margin-bottom: .1em }
@ -66,6 +66,8 @@ main figcaption { display: none }
main table th, main table td { font-size: 12.8px; padding: 1px 7px } main table th, main table td { font-size: 12.8px; padding: 1px 7px }
main td em { font-style: normal; text-decoration: underline } main td em { font-style: normal; text-decoration: underline }
main table th { font-weight: bold } main table th { font-weight: bold }
main textarea { width: 95% }
main input[type="submit"] { padding: 1px 5px }
main section.footnotes hr { display: none } main section.footnotes hr { display: none }
main section.footnotes { margin: 40px 10px 10px 10px } main section.footnotes { margin: 40px 10px 10px 10px }

View file

@ -127,7 +127,8 @@
</ul> </ul>
$endif$ $endif$
<ul> <ul>
<li><a href="/contributing.html" class="small item1-contributing">Contributing</a></li> <li><a href="/contributing" class="small item1-contributing">Contributing</a></li>
<li><a href="/guestbook" class="small item1-guestbook">Guestbook</a></li>
</ul> </ul>
</nav> </nav>