pastebot-cvs Mailing List for pastebot (Page 4)
Status: Beta
Brought to you by:
rcaputo
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(12) |
Jun
(6) |
Jul
(2) |
Aug
|
Sep
|
Oct
(14) |
Nov
(3) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
(11) |
Jul
(4) |
Aug
|
Sep
|
Oct
(16) |
Nov
(22) |
Dec
(6) |
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
(10) |
Oct
|
Nov
(2) |
Dec
|
From: <rc...@us...> - 2002-11-27 08:42:54
|
Update of /cvsroot/pastebot/pastebot/templates In directory sc8-pr-cvs1:/tmp/cvs-serv15125/templates Modified Files: paste-form.html Log Message: Make the network someone pastes to a little more prominent. This is in response to people pasting to the wrong network of a multi-net bot. Index: paste-form.html =================================================================== RCS file: /cvsroot/pastebot/pastebot/templates/paste-form.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** paste-form.html 18 Oct 2002 02:10:17 -0000 1.3 --- paste-form.html 27 Nov 2002 08:42:51 -0000 1.4 *************** *** 7,10 **** --- 7,13 ---- <h1>No paste!</h1> <p> + You will be pasting to [% value name='bot_name' %]. + </p> + <p> This is an experiment in automated non-pasting. Content that is posted in this form will be announced on the channel of your |
From: <rc...@us...> - 2002-11-27 08:42:54
|
Update of /cvsroot/pastebot/pastebot In directory sc8-pr-cvs1:/tmp/cvs-serv15125 Modified Files: pastebot.conf-dist Log Message: Make the network someone pastes to a little more prominent. This is in response to people pasting to the wrong network of a multi-net bot. Index: pastebot.conf-dist =================================================================== RCS file: /cvsroot/pastebot/pastebot/pastebot.conf-dist,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pastebot.conf-dist 18 Oct 2002 02:02:30 -0000 1.3 --- pastebot.conf-dist 27 Nov 2002 08:42:51 -0000 1.4 *************** *** 9,15 **** # The code name for this web server. It is used internally to ! # associate IRC clients and web servers. ! name global # The local interface to bind on. It's not uncommon for this --- 9,17 ---- # The code name for this web server. It is used internally to ! # associate IRC clients and web servers. It's also used in ! # page titles and to announce which network someone is pasting ! # to. ! name poenet # The local interface to bind on. It's not uncommon for this |
From: <rc...@us...> - 2002-11-03 22:23:16
|
Update of /cvsroot/pastebot/pastebot/Server In directory usw-pr-cvs1:/tmp/cvs-serv18964/Server Modified Files: Web.pm Log Message: Wrap the $summary in quotes on the IRC announcement. Index: Web.pm =================================================================== RCS file: /cvsroot/pastebot/pastebot/Server/Web.pm,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Web.pm 18 Oct 2002 02:42:34 -0000 1.9 --- Web.pm 3 Nov 2002 22:23:13 -0000 1.10 *************** *** 241,245 **** if ($channel and $channel =~ /^\#/) { $kernel->post( "irc_client_$heap->{my_isrv}" => announce => ! $channel => "$nick pasted $summary at $paste_link" ); } --- 241,245 ---- if ($channel and $channel =~ /^\#/) { $kernel->post( "irc_client_$heap->{my_isrv}" => announce => ! $channel => "$nick pasted \"$summary\" at $paste_link" ); } |
From: <rc...@us...> - 2002-10-18 02:44:51
|
Update of /cvsroot/pastebot/pastebot/Client In directory usw-pr-cvs1:/tmp/cvs-serv16263/Client Modified Files: IRC.pm Log Message: Add an uptime command so we can have high-precision happiness about how long the bot runs. Index: IRC.pm =================================================================== RCS file: /cvsroot/pastebot/pastebot/Client/IRC.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IRC.pm 15 Oct 2002 22:09:24 -0000 1.2 --- IRC.pm 18 Oct 2002 02:44:48 -0000 1.3 *************** *** 21,26 **** ( help => <<EOS, ! Commands: help, ignore, ignores, delete, about. Use help <command> for ! help on that command Other topics: about wildcards pasteids EOS ignore => <<EOS, --- 21,27 ---- ( help => <<EOS, ! Commands: help, ignore, ignores, delete, about, uptime. Use help ! <command> for help on that command Other topics: about wildcards ! pasteids EOS ignore => <<EOS, *************** *** 51,54 **** --- 52,59 ---- http://nopaste.snit.ch:8000/22 the pasteid is 22 EOS + uptime => <<EOS, + Display how long the program has been running and how much CPU it has + consumed. + EOS ); *************** *** 162,166 **** } elsif ($msg =~ /^\s*ignores\s/) { ! unless ($msg =~ /^\s*ignores\s+(#\S+)\s*$/) { $kernel->post( $server => privmsg => $nick, "Usage: ignores <channel>"); --- 167,171 ---- } elsif ($msg =~ /^\s*ignores\s/) { ! unless ($msg =~ /^\s*ignores\s+(\#\S+)\s*$/) { $kernel->post( $server => privmsg => $nick, "Usage: ignores <channel>"); *************** *** 192,195 **** --- 197,214 ---- or $kernel->post($server => whois => $nick ); } + elsif ($msg =~ /^\s*uptime\s*$/) { + my ($user_time, $system_time) = (times())[0,1]; + my $wall_time = (time() - $^T) || 1; + my $load_average = + sprintf("%.4f", ($user_time+$system_time) / $wall_time); + $kernel->post + ( $server => privmsg => $nick, + "I was started on " . scalar(gmtime($^T)) . " GMT. " . + "I've been active for " . format_elapsed($wall_time, 2) . ". " . + sprintf( "I have used about %.2f%% of a CPU during my lifespan.", + (($user_time+$system_time)/$wall_time) * 100 + ) + ); + } }, *************** *** 378,381 **** --- 397,443 ---- }, ); + } + + # Helper function. Display a number of seconds as a formatted period + # of time. NOT A POE EVENT HANDLER. + + sub format_elapsed { + my ($secs, $precision) = @_; + my @fields; + + # If the elapsed time can be measured in weeks. + if (my $part = int($secs / 604800)) { + $secs %= 604800; + push(@fields, $part . 'w'); + } + + # If the remaining time can be measured in days. + if (my $part = int($secs / 86400)) { + $secs %= 86400; + push(@fields, $part . 'd'); + } + + # If the remaining time can be measured in hours. + if (my $part = int($secs / 3600)) { + $secs %= 3600; + push(@fields, $part . 'h'); + } + + # If the remaining time can be measured in minutes. + if (my $part = int($secs / 60)) { + $secs %= 60; + push(@fields, $part . 'm'); + } + + # If there are any seconds remaining, or the time is nothing. + if ($secs || !@fields) { + push(@fields, $secs . 's'); + } + + # Reduce precision, if requested. + pop(@fields) while $precision and @fields > $precision; + + # Combine the parts. + join(' ', @fields); } |
From: <rc...@us...> - 2002-10-18 02:42:37
|
Update of /cvsroot/pastebot/pastebot/Server In directory usw-pr-cvs1:/tmp/cvs-serv15796/Server Modified Files: Web.pm Log Message: I forgot to wrap one of the Perl::Tidy invocations in eval{}. Make sure they're both done now, and replace the tidied content with $@ if there's been an error. Index: Web.pm =================================================================== RCS file: /cvsroot/pastebot/pastebot/Server/Web.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Web.pm 18 Oct 2002 02:02:30 -0000 1.8 --- Web.pm 18 Oct 2002 02:42:34 -0000 1.9 *************** *** 458,470 **** if ($tidied) { ! my $tidied = ""; eval { Perl::Tidy::perltidy ( source => \$paste, ! destination => \$tidied, argv => [ '-q', '-nanl', '-fnl' ], ); }; ! $paste = $tidied; } --- 458,475 ---- if ($tidied) { ! my $tidy_version = ""; eval { Perl::Tidy::perltidy ( source => \$paste, ! destination => \$tidy_version, argv => [ '-q', '-nanl', '-fnl' ], ); }; ! if ($@) { ! $paste = "Could not tidy this paste (try turning tidying off): $@"; ! } ! else { ! $paste = $tidy_version; ! } } *************** *** 475,485 **** push @html_args, "-nnn" if $line_nums; ! my $html = ""; ! Perl::Tidy::perltidy ! ( source => \$paste, ! destination => \$html, ! argv => \@html_args, ! ); ! return $html; } --- 480,496 ---- push @html_args, "-nnn" if $line_nums; ! my $highlighted = ""; ! eval { ! Perl::Tidy::perltidy ! ( source => \$paste, ! destination => \$highlighted, ! argv => \@html_args, ! ); ! }; ! if ($@) { ! $highlighted = ! "Could not highlight the paste (try turning highlighting off): $@"; ! } ! return $highlighted; } |
From: <rc...@us...> - 2002-10-18 02:10:20
|
Update of /cvsroot/pastebot/pastebot/templates In directory usw-pr-cvs1:/tmp/cvs-serv8417 Modified Files: highlights.css paste-form.html paste-lookup.html Log Message: Trivial whitespace cleanup in highlights.css. Make the style sheet hrefs relative instead of absolute. Make the form actions relative instead of absolute. These should fix problems with using the web services through ProxyPass directives. Index: highlights.css =================================================================== RCS file: /cvsroot/pastebot/pastebot/templates/highlights.css,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** highlights.css 18 May 2002 00:50:42 -0000 1.1 --- highlights.css 18 Oct 2002 02:10:17 -0000 1.2 *************** *** 17,21 **** .co { color: #800097;} /* colon */ - .h { color: #804848;} /* here-doc-target */ .hh { color: #800000;} /* here-doc-text */ --- 17,20 ---- *************** *** 37,41 **** .pu { color: #C44800;} /* punctuation */ - --> --- 36,39 ---- Index: paste-form.html =================================================================== RCS file: /cvsroot/pastebot/pastebot/templates/paste-form.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** paste-form.html 15 Oct 2002 22:14:02 -0000 1.2 --- paste-form.html 18 Oct 2002 02:10:17 -0000 1.3 *************** *** 12,16 **** </p> <p> ! <form method='post' action='/paste' enctype='application/x-www-from-urlencoded' name="pasteForm"> <p> Channel: <select name='channel'>[% value name='channels' %]</select> --- 12,16 ---- </p> <p> ! <form method='post' action='./paste' enctype='application/x-www-from-urlencoded' name="pasteForm"> <p> Channel: <select name='channel'>[% value name='channels' %]</select> Index: paste-lookup.html =================================================================== RCS file: /cvsroot/pastebot/pastebot/templates/paste-lookup.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** paste-lookup.html 8 Jun 2002 18:16:48 -0000 1.2 --- paste-lookup.html 18 Oct 2002 02:10:17 -0000 1.3 *************** *** 3,11 **** <head> <title>[% value name='bot_name' %] paste number [% value name='paste_id' %]...</title> ! <link rel="stylesheet" type="text/css" href="/style"> </head> <body> <p> ! <form method='get' action='/[% value name="paste_id" %]'> <input type='checkbox' name='tidy' [% value name='tidy' %]> Tidied up a bit. <input type='checkbox' name='hl' [% value name='hl' %]> Highlighted. --- 3,11 ---- <head> <title>[% value name='bot_name' %] paste number [% value name='paste_id' %]...</title> ! <link rel="stylesheet" type="text/css" href="./style"> </head> <body> <p> ! <form method='get' action='./[% value name="paste_id" %]'> <input type='checkbox' name='tidy' [% value name='tidy' %]> Tidied up a bit. <input type='checkbox' name='hl' [% value name='hl' %]> Highlighted. |
From: <to...@us...> - 2002-10-18 02:02:38
|
Update of /cvsroot/pastebot/pastebot/Server In directory usw-pr-cvs1:/tmp/cvs-serv31068/Server Modified Files: Web.pm Log Message: add an option to see if there's a proxy, if the request came through the passthrough proxy, extract the originating IP address from the headers the proxy gives us. Index: Web.pm =================================================================== RCS file: /cvsroot/pastebot/pastebot/Server/Web.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Web.pm 17 Oct 2002 02:51:49 -0000 1.7 --- Web.pm 18 Oct 2002 02:02:30 -0000 1.8 *************** *** 53,58 **** my ( $heap, $socket, $remote_address, $remote_port, ! $my_name, $my_host, $my_port, $my_ifname, $my_isrv, $my_chans ! ) = @_[HEAP, ARG0..ARG8]; # TODO: I think $my_host is obsolete. Maybe it can be removed, and --- 53,59 ---- my ( $heap, $socket, $remote_address, $remote_port, ! $my_name, $my_host, $my_port, $my_ifname, $my_isrv, $my_chans, ! $proxy, ! ) = @_[HEAP, ARG0..ARG9]; # TODO: I think $my_host is obsolete. Maybe it can be removed, and *************** *** 65,68 **** --- 66,70 ---- $heap->{my_isrv} = $my_isrv; $heap->{my_chans} = $my_chans; + $heap->{my_proxy} = $proxy; $heap->{remote_addr} = inet_ntoa($remote_address); *************** *** 141,148 **** $channel =~ tr[\x00-\x1F\x7F][]d; my $error = ""; if (length $channel) { # See if it matches. ! if (is_ignored($heap->{my_isrv}, $channel, $heap->{remote_addr})) { $error = ( "<p><b><font size='+1' color='#800000'>" . --- 143,161 ---- $channel =~ tr[\x00-\x1F\x7F][]d; + my $remote_addr = $heap->{remote_addr}; + if ($heap->{my_proxy} && $remote_addr eq $heap->{my_proxy}) { + # apache sets the X-Forwarded-For header to a list of the + # IP addresses that were forwarded from/to + my $forwarded = $request->headers->header('X-Forwarded-For'); + if ($forwarded) { + ($remote_addr) = split ',', $forwarded; + } + # else must be local + } + my $error = ""; if (length $channel) { # See if it matches. ! if (is_ignored($heap->{my_isrv}, $channel, $remote_addr)) { $error = ( "<p><b><font size='+1' color='#800000'>" . *************** *** 180,184 **** } ! $nick .= " at $heap->{remote_addr}"; # <CanyonMan> how about adding a form field with a "Subject" --- 193,197 ---- } ! $nick .= " at $remote_addr"; # <CanyonMan> how about adding a form field with a "Subject" *************** *** 208,212 **** my $id = store_paste( $nick, $html_summary, $paste, ! $heap->{my_isrv}, $channel, $heap->{remote_addr} ); my $paste_link = "http://$heap->{my_inam}:$heap->{my_port}/$id"; --- 221,225 ---- my $id = store_paste( $nick, $html_summary, $paste, ! $heap->{my_isrv}, $channel, $remote_addr ); my $paste_link = "http://$heap->{my_inam}:$heap->{my_port}/$id"; *************** *** 302,308 **** my @channels = @{$heap->{my_chans}}; @channels = map { "<option value='\#$_'>\#$_" } @channels; - $channels[0] =~ s/\'\>\#/\' selected>\#/; @channels = sort @channels; ! unshift(@channels, "<option value=''>(none)"); # Build content. --- 315,320 ---- my @channels = @{$heap->{my_chans}}; @channels = map { "<option value='\#$_'>\#$_" } @channels; @channels = sort @channels; ! unshift(@channels, "<option value='' selected>(none)"); # Build content. *************** *** 431,435 **** [ @_[ARG0..ARG2], $server, $conf{iface}, $conf{port}, $conf{ifname}, $conf{irc}, ! $ircconf{channel} ], ); --- 443,447 ---- [ @_[ARG0..ARG2], $server, $conf{iface}, $conf{port}, $conf{ifname}, $conf{irc}, ! $ircconf{channel}, $conf{proxy}, ], ); |
From: <to...@us...> - 2002-10-18 02:02:37
|
Update of /cvsroot/pastebot/pastebot/Util In directory usw-pr-cvs1:/tmp/cvs-serv31068/Util Modified Files: Conf.pm Log Message: add an option to see if there's a proxy, if the request came through the passthrough proxy, extract the originating IP address from the headers the proxy gives us. Index: Conf.pm =================================================================== RCS file: /cvsroot/pastebot/pastebot/Util/Conf.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Conf.pm 15 Oct 2002 22:12:34 -0000 1.2 --- Conf.pm 18 Oct 2002 02:02:30 -0000 1.3 *************** *** 27,30 **** --- 27,31 ---- port => SCALAR | REQUIRED, irc => SCALAR | REQUIRED, + proxy => SCALAR, }, irc => |
From: <to...@us...> - 2002-10-18 02:02:37
|
Update of /cvsroot/pastebot/pastebot In directory usw-pr-cvs1:/tmp/cvs-serv31068 Modified Files: pastebot.conf-dist Log Message: add an option to see if there's a proxy, if the request came through the passthrough proxy, extract the originating IP address from the headers the proxy gives us. Index: pastebot.conf-dist =================================================================== RCS file: /cvsroot/pastebot/pastebot/pastebot.conf-dist,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pastebot.conf-dist 15 Oct 2002 22:08:25 -0000 1.2 --- pastebot.conf-dist 18 Oct 2002 02:02:30 -0000 1.3 *************** *** 33,36 **** --- 33,42 ---- irc efnet + # if you're using apache as a proxy to forward connections to + # port 80 to some other port, put the IP address of the proxy + # here so we can dig through the headers to find the requester + + # proxy 127.0.0.1 + # Define an IRC client. Each "irc" section defines another client # that pastebot uses to connect to a network. Each client may listen |
From: <to...@us...> - 2002-10-17 03:19:50
|
Update of /cvsroot/pastebot/pastebot In directory usw-pr-cvs1:/tmp/cvs-serv27296 Added Files: MANIFEST MANIFEST.SKIP Makefile Log Message: Added a makefile and manifest to make it simpler to build distributions. --- NEW FILE: MANIFEST --- CHANGES COPYRIGHT Client/IRC.pm MANIFEST MANIFEST.SKIP Makefile README Server/Web.pm TODO Util/Conf.pm Util/Data.pm Util/Web.pm pastebot.conf-dist pastebot.perl templates/highlights.css templates/paste-answer.html templates/paste-form.html templates/paste-lookup.html --- NEW FILE: MANIFEST.SKIP --- \.tar\.gz$ \bCVS\b ~$ ^pastebot.conf$ /\.# ^\.# ^MANIFEST\.bak$ --- NEW FILE: Makefile --- VERSION=20021017 DISTNAME=pastebot-$(VERSION) DISTBUILD=$(DISTNAME) DISTTAR=$(DISTNAME).tar DISTTGZ=$(DISTTAR).gz dist: $(DISTTGZ) $(DISTTGZ): distdir if [ -e $(DISTTGZ) ] ; \ then echo $(DISTTGZ) already exists ; \ exit 1 ; \ fi tar cf $(DISTTAR) $(DISTBUILD) -perl -MExtUtils::Command -e rm_rf $(DISTBUILD) gzip $(DISTTAR) distdir: -perl -MExtUtils::Command -e rm_rf $(DISTBUILD) perl -MExtUtils::Manifest=manicopy,maniread -e "manicopy(maniread(), '$(DISTBUILD)')" find $(DISTBUILD) -type f | xargs chmod u+w clean: -perl -MExtUtils::Command -e rm_rf $(DISTBUILD) manicheck: perl -MExtUtils::Manifest=manicheck -e 'manicheck()' filecheck: perl -MExtUtils::Manifest=filecheck -e 'filecheck()' mkmanifest: perl -MExtUtils::Manifest=mkmanifest -e 'mkmanifest()' |
From: <to...@us...> - 2002-10-17 02:51:55
|
Update of /cvsroot/pastebot/pastebot/Server In directory usw-pr-cvs1:/tmp/cvs-serv21437/Server Modified Files: Web.pm Log Message: We were sending the summary HTML encoded to IRC Index: Web.pm =================================================================== RCS file: /cvsroot/pastebot/pastebot/Server/Web.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Web.pm 15 Oct 2002 22:10:55 -0000 1.6 --- Web.pm 17 Oct 2002 02:51:49 -0000 1.7 *************** *** 204,211 **** } - $summary = html_encode($summary); $summary = "something" unless length $summary; ! my $id = store_paste( $nick, $summary, $paste, $heap->{my_isrv}, $channel, $heap->{remote_addr} ); --- 204,211 ---- } $summary = "something" unless length $summary; + my $html_summary = html_encode($summary); ! my $id = store_paste( $nick, $html_summary, $paste, $heap->{my_isrv}, $channel, $heap->{remote_addr} ); |
From: <rc...@us...> - 2002-10-16 16:16:25
|
Update of /cvsroot/pastebot/pastebot In directory usw-pr-cvs1:/tmp/cvs-serv16993 Removed Files: CHANGES Log Message: Remove CHANGES as it will be dynamically generated. --- CHANGES DELETED --- |
From: <rc...@us...> - 2002-10-15 22:14:05
|
Update of /cvsroot/pastebot/pastebot/templates In directory usw-pr-cvs1:/tmp/cvs-serv19595/templates Modified Files: paste-form.html Log Message: Included yossarian's jscript code to fill the paste textarea from the clipboard. This only works on IE, though. Index: paste-form.html =================================================================== RCS file: /cvsroot/pastebot/pastebot/templates/paste-form.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** paste-form.html 18 May 2002 00:50:42 -0000 1.1 --- paste-form.html 15 Oct 2002 22:14:02 -0000 1.2 *************** *** 12,16 **** </p> <p> ! <form method='post' action='/paste' enctype='application/x-www-from-urlencoded'> <p> Channel: <select name='channel'>[% value name='channels' %]</select> --- 12,16 ---- </p> <p> ! <form method='post' action='/paste' enctype='application/x-www-from-urlencoded' name="pasteForm"> <p> Channel: <select name='channel'>[% value name='channels' %]</select> *************** *** 37,40 **** --- 37,51 ---- </p> </form> + + <!-- Automatically put the clipboard contents into the paste field. --> + <script language="jscript"> + onload=function () { + try { + document.pasteForm.paste.value=clipboardData.getData("Text") || ""; + } + catch (oErr) {} + } + </script> + </body> </html> |
From: <rc...@us...> - 2002-10-15 22:12:38
|
Update of /cvsroot/pastebot/pastebot/Util In directory usw-pr-cvs1:/tmp/cvs-serv18767/Util Modified Files: Conf.pm Data.pm Log Message: Applied Jonathan Scott Duff's patches to periodically expire old pastes or force expiration of the oldest pastes when new ones would overflow some limit. These patches constrain the bot's memory footprint. Index: Conf.pm =================================================================== RCS file: /cvsroot/pastebot/pastebot/Util/Conf.pm,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Conf.pm 8 May 2002 16:11:08 -0000 1.1.1.1 --- Conf.pm 15 Oct 2002 22:12:34 -0000 1.2 *************** *** 8,13 **** use Exporter; use Carp qw(croak); ! use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); @EXPORT = qw( get_names_by_type --- 8,14 ---- use Exporter; use Carp qw(croak); + use Getopt::Std; ! use vars qw(@ISA @EXPORT %OPTS); @ISA = qw(Exporter); @EXPORT = qw( get_names_by_type *************** *** 42,45 **** --- 43,53 ---- localaddr => SCALAR, }, + pastes => + { name => SCALAR | REQUIRED, + check => SCALAR, + expire => SCALAR, + count => SCALAR, + throttle => SCALAR, + }, ); *************** *** 66,70 **** } ! open(MPH, "<./pastebot.conf") or die $!; while (<MPH>) { chomp; --- 74,81 ---- } ! my %opts; ! getopts("f:", \%opts); ! my $cfile = $opts{"f"} || "./pastebot.conf"; ! open(MPH, "<$cfile") or die $!; while (<MPH>) { chomp; Index: Data.pm =================================================================== RCS file: /cvsroot/pastebot/pastebot/Util/Data.pm,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Data.pm 8 May 2002 16:11:08 -0000 1.1.1.1 --- Data.pm 15 Oct 2002 22:12:34 -0000 1.2 *************** *** 8,16 **** use Exporter; use Carp qw(croak); use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); ! @EXPORT = qw( store_paste fetch_paste delete_paste ! fetch_paste_channel clear_channel_ignores set_ignore clear_ignore get_ignores is_ignored ); --- 8,18 ---- use Exporter; use Carp qw(croak); + use POE; + use Util::Conf; use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); ! @EXPORT = qw( store_paste fetch_paste delete_paste list_paste_ids ! delete_paste_by_id fetch_paste_channel clear_channel_ignores set_ignore clear_ignore get_ignores is_ignored ); *************** *** 28,35 **** --- 30,58 ---- my %ignores; # $ignores{$ircnet}{lc $channel} = [ mask, mask, ... ]; + # return a list of all paste ids + + sub list_paste_ids { + return keys %paste_cache; + } + + # remove pastes that are too old (if applicable) + sub check_paste_count { + my @names = get_names_by_type('pastes'); + return unless @names; + my %conf = get_items_by_name($names[0]); + return unless %conf && $conf{'count'}; + return if (scalar keys %paste_cache < $conf{'count'}); + my $oldest = time; + for (keys %paste_cache) { + $oldest = $_ if $paste_cache{$_}->[PASTE_TIME] < $oldest; + } + delete $paste_cache{$oldest}; + } + # Save paste, returning an ID. sub store_paste { my ($id, $summary, $paste, $ircnet, $channel, $ipaddress) = @_; + check_paste_count(); my $new_id = ++$id_sequence; $paste_cache{$new_id} = *************** *** 64,67 **** --- 87,95 ---- } + sub delete_paste_by_id { + my $id = shift; + delete $paste_cache{$id}; + } + # Delete a possibly sensitive or offensive paste. *************** *** 144,147 **** --- 172,191 ---- } + my @pastes = get_names_by_type('pastes'); + if (@pastes) { + my %conf = get_items_by_name($pastes[0]); + if ($conf{'check'} && $conf{'expire'}) { + POE::Session->new( + _start => sub { $_[KERNEL]->delay( ticks => $conf{'check'} ); }, + ticks => sub { + for (keys %paste_cache) { + next unless (time - $paste_cache{$_}->[PASTE_TIME]) > $conf{'expire'}; + delete $paste_cache{$_}; + } + $_[KERNEL]->delay( ticks => $conf{'check'} ); + }, + ); + } + } ### End. |
From: <rc...@us...> - 2002-10-15 22:10:57
|
Update of /cvsroot/pastebot/pastebot/Server In directory usw-pr-cvs1:/tmp/cvs-serv17879/Server Modified Files: Web.pm Log Message: Patched a security hole yossarian found. It is possible in previous versions to make the bot send arbitrary IRC commands. Index: Web.pm =================================================================== RCS file: /cvsroot/pastebot/pastebot/Server/Web.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Web.pm 23 Jul 2002 22:04:15 -0000 1.5 --- Web.pm 15 Oct 2002 22:10:55 -0000 1.6 *************** *** 139,151 **** my $channel = $content->{channel}; defined $channel or $channel = ""; my $error = ""; ! if ($channel) { # See if it matches. if (is_ignored($heap->{my_isrv}, $channel, $heap->{remote_addr})) { $error = ! ( "<p><b>" . "Your IP address has been blocked from pasting to $channel." . ! "</b></p>" ); $channel = ""; --- 139,164 ---- my $channel = $content->{channel}; defined $channel or $channel = ""; + $channel =~ tr[\x00-\x1F\x7F][]d; my $error = ""; ! if (length $channel) { # See if it matches. if (is_ignored($heap->{my_isrv}, $channel, $heap->{remote_addr})) { $error = ! ( "<p><b><font size='+1' color='#800000'>" . "Your IP address has been blocked from pasting to $channel." . ! "</font></b></p>" ! ); ! $channel = ""; ! } ! } ! ! # Goes as a separate block. ! if (length $channel) { ! unless (grep { "\#$_" eq $channel } @{$heap->{my_chans}}) { ! $error = ! ( "<p><b><font size='+1' color='#800000'>" . ! "The channel you pasted to is not known." . ! "</font></b></p>" ); $channel = ""; *************** *** 155,158 **** --- 168,172 ---- my $nick = $content->{nick}; $nick = "" unless defined $nick; + $nick =~ tr[\x00-\x1F\x7F][ ]s; $nick =~ s/\s+/ /g; $nick =~ s/^\s+//; *************** *** 173,176 **** --- 187,191 ---- my $summary = $content->{summary}; $summary = "" unless defined $summary; + $summary =~ tr[\x00-\x1F\x7F][ ]s; $summary =~ s/\s+/ /g; $summary =~ s/^\s+//; |
From: <rc...@us...> - 2002-10-15 22:09:29
|
Update of /cvsroot/pastebot/pastebot/Client In directory usw-pr-cvs1:/tmp/cvs-serv17608/Client Modified Files: IRC.pm Log Message: Insignificant tweak to the debugging output. Index: IRC.pm =================================================================== RCS file: /cvsroot/pastebot/pastebot/Client/IRC.pm,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** IRC.pm 8 May 2002 16:11:05 -0000 1.1.1.1 --- IRC.pm 15 Oct 2002 22:09:24 -0000 1.2 *************** *** 287,291 **** my ($state, $event, $args, $heap) = @_[STATE, ARG0, ARG1, HEAP]; $args ||= [ ]; ! print "default $state = $event @$args\n"; $heap->{seen_traffic} = 1; return 0; --- 287,291 ---- my ($state, $event, $args, $heap) = @_[STATE, ARG0, ARG1, HEAP]; $args ||= [ ]; ! print "default $state = $event (@$args)\n"; $heap->{seen_traffic} = 1; return 0; |
From: <rc...@us...> - 2002-10-15 22:08:28
|
Update of /cvsroot/pastebot/pastebot In directory usw-pr-cvs1:/tmp/cvs-serv17081 Modified Files: pastebot.conf-dist Log Message: Apply Jonathan Scott Duff's configuration changes to specify the maximum number of pastes to keep and the maximum paste lifetime. Index: pastebot.conf-dist =================================================================== RCS file: /cvsroot/pastebot/pastebot/pastebot.conf-dist,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pastebot.conf-dist 15 May 2002 02:32:56 -0000 1.1 --- pastebot.conf-dist 15 Oct 2002 22:08:25 -0000 1.2 *************** *** 111,112 **** --- 111,131 ---- localaddr poe.perl.org + + pastes + # The code name for these pastes. + + name pasty + + # Check pastes for expiry every check seconds (0 never checks) + # This sets it to 1 hour. + + check 3600 + + # expire those pastes older than expire seconds (0 never expires) + # This sets it to 10 days. + + expire 864000 + + # maximum number of pastes stored (0 allows infinite) + + count 0 |
From: <rc...@us...> - 2002-07-23 22:04:19
|
Update of /cvsroot/pastebot/pastebot In directory usw-pr-cvs1:/tmp/cvs-serv20756 Modified Files: CHANGES Log Message: Made (none) the default channel so that morons who don't read the instructions don't spam some innocent channel with paste notices. Index: CHANGES =================================================================== RCS file: /cvsroot/pastebot/pastebot/CHANGES,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CHANGES 8 Jun 2002 18:23:28 -0000 1.6 --- CHANGES 23 Jul 2002 22:04:15 -0000 1.7 *************** *** 2,5 **** --- 2,13 ---- ---------- + ????-??-?? + ---------- + + Rocco made (none) the default channel to paste to, rather than the + last one. People from #C++ could not read the directions, so + #perlhelp were getting spammed with paste notices. + + ---------- 2002-06-08 ---------- |
From: <rc...@us...> - 2002-07-23 22:04:19
|
Update of /cvsroot/pastebot/pastebot/Server In directory usw-pr-cvs1:/tmp/cvs-serv20756/Server Modified Files: Web.pm Log Message: Made (none) the default channel so that morons who don't read the instructions don't spam some innocent channel with paste notices. Index: Web.pm =================================================================== RCS file: /cvsroot/pastebot/pastebot/Server/Web.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Web.pm 8 Jun 2002 18:16:47 -0000 1.4 --- Web.pm 23 Jul 2002 22:04:15 -0000 1.5 *************** *** 289,293 **** $channels[0] =~ s/\'\>\#/\' selected>\#/; @channels = sort @channels; ! push(@channels, "<option value=''>(none)"); # Build content. --- 289,293 ---- $channels[0] =~ s/\'\>\#/\' selected>\#/; @channels = sort @channels; ! unshift(@channels, "<option value=''>(none)"); # Build content. |
From: <rc...@us...> - 2002-06-25 14:49:50
|
Update of /cvsroot/pastebot/pastebot In directory usw-pr-cvs1:/tmp/cvs-serv21148 Modified Files: README Log Message: Pastebot is hostile towards people behind firewalls. It runs a separate server which often must not be on port 80 (because some other web server is there). Added notes for Apache's ProxyPass directive, so a port-80 server can forward requests to pastebot. Index: README =================================================================== RCS file: /cvsroot/pastebot/pastebot/README,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README 18 May 2002 00:59:02 -0000 1.4 --- README 25 Jun 2002 14:49:47 -0000 1.5 *************** *** 34,38 **** Run pastebot.perl. ! To do. ------ --- 34,61 ---- Run pastebot.perl. ! Pastebot is its own web server. It often cannot bind to port 80 ! because some other web server is already there. That's why its ! default port (in pastebot.conf-dist) is 8888. This is hostile towards ! people behind firewalls. ! ! Apache users can use ProxyPass to map a directory on their port-80 ! servers to a running pastebot. This feature requires Apache be built ! with proxy support. ! ! Allow access to a /pastebot/ directory. The directory should not ! exist. ! ! <Directory /pastebot/> ! Order allow,deny ! Allow from all ! Deny from none ! </Directory> ! ! Tell Apache to forward any requests in the /pastebot/ directory ! through to the local pastebot process. ! ! ProxyPass /pastebot/ http://127.0.0.1:8000/ ! ! Now people can use pastebot on port 80. ------ |
From: <rc...@us...> - 2002-06-08 18:23:31
|
Update of /cvsroot/pastebot/pastebot In directory usw-pr-cvs1:/tmp/cvs-serv21760 Modified Files: CHANGES Log Message: Tidy CHANGES for another release. Index: CHANGES =================================================================== RCS file: /cvsroot/pastebot/pastebot/CHANGES,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CHANGES 8 Jun 2002 18:14:50 -0000 1.5 --- CHANGES 8 Jun 2002 18:23:28 -0000 1.6 *************** *** 2,6 **** ---------- ! 2002-??-?? ---------- --- 2,6 ---- ---------- ! 2002-06-08 ---------- |
From: <rc...@us...> - 2002-06-08 18:18:00
|
Update of /cvsroot/pastebot/pastebot/Util In directory usw-pr-cvs1:/tmp/cvs-serv20053/Util Modified Files: Web.pm Log Message: Added an is_true() function to reduce many different forms of truth and falsity into 1 and 0 so perl can understand them. Index: Web.pm =================================================================== RCS file: /cvsroot/pastebot/pastebot/Util/Web.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Web.pm 18 May 2002 00:53:09 -0000 1.2 --- Web.pm 8 Jun 2002 18:17:57 -0000 1.3 *************** *** 14,18 **** @EXPORT = qw( url_decode url_encode parse_content static_response dump_content dump_query_as_response base64_decode ! html_encode ); --- 14,18 ---- @EXPORT = qw( url_decode url_encode parse_content static_response dump_content dump_query_as_response base64_decode ! html_encode is_true ); *************** *** 83,87 **** my %content; ! foreach (split(/[&;]/, $content)) { my ($param, $value) = split(/=/, $_, 2); $param = &url_decode($param); --- 83,89 ---- my %content; ! return \%content unless defined $content and length $content; ! ! foreach (split(/[\&\;]/, $content)) { my ($param, $value) = split(/=/, $_, 2); $param = &url_decode($param); *************** *** 261,264 **** --- 263,281 ---- } return $data; + } + + # Determine if a checkbox/radio thingy is true. + + my %bool = + ( 1 => 1, t => 1, y => 1, yes => 1, da => 1, si => 1, on => 1, + 0 => 0, f => 0, n => 0, no => 0, nyet => 0, off => 0, + ); + + sub is_true { + my $value = shift; + return 0 unless defined $value and length $value; + $value = lc($value); + return $bool{$value} if exists $bool{$value}; + return 0; } |
From: <rc...@us...> - 2002-06-08 18:16:50
|
Update of /cvsroot/pastebot/pastebot/templates In directory usw-pr-cvs1:/tmp/cvs-serv19517/templates Modified Files: paste-lookup.html Log Message: Added an option to render pasted text as text/plain without any adornments. This will let people fetch things like diffs with wget, and they should appear without whitespace munging that many browsers perpetrate during copy and paste. Index: paste-lookup.html =================================================================== RCS file: /cvsroot/pastebot/pastebot/templates/paste-lookup.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** paste-lookup.html 18 May 2002 00:50:42 -0000 1.1 --- paste-lookup.html 8 Jun 2002 18:16:48 -0000 1.2 *************** *** 11,14 **** --- 11,17 ---- <input type='checkbox' name='hl' [% value name='hl' %]> Highlighted. <input type='checkbox' name='ln' [% value name='ln' %]> With line numbers. + <br> + <input type='checkbox' name='tx' [% value name='tx' %]> As plain text (overrides all others). + <br> <input type='submit' name='submit' value='Reformat it'> </form> |
From: <rc...@us...> - 2002-06-08 18:16:50
|
Update of /cvsroot/pastebot/pastebot/Server In directory usw-pr-cvs1:/tmp/cvs-serv19517/Server Modified Files: Web.pm Log Message: Added an option to render pasted text as text/plain without any adornments. This will let people fetch things like diffs with wget, and they should appear without whitespace munging that many browsers perpetrate during copy and paste. Index: Web.pm =================================================================== RCS file: /cvsroot/pastebot/pastebot/Server/Web.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Web.pm 21 May 2002 13:10:03 -0000 1.3 --- Web.pm 8 Jun 2002 18:16:47 -0000 1.4 *************** *** 236,265 **** ### Make the paste pretty. ! my $ln = $query->{ln}; ! $ln = 0 unless $ln; ! ! my $tidy = $query->{tidy}; ! $tidy = 0 unless $tidy; ! ! my $hl = $query->{hl}; ! $hl = 0 unless $hl; ! my $paste = fix_paste($paste, $ln, $tidy, $hl); # Spew the paste. ! my $response = ! static_response( "templates/paste-lookup.html", ! { bot_name => $heap->{my_name}, ! paste_id => $num, ! nick => $nick, ! summary => $summary, ! paste => $paste, ! footer => PAGE_FOOTER, ! tidy => ( $tidy ? "checked" : "" ), ! hl => ( $hl ? "checked" : "" ), ! ln => ( $ln ? "checked" : "" ), ! } ! ); $heap->{wheel}->put( $response ); --- 236,270 ---- ### Make the paste pretty. ! my $ln = is_true($query->{ln}); ! my $tidy = is_true($query->{tidy}); ! my $hl = is_true($query->{hl}); ! my $tx = is_true($query->{tx}); ! $paste = fix_paste($paste, $ln, $tidy, $hl) unless $tx; # Spew the paste. ! my $response; ! if ($tx) { ! $response = HTTP::Response->new(200); ! $response->push_header( 'Content-type', 'text/plain' ); ! $response->content($paste); ! } ! else { ! $response = static_response ! ( "templates/paste-lookup.html", ! { bot_name => $heap->{my_name}, ! paste_id => $num, ! nick => $nick, ! summary => $summary, ! paste => $paste, ! footer => PAGE_FOOTER, ! tidy => ( $tidy ? "checked" : "" ), ! hl => ( $hl ? "checked" : "" ), ! ln => ( $ln ? "checked" : "" ), ! tx => ( $tx ? "checked" : "" ), ! } ! ); ! } $heap->{wheel}->put( $response ); *************** *** 427,435 **** if ($tidied) { my $tidied = ""; ! Perl::Tidy::perltidy ! ( source => \$paste, ! destination => \$tidied, ! argv => [ '-q', '-nanl', '-fnl' ], ! ); $paste = $tidied; } --- 432,442 ---- if ($tidied) { my $tidied = ""; ! eval { ! Perl::Tidy::perltidy ! ( source => \$paste, ! destination => \$tidied, ! argv => [ '-q', '-nanl', '-fnl' ], ! ); ! }; $paste = $tidied; } |
From: <rc...@us...> - 2002-06-08 18:14:54
|
Update of /cvsroot/pastebot/pastebot In directory usw-pr-cvs1:/tmp/cvs-serv19128 Modified Files: CHANGES TODO Log Message: Documented changes and suggestions via IRC. Index: CHANGES =================================================================== RCS file: /cvsroot/pastebot/pastebot/CHANGES,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CHANGES 21 May 2002 13:10:03 -0000 1.4 --- CHANGES 8 Jun 2002 18:14:50 -0000 1.5 *************** *** 31,34 **** --- 31,44 ---- removed the code. That wasn't needed in <pre></pre> either. + Rocco added feedback from coral and kane and android18 to the TODO + list. + + kane and coral suggested a way to render paste in plain text. Rocco + added that. + + Rocco added an is_true() function to Utils/Web.pm. It determines + whether a boolean value is true or not, reducing many forms of truth + and falsity to 1 and 0. + ---------- 2002-05-07 Index: TODO =================================================================== RCS file: /cvsroot/pastebot/pastebot/TODO,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TODO 18 May 2002 00:59:02 -0000 1.3 --- TODO 8 Jun 2002 18:14:50 -0000 1.4 *************** *** 118,121 **** --- 118,138 ---- nontrivial. + --------------------- + Paste Via Form Upload + --------------------- + + Add a standard "Browse" button and filename field, and let people + upload via the form. + + Also let people download verbatim with a link/button, to circumvent + crappy HTML renderers. + + -------------- + Non-text Paste + -------------- + + Allow images and things to be uploaded/pasted. Requires "paste via + form upload" and the ability to detect and/or specify content types. + --------------- Paste Via Email |