1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 my @files = split("\n", `find .`);
7 my $last_mod = 0;
8 my $f_mod = 0;
9 foreach my $file ( @files ) {
10 my $mod_time = `stat $file | grep Modify | awk '{print \$2" "\$3}'`;
11 chomp $mod_time;
12 my $c = $mod_time;
13 $c =~ tr/-\://d;
14 $c =~ tr/ //d;
15 if ( $c > $last_mod ) {
16 $last_mod = $c;
17 $f_mod = $mod_time;
18 }
19 }
20
21 sub colorize($) {
22 my $string = shift;
23
24 # For "colorizing" the page
25 my @fade_in_c_arr = (
26 142,143,144,145,146,233,240,244,250,
27 );
28
29 my $fade_len = @fade_in_c_arr;
30
31 my @input_char_arr = split("", $string);
32
33 my @colored_char_ar;
34 foreach my $char ( @input_char_arr ) {
35 if ( $char eq "\n" || $char eq " " || $char eq '\\' || $char eq '/' ) {
36 push(@colored_char_ar,$char);
37 next;
38 }
39 my $c = $fade_in_c_arr[rand @fade_in_c_arr];
40 push(@colored_char_ar, "\x1B[38;5;$c" . "m" . "$char" . "\x1B[0m");
41 }
42
43 my $c_string = join("",@colored_char_ar);
44 return $c_string;
45
46 }
47
48 sub printer($$$) {
49 my $string = shift;
50 my $type = shift;
51 my $rest = shift;
52 if ( defined $ENV{'QUERY_STRING'} && $ENV{'QUERY_STRING'} eq "plain" ) {
53 print("$type$string$rest\n");
54 } else {
55 my $c_string = colorize($string);
56 print("$type$c_string$rest\n");
57 }
58 }
59
60 my $HOME_PATH = "/";
61 if ( defined $ENV{'QUERY_STRING'} && $ENV{'QUERY_STRING'} eq "plain" ) {
62 $HOME_PATH = "/foobar.cgi?plain";
63 }
64
65 # GOPHERMAP GEN HERE
66 if ( defined $ENV{'QUERY_STRING'} && $ENV{'QUERY_STRING'} eq "plain" ) {
67 print("i CHATE.IO\tchate.io\t70\n");
68 } else {
69 print("i ▄████▄ ██░ ██ ▄▄▄ ▄▄▄█████▓▓█████ ██▓ ▒█████\tchate.io\t70\n");
70 print("i▒██▀ ▀█ ▓██░ ██▒▒████▄ ▓ ██▒ ▓▒▓█ ▀ ▓██▒▒██▒ ██▒\tchate.io\t70\n");
71 print("i▒▓█ ▄ ▒██▀▀██░▒██ ▀█▄ ▒ ▓██░ ▒░▒███ ▒██▒▒██░ ██▒\tchate.io\t70\n");
72 print("i▒▓▓▄ ▄██▒░▓█ ░██ ░██▄▄▄▄██░ ▓██▓ ░ ▒▓█ ▄ ░██░▒██ ██░\tchate.io\t70\n");
73 print("i▒ ▓███▀ ░░▓█▒░██▓ ▓█ ▓██▒ ▒██▒ ░ ░▒████▒ ██▓ ░██░░ ████▓▒░\tchate.io\t70\n");
74 print("i░ ░▒ ▒ ░ ▒ ░░▒░▒ ▒▒ ▓▒█░ ▒ ░░ ░░ ▒░ ░ ▒▓▒ ░▓ ░ ▒░▒░▒░\tchate.io\t70\n");
75 print("i ░ ▒ ▒ ░▒░ ░ ▒ ▒▒ ░ ░ ░ ░ ░ ░▒ ▒ ░ ░ ▒ ▒░\tchate.io\t70\n");
76 print("i░ ░ ░░ ░ ░ ▒ ░ ░ ░ ▒ ░░ ░ ░ ▒\tchate.io\t70\n");
77 print("i░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░\tchate.io\t70\n");
78 print("i░ ░\tchate.io\t70\n");
79 print("i\tchate.io\t70\n");
80 }
81 printer(" _.-^ Thanks for visiting The Chateau ^-._","i","\tchate.io\t70");
82 print("i\tchate.io\t70\n");
83 printer(" Last Modification: $f_mod UTC","i","\tchate.io\t70");
84 my $uniq_ips = `cat ./existing_ips | wc -l`;
85 chomp $uniq_ips;
86 printer(" Uniq Visitors since Jan 2022 : $uniq_ips","i","\tchate.io\t70");
87 print("i\tchate.io\t70\n");
88 printer("About Me","0","\tblogs/about-me.org.txt\tchate.io\t70");
89 printer("Ramblings and Phlog","1","\t/blogs/blogs.cgi\tchate.io\t70");
90 print("i --> All posts are .org mode formatted,\tchate.io\t70\n");
91 print("i so elpher users can use M-x org-mode\tchate.io\t70\n");
92 print("i for nicer formatting\tchate.io\t70\n");
93 print("i\tchate.io\t70\n");
94 printer("Warez","1","\t$HOME_PATH\tchate.io\t70");
95 print("i --> http://ntfy.sh\tchate.io\t70\n");
96 print("i - Awesome and very easy to use PUT/POST\tchate.io\t70\n");
97 print("i based notification system\tchate.io\t70\n");
98 print("i\tchate.io\t70\n");
99 printer("Cool Places","i","\tchate.io\t70");
100 printer(" --> baud.baby","1","\t/\tbaud.baby\t70");
101 printer(" --> hngopher.com (HN Gopher Proxy)","1","\t/\thngopher.com\t70");
102 printer(" --> Linkerror","1","\t/\tgopher.linkerror.com\t70");
103 printer(" --> gopher.black","1","\t/\tgopher.black\t70");
104 printer(" --> tilde.club","1","\t/\ttilde.club\t70");
105 printer(" --> RPoD (1436.ninja)","1","\t/\t1436.ninja\t70");
106 printer(" --> gopherpedia (Wikipedia Gopher Proxy)","1","\t/\tgopherpedia.com\t70");
107 printer(" --> thelambdalab.xyz","1","\t/\tthelambdalab.xyz\t70");
108 print("i\tchate.io\t70\n");
109 printer("Git Proxy","1","\t/git/go_git.cgi\tchate.io\t70");
110 print("i --> This takes you to a CGI script that will proxy\tchate.io\t70\n");
111 print("i HTTP requests to my git server, so that you can\tchate.io\t70\n");
112 print("i browse my git repos\tchate.io\t70\n");
113 print("i --> Note: Some clients won't render certain file exts,\tchate.io\t70\n");
114 print("i which may cause some repos to appear empty.\tchate.io\t70\n");
115 print("i\tchate.io\t70\n");
116 printer("Mastodon Proxy","0","\t/masto/go_mast.cgi\tchate.io\t70");
117 print("i --> Proxy of what I'm posting on Mastodon\tchate.io\t70\n");
118 print("i\tchate.io\t70\n");
119 printer("Script that generates this page","0","\t/foobar.txt\tchate.io\t70");
120 print("i\tchate.io\t70\n");
121 print("1Plain\t/foobar.cgi?plain\tchate.io\t70\tchate.io\t70\n");
122 print("1Colorized\t/\tchate.io\t70\tchate.io\t70\n");
123 print("iIf the site looks weird, use the Plain entry above\tchate.io\t70\n");
124 print("i --> Sometimes info lines are filtered in some clients\tchate.io\t70\n");
125 print("i when using the ?plain query, I'm not sure why yet\tchate.io\t70\n");
126 print("i\tchate.io\t70\n");
127 print("iThis gopher site expects a client that either supports or\tchate.io\t70\n");
128 print("ifilters ANSI escape sequences. I recommend:\tchate.io\t70\n");
129 print("i--> cgo\tchate.io\t70\n");
130 print("i--> phetch\tchate.io\t70\n");
131 print("i--> lagrange\tchate.io\t70\n");
132 print("i--> castor\tchate.io\t70\n");
133 print("i--> curl (use gopher://)\tchate.io\t70\n");
134 print("i--> Elpher (filters ANSI)\tchate.io\t70\n");