22ff9a6acaae429d599dfa95daed51e7e7b132fe
commit 22ff9a6acaae429d599dfa95daed51e7e7b132fe
Author: spesk@pm.me <spesk@pm.me>
Date: Thu Jan 20 08:29:08 2022 -0500

Init commit

diff --git a/foobar.cgi b/foobar.cgi
new file mode 100755
index 0000000..1d65a6e
--- /dev/null
+++ b/foobar.cgi
@@ -0,0 +1,118 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my @files = split("\n", `find .`);
+my $last_mod = 0;
+my $f_mod = 0;
+foreach my $file ( @files ) {
+ my $mod_time = `stat $file | grep Modify | awk '{print \$2" "\$3}'`;
+ chomp $mod_time;
+ my $c = $mod_time;
+ $c =~ tr/-\://d;
+ $c =~ tr/ //d;
+ if ( $c > $last_mod ) {
+ $last_mod = $c;
+ $f_mod = $mod_time;
+ }
+}
+
+sub colorize($) {
+ my $string = shift;
+
+ # For "colorizing" the page
+ my @fade_in_c_arr = (
+ 142,143,144,145,146,233,240,244,250,
+ );
+
+ my $fade_len = @fade_in_c_arr;
+
+ my @input_char_arr = split("", $string);
+
+ my @colored_char_ar;
+ foreach my $char ( @input_char_arr ) {
+ if ( $char eq "\n" || $char eq " " || $char eq '\\' || $char eq '/' ) {
+ push(@colored_char_ar,$char);
+ next;
+ }
+ my $c = $fade_in_c_arr[rand @fade_in_c_arr];
+ push(@colored_char_ar, "\x1B[38;5;$c" . "m" . "$char" . "\x1B[0m");
+ }
+
+ my $c_string = join("",@colored_char_ar);
+ return $c_string;
+
+}
+
+sub printer($$$) {
+ my $string = shift;
+ my $type = shift;
+ my $rest = shift;
+ if ( defined $ENV{'QUERY_STRING'} && $ENV{'QUERY_STRING'} eq "plain" ) {
+ print("$type$string$rest\n");
+ } else {
+ my $c_string = colorize($string);
+ print("$type$c_string$rest\n");
+ }
+}
+
+my $HOME_PATH = "/";
+if ( defined $ENV{'QUERY_STRING'} && $ENV{'QUERY_STRING'} eq "plain" ) {
+ $HOME_PATH = "/foobar.cgi?plain";
+}
+
+# GOPHERMAP GEN HERE
+if ( defined $ENV{'QUERY_STRING'} && $ENV{'QUERY_STRING'} eq "plain" ) {
+ print("i CHATE.IO\n");
+} else {
+ print("i ▄████▄ ██░ ██ ▄▄▄ ▄▄▄█████▓▓█████ ██▓ ▒█████\n");
+ print("i▒██▀ ▀█ ▓██░ ██▒▒████▄ ▓ ██▒ ▓▒▓█ ▀ ▓██▒▒██▒ ██▒\n");
+ print("i▒▓█ ▄ ▒██▀▀██░▒██ ▀█▄ ▒ ▓██░ ▒░▒███ ▒██▒▒██░ ██▒\n");
+ print("i▒▓▓▄ ▄██▒░▓█ ░██ ░██▄▄▄▄██░ ▓██▓ ░ ▒▓█ ▄ ░██░▒██ ██░\n");
+ print("i▒ ▓███▀ ░░▓█▒░██▓ ▓█ ▓██▒ ▒██▒ ░ ░▒████▒ ██▓ ░██░░ ████▓▒░\n");
+ print("i░ ░▒ ▒ ░ ▒ ░░▒░▒ ▒▒ ▓▒█░ ▒ ░░ ░░ ▒░ ░ ▒▓▒ ░▓ ░ ▒░▒░▒░\n");
+ print("i ░ ▒ ▒ ░▒░ ░ ▒ ▒▒ ░ ░ ░ ░ ░ ░▒ ▒ ░ ░ ▒ ▒░\n");
+ print("i░ ░ ░░ ░ ░ ▒ ░ ░ ░ ▒ ░░ ░ ░ ▒\n");
+ print("i░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░\n");
+ print("i░ ░\n");
+ print("i\n");
+}
+printer(" _.-^ Thanks for visiting The Chateau ^-._","i","");
+print("i\n");
+printer(" Last Modification: $f_mod UTC","i","");
+print("i\n");
+printer("About Me","0","\tblogs/about-me.org.txt\tchate.io\t70");
+printer("Ramblings and Phlog","1","\tblogs\tchate.io\t70");
+print("i --> All posts are .org mode formatted,\n");
+print("i so elpher users can use M-x org-mode\n");
+print("i for nicer formatting\n");
+print("i\n");
+printer("Warez","1","\t$HOME_PATH\tchate.io\t70");
+print("i --> http://ntfy.sh\n");
+print("i - Awesome and very easy to use PUT/POST\n");
+print("i based notification system\n");
+print("i\n");
+printer("Cool Places","i","");
+printer(" --> baud.baby","1","\t/\tbaud.baby");
+printer(" --> hngopher.com (HN Gopher Proxy)","1","\t/\thngopher.com");
+printer(" --> Linkerror","1","\t/\tgopher.linkerror.com");
+printer(" --> gopher.black","1","\t/\tgopher.black");
+printer(" --> tilde.club","1","\t/\ttilde.club");
+printer(" --> RPoD (1436.ninja)","1","\t/\t1436.ninja");
+printer(" --> gopherpedia (Wikipedia Gopher Proxy)","1","\t/\tgopherpedia.com");
+printer(" --> thelambdalab.xyz","1","\t/\tthelambdalab.xyz");
+print("i\n");
+printer("WhackyCGI","i","");
+print("i\n");
+printer("Script that generates this page","0","\t/foobar.txt\tchate.io\t70\n");
+print("i\n");
+print("1Plain\t/foobar.cgi?plain\tchate.io\t70\n");
+print("1Colorized\t/foobar.cgi\tchate.io\t70\n");
+print("iIf the site looks weird, use the Plain entry above\n");
+print("iThis gopher site expects a client that either supports or\n");
+print("ifilters ANSI escape sequences. I recommend:\n");
+print("i--> cgo\n");
+print("i--> phetch\n");
+print("i--> curl (use gopher://)\n");
+print("i--> Elpher (filters ANSI)\n");
diff --git a/gopher.conf b/gopher.conf
new file mode 100644
index 0000000..8b53b35
--- /dev/null
+++ b/gopher.conf
@@ -0,0 +1,217 @@
+##############################################################
+# #
+# CONFIGURATION FILE FOR THE MOTSOGNIR GOPHER SERVER #
+# #
+# This configuration file controls how the motsognir gopher #
+# server should behave. Every option listed here can be #
+# overloaded through command-line. Example: #
+# $ motsognir --gopherport 7070 #
+# #
+# motsognir can run without a config file at all, provided #
+# that it gets its configuration through command-line #
+# options. To disable the config file lookup, use the #
+# command-line --config parameter with an empty argument: #
+# $ motsognir --config '' --gopherport 7070 etc #
+# #
+##############################################################
+
+
+## Server's hostname ##
+# The hostname the gopher server is reachable at. This setting is highly
+# recommended, because the gopher protocol is heavily relying on self-pointing
+# links. If not declared, the server's IP address will be used instead.
+GopherHostname=chate.io
+
+## Gopher TCP port ##
+# The TCP port on which the public Gopher server listens on.
+# Usually, gopher servers are published on port 70. Default: 70.
+GopherPort=70
+
+## Bind on IP address ##
+# Set this 'bind' parameter to the IP address you'd like Motsognir to listen
+# on. Note, that this parameter must be either an IPv6 address, or an IPv4
+# address written in IPv4-mapped IPv6 notation (for ex. "::FFFF:10.0.0.1").
+# If not specified, Motsognir will listen on all available IP addresses.
+# This setting might be useful if you have a multihomed server, and you would
+# like to serve different content for each IP address.
+# Examples:
+# bind=2001:DB8:135:A0E3::2
+# bind=::FFFF:192.168.0.3
+bind=
+
+## Disable IPv6 support ##
+# Set this to 1 to DISABLE IPv6 support within Motsognir. Please note that
+# when IPv6 is enabled (which is the default), Motsognir may or may not listen
+# to both IPv4 and IPv6 sockets. This is somewhat of a mess, and it is related
+# to how your operating system treats IPv6 sockets. Most sane operating
+# systems support dual-stack sockets. In such environments, Motsognir will
+# open an IPv6 socket and mark it as "not-only-ipv6" (setting IPV6_BINDV6ONLY
+# to false), thus instructing the operating system to accept both IPv4 and
+# IPv6 packets on this socket. Unfortunately, some exotic systems are
+# religiously against dual-stack sockets (as of 2019, I know about at least
+# two such systems: OpenBSD and DragonFlyBSD). On these systems, an IPv6
+# socket is unable to accept IPv4 packets, hence Motsognir ends up receiving
+# exclusively IPv6 traffic. As a workaround for such systems, one should run
+# two instances of Motsognir (one for each protocol). This means two separate
+# configuration files: one with and one without the setting below being set.
+disableipv6=1
+
+## Root directory ##
+# That's the local path to Gopher resources. Note, that if you use a chroot
+# configuration, you must provide here the virtual path instead of the real
+# one.
+# The default path is /var/gopher/
+GopherRoot=/var/www/gopher/root/
+
+## Allowed public directories ##
+# In specific situations, it may happen that you'd like to be able to serve
+# files from outside of your gopher root (typically, if you used symlinks
+# inside your gopher root, that points to other places of the file system).
+# By default Motsognir won't allow such resources to be served, since requests
+# that try to access anything outside of the gopher root are considered as
+# potentially malicious. However, if you do want to serve content from outside
+# your gopher root, then fill in below the list of directories that are
+# allowed to be served. Items of this list should be separated by a ':' char.
+# Example: PubDirList=/srv/files:/var/lib/stuff:/tmp
+PubDirList=
+
+## User home directories ##
+# If you'd like to serve gopher content from user directories, using the
+# classic /~user/ URL scheme, then define the user directories location here
+# below. The configured location must contain a '%s' tag, which will be
+# substituted with the username by motsognir. This must be an absolute path.
+# If nothing is configured, then support for serving content from user
+# directories won't be available. Example:
+# UserDir=/home/%s/public_gopher/
+UserDir=
+
+## chroot configuration ##
+# If you'd like to put Motsognir inside a chroot jail, configure here the
+# chroot directory that shall be used. By default no chroot is used.
+chroot=
+
+## Paranoid mode ##
+# For paranoidal security, you might want to enable "Paranoid mode". In this
+# mode, Motsognir accepts to serve only files with permissions set to "world
+# readable".
+# Possible values: 0 (disabled) or 1 (enabled). Disabled by default.
+ParanoidMode=1
+
+## Plugin ##
+# Power-admins might want to craft some additional logic into Motsognir. This
+# is possible using a 'plugin', ie. a simple application or php script that
+# Motsognir will submit incoming queries to. The plugin can decide whether or
+# not it wants to handle a given query (if not, then Motsognir will process it
+# as usual. The queries that Motsognir will submit to the plugin can be
+# filtered by using a 'PluginFilter'. This is a 'POSIX extended' regular
+# expression that will be compared to every incoming query, and only matching
+# queries are submitted to the plugin. Read more in the manual.
+Plugin=
+PluginFilter=
+
+## Activate the verbose mode ##
+# Here you can enable/disable the verbose mode. In verbose mode, Motsognir
+# will generate much more logs. This is useful only in debug situations.
+# Possible values: 0 (disabled) or 1 (enabled). Disabled by default.
+Verbose=0
+
+## Syslog facility ##
+# Motsognir logs all its messages through the LOG_DAEMON syslog facility by
+# default. In some situations you may want to change the logging facility to
+# a custom one. Setting LogFacility to an integer between 0 and 7 will make
+# motsognir log its messages through the syslog facility LOCAL0-LOCAL7.
+LogFacility=
+
+## CGI support ##
+# The line below enables/disables CGI support. Read the manual for details.
+# Possible values: 0 (disabled) or 1 (enabled). Disabled by default.
+GopherCgiSupport=1
+
+## PHP support ##
+# There you can enable PHP support.
+# Possible values: 0 (disabled) or 1 (enabled). Disabled by default.
+GopherPhpSupport=0
+
+## Sub-gophermap scripts ##
+# If you'd like to use sub-gophermap scripts in your gophermaps, set
+# SubGophermaps.
+# Possible values: 0 (disabled) or 1 (enabled). Disabled by default.
+SubGophermaps=1
+
+## Period-stuffing and period-terminator for text files ##
+# RFC 1436 mandates that text files returned by a gopher server must feature
+# a dot terminator (a single period on a line on its own), and that any dot
+# appearing at the start of a line shall be doubled.
+# Many (most?) gopher clients do not follow these requirements, and fail to
+# process such extra periods. Enabling 'NoTxtPeriod' will prevent motsognir
+# from adding any such periods. Please note that while this may have a
+# practical value, it is a blatant violation of RFC 1436.
+NoTxtPeriod=0
+
+## Secondary URL-delimiting char
+# By default, only the '?' char is recognized as a delimiter between an
+# object and the query that must be run on the object. With this parameter,
+# you can define an additional character that will be equivalent to '?'. This
+# character must be provided in a numerical form, as an ASCII value.
+# Example for the hash (#) character:
+# SecUrlDelim=35
+SecUrlDelim=
+
+## Run as another user ##
+# If you start motsognir under a root account, you might want to configure
+# it so it drops root privileges as soon as it doesn't need them anymore and
+# switches to another user. This is recommended for increased security,
+# unless you already run Motsognir as a non-root user. To do so, provide here
+# the username of the user that Motsognir should run as. Default = no value.
+RunAsUser=www-data
+
+## Default gophermap #
+# If you wish that your server would use a default gophermap when displaying
+# a directory that do not have a gophermap, you can specify here a path to
+# the gophermap file you'd like to use.
+DefaultGophermap=
+
+## HTTP error file
+# When Motsognir receives a HTTP request, it answers with a HTTP error, along
+# with a html message indicating why it is wrong. If you'd like to use a
+# custom html file, you can set it here. Note, that the specified file is
+# loaded when Motsognir's starts. If you modify the file afterwards, you'll
+# need to restart the Motsognir process for the file to be reloaded.
+# Example: HttpErrFile=/etc/motsognir-httperr.html
+HttpErrFile=
+
+## Caps.txt support ##
+# Caps.txt is a specific file-like selector, which allows a gopher client to
+# know more about the server's implementation (for example what the path's
+# delimiter is, where is the server located, etc). When enabled, Motsognir
+# will answer with caps-compatible data to requests for "/caps.txt".
+# Caps support is enabled by default (CapsSupport=1).
+CapsSupport=1
+
+## Caps additionnal informations ##
+# If Caps support is enabled, you can specify there some additional
+# informations about your server. These informations will be served to gopher
+# clients along with the CAPS.TXT data.
+# Example:
+# CapsServerArchitecture=Linux/i386
+# CapsServerDescription=This is my server
+# CapsServerGeolocationString=Dobrogoszcz, Poland
+# CapsServerDefaultEncoding=UTF-8
+CapsServerArchitecture=Linux
+CapsServerDescription=The Chateau
+CapsServerGeolocationString=NYC, USA
+#CapsServerDefaultEncoding=UTF-8
+
+## Extension to filetype mapping ##
+# Motsognir looks at file's extensions to advertise the proper gopher resource
+# type. If the default mapping is not suiting you, you can load a custom
+# mapping using a separate configuration file called an 'extmap', and declare
+# it below. The extmap file is a simple text file, where every line provides
+# a mapping for a single file extension, in such format:
+# txt:0
+# pdf:P
+# gif:g
+# Note: Extensions in the extmap file are processes in a case-insensitive way.
+ExtMapFile=
+
+# [End of file here]