POSTing to / is now possible

This commit is contained in:
qorg11 2020-11-14 22:35:26 +01:00
parent 44c566380c
commit d85e35d0d5
No known key found for this signature in database
GPG key ID: 343FC20A4ACA62B9

View file

@ -19,8 +19,12 @@ my $disk_usage = `df -h | awk 'NR==2 {print \$3; exit}'`;
my $disk_free = `df -h | awk 'NR==2 {print \$4; exit}'`; my $disk_free = `df -h | awk 'NR==2 {print \$4; exit}'`;
my $disk_percentage = `df -h | awk 'NR==2 {print \$5; exit}'`; my $disk_percentage = `df -h | awk 'NR==2 {print \$5; exit}'`;
print "Content-type: text/html\n\n"; if ($ENV{REQUEST_METHOD} eq "POST") {
do "./upload.cgi";
exit;
}
print "Content-type: text/html\n\n";
print "<!DOCTYPE html> print "<!DOCTYPE html>
<html lang=\"en\"> <html lang=\"en\">
<head> <head>
@ -37,9 +41,9 @@ print "<!DOCTYPE html>
<input type='submit' value='upload'> <input type='submit' value='upload'>
</form> </form>
<a href='https://github.com/qorg11/lainsafe'>star me</a> <a href='https://github.com/qorg11/lainsafe'>star me</a>
<h2>Terminal usage</h2>
<p>I recommend using lainsafecli to upload files to lainsafe, however, there is more than one way to do it.</p>
<code>curl -F 'file=@1605388889.png' $ENV{HTTP_HOST}$ENV{REQUEST_URI}</code><br/>
print $disk_free . available from . $disk_size . total;
</body> </body>
</html>"; </html>";
print $disk_free ." available from ". $disk_size ." total";