From b6e32c25a55b68e8b883c36b9f29e93db13b58dc Mon Sep 17 00:00:00 2001 From: Kyle Czar Date: Sun, 30 Aug 2020 13:08:36 -0300 Subject: [PATCH] Url formatting is handled by the server --- http/upload.cgi | 8 ++++++-- lainsafecli | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/http/upload.cgi b/http/upload.cgi index 45ac070..90a7000 100755 --- a/http/upload.cgi +++ b/http/upload.cgi @@ -54,6 +54,10 @@ $string =~ s/\.//g; my $upload_filehandle = $q->upload("file"); +# onion urls will be http +my $prot = length $ENV{HTTPS} ? "https" : "http"; + + $filename = $string . "." . $extension; my $allowed_extension = 1; @@ -77,10 +81,10 @@ if($allowed_extension) { print FILE; } - + close FILE; - print $ENV{HTTP_REFERER} . "$upload_dir$filename"; + print $prot. "://" . $ENV{HTTP_HOST} . "$upload_dir$filename"; } else diff --git a/lainsafecli b/lainsafecli index 7caeb87..606a258 100755 --- a/lainsafecli +++ b/lainsafecli @@ -126,10 +126,10 @@ if ($req->{_content} =~ /instance/) # If someone knows how to do it another way, print $req->{_content} . "\n"; exit; } -print $DEFAULT_SERVER . "/" . $req->{_content} . "\n"; +print $req->{_content} . "\n"; if ($STORE_LINKS) { open FILE,'>>',$LINKS_FILE or die $!; - print FILE $DEFAULT_SERVER . "/" . $req->{_content} . " $file" ."\n"; + print FILE $req->{_content} . " $file" ."\n"; close FILE; }