+Amiga etc.
authorshort <>
Fri, 3 Oct 2003 20:22:10 +0000 (20:22 +0000)
committershort <>
Fri, 3 Oct 2003 20:22:10 +0000 (20:22 +0000)
Project.pm
Web.pm

index 20fff63..3599cac 100644 (file)
@@ -66,26 +66,18 @@ my($class,$ListItem)=@_;
                                        }
                                return join(" ",@r);
                                }},
+               {"key"=>"aminet","text"=>a_href('http://www.aminet.net/','Aminet'),"format"=>sub ($) {
+                               return join(" ",
+                                               a_href('http://www.aminet.net/'.$_[0].".lha",$_[0].".lha"),
+                                               "(".a_href('http://www.aminet.net/'.$_[0].".readme","readme").")");
+                               }},
                {"key"=>qr(^download\b),"text"=>sub ($) {
                                                $_[0]=~s/^download//;
                                                $_[0]=~s/^-/ /;
                                                return "Download".$_[0];
                                                },
                                "format"=>sub ($) {
-                                               my $r;
-                                               if ($_[0]=~m#^[a-z]+://#) {
-                                                       $r=a_href($_[0],CGI::escapeHTML($_[0]));
-                                                       }
-                                               else {
-                                                       $r=a_href($_[0],CGI::escapeHTML(File::Basename::basename($_[0])));
-                                                       my $size=(stat $_[0])[7];
-                                                       die "Cannot stat \"".$_[0]."\": $!" if !defined $size;
-                                                                if ($size>=1024*1024) { $size=int($size/(1024*1024))." MB"; }
-                                                       elsif ($size>=1024     ) { $size=int($size/(1024     ))." KB"; }
-                                                       else                     { $size=int($size            )." B"; }
-                                                       $r.=" ($size)";
-                                                       }
-                                               return $r;
+                                               return a_href($_[0],CGI::escapeHTML($_[0]));
                                                }},
                {"key"=>qr(^link\b),"text"=>sub ($) {
                                                $_[0]=~s/^link-//;
diff --git a/Web.pm b/Web.pm
index 5c2b273..399590f 100644 (file)
--- a/Web.pm
+++ b/Web.pm
@@ -302,7 +302,7 @@ my($url,$contents,%args)=@_;
        else    # unknown client, &CGI::escapeHTML should not be needed here
                { $r.=CGI::escapeHTML("http://".$W->{"r"}->hostname()."/Redirect.pl?location=".uri_escape($url)); }
        $r.='">'.$contents.'</a>';
-       if ($args{"size"} && url_is_local($url) && $url=~/[.](?:gz|rpm|zip|deb)/) {     # Downloadable?
+       if ($args{"size"} && url_is_local($url) && $url=~/[.](?:gz|rpm|zip|deb|lha)/) { # Downloadable?
                if (!-r $url)
                        { cluck "File not readable: $url"; }
                else {