diff --git a/http/index.cgi b/http/index.cgi index ec2d208..ef676c8 100755 --- a/http/index.cgi +++ b/http/index.cgi @@ -14,35 +14,15 @@ # You should have received a copy of the GNU General Public License # along with lainsafe. If not, see . -my $disk_size = `df -h | awk 'NR==2 {print \$2; exit}'`; -my $disk_usage = `df -h | awk 'NR==2 {print \$3; exit}'`; -my $disk_free = `df -h | awk 'NR==2 {print \$4; exit}'`; -my $disk_percentage = `df -h | awk 'NR==2 {print \$5; exit}'`; - if ($ENV{REQUEST_METHOD} eq "POST") { do "./upload.cgi"; exit; } +my $SITE_URL = $ENV{REMOTE_ADDR}; + print "Content-type: text/html\n\n"; -print " - - - lainsafe - - -

lainsafe

+open(my $fh, " -
- - -
- star me -

Terminal usage

-

I recommend using clainsafecli to upload files to lainsafe, however, there is more than one way to do it.

- curl -F 'file=@1605388889.png' $ENV{HTTP_HOST}$ENV{REQUEST_URI}
- - "; +print while <$fh>; diff --git a/http/index.css b/http/index.css new file mode 100644 index 0000000..ea30843 --- /dev/null +++ b/http/index.css @@ -0,0 +1,38 @@ +p { + color: white; + display: block; +} + +/* p code {display: block;} */ + +code { + background: #4e4e4e; + font-family: monospace; + color: #e3e3e3; + margin: 30px; +} + +body, input, select, textarea { + color: #333; + font-size: 10pt; + line-height: 1.65em; + letter-spacing: -0.015em; +} + +body { + background:#040304; +} + +h1, h2 { + color: #e3e3e3; +} +.left { + position: absolute; + top: 0; + right: 30px; + border-left-color: #333; + border-left-width: 2px; + border-left-style: solid; + padding: 10px; + +} diff --git a/http/index.html b/http/index.html new file mode 100644 index 0000000..d23bd87 --- /dev/null +++ b/http/index.html @@ -0,0 +1,27 @@ + + + + lainsafe + + + + +

lainsafe

+

shitless file upload, pastebin and url shorter

+ +

USAGE

+

POST a file:

+ curl -F 'file=@yourfile.png' $SITE_URL +

Shorten URL:

+ curl -F 'url=https://example.org' $SITE_URL +

Post your text directly

+ curl -F 'file=@-' $SITE_URL +
+

Or just upload a file here

+
+ + +
+
+ + diff --git a/http/upload.cgi b/http/upload.cgi index 4078236..4d37150 100755 --- a/http/upload.cgi +++ b/http/upload.cgi @@ -16,7 +16,7 @@ use CGI; use CGI::Carp qw(fatalsToBrowser); -use Time::HiRes qw(gettimeofday); + my $q = CGI->new; my $filename = $q->param('file'); @@ -74,8 +74,8 @@ if ($filename) { } } - if($filename eq "-") { - $filename .= ".txt"; # for pastes + if ($filename eq "-") { + $filename .= ".txt"; # for pastes } if ($allowed_extension) { @@ -88,7 +88,7 @@ if ($filename) { close FILE; $filename =~ s/ /%20/g; - print $prot. "://" . $ENV{HTTP_HOST} . "/$upload_dir$dirname/$filename"; + print $prot. "://" . $ENV{HTTP_HOST} . "/$upload_dir$dirname/$filename" . "\n"; } else { print "The file extension .$extension is not allowed in this instance."; }