From 377a48bda262831f79fa7a380f52124f259572e3 Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Oct 22 2018 19:21:11 +0000 Subject: Add report file link in the navbar --- diff --git a/CHANGELOG b/CHANGELOG index 1b0c0e8..7bd6ec8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,7 @@ Revision history for Lufi - Add Content-Security-Policy header - Update sjcl.js - Mitigate genRandomKey exception risk + - Add report file link in the navbar 0.02.2 2017-09-18 - Fix cron tasks bug diff --git a/cpanfile b/cpanfile index c437532..e5b8559 100644 --- a/cpanfile +++ b/cpanfile @@ -18,6 +18,7 @@ requires 'Number::Bytes::Human'; requires 'Filesys::DfPortable'; requires 'Data::Entropy'; requires 'Crypt::SaltedHash'; +requires 'Data::Validate::URI'; feature 'ldap', 'LDAP authentication support' => sub { requires 'Net::LDAP'; diff --git a/cpanfile.snapshot b/cpanfile.snapshot index 25e52b4..9808c67 100644 --- a/cpanfile.snapshot +++ b/cpanfile.snapshot @@ -265,6 +265,37 @@ DISTRIBUTIONS perl 5.006 strict 0 warnings 0 + Data-Validate-Domain-0.14 + pathname: D/DR/DROLSKY/Data-Validate-Domain-0.14.tar.gz + provides: + Data::Validate::Domain 0.14 + requirements: + Exporter 0 + ExtUtils::MakeMaker 0 + Net::Domain::TLD 1.74 + strict 0 + warnings 0 + Data-Validate-IP-0.27 + pathname: D/DR/DROLSKY/Data-Validate-IP-0.27.tar.gz + provides: + Data::Validate::IP 0.27 + requirements: + Exporter 0 + ExtUtils::MakeMaker 0 + NetAddr::IP 4 + Scalar::Util 0 + base 0 + perl 5.008 + strict 0 + warnings 0 + Data-Validate-URI-0.07 + pathname: S/SO/SONNEN/Data-Validate-URI-0.07.tar.gz + provides: + Data::Validate::URI 0.07 + requirements: + Data::Validate::Domain 0 + Data::Validate::IP 0 + ExtUtils::MakeMaker 0 Devel-GlobalDestruction-0.14 pathname: H/HA/HAARG/Devel-GlobalDestruction-0.14.tar.gz provides: @@ -1236,6 +1267,14 @@ DISTRIBUTIONS Test::More 0.52 Time::Local 1.19 perl 5.006 + Net-Domain-TLD-1.75 + pathname: A/AL/ALEXP/Net-Domain-TLD-1.75.tar.gz + provides: + Net::Domain::TLD 1.75 + requirements: + Carp 0 + ExtUtils::MakeMaker 0 + Storable 0 Net-HTTP-6.18 pathname: O/OA/OALDERS/Net-HTTP-6.18.tar.gz provides: @@ -1265,6 +1304,19 @@ DISTRIBUTIONS MIME::Base64 0 Test::More 0.60_01 perl 5.005 + NetAddr-IP-4.079 + pathname: M/MI/MIKER/NetAddr-IP-4.079.tar.gz + provides: + NetAddr::IP 4.079 + NetAddr::IP::InetBase 0.08 + NetAddr::IP::Lite 1.57 + NetAddr::IP::Util 1.53 + NetAddr::IP::UtilPP 1.09 + NetAddr::IP::UtilPolluted 1.53 + NetAddr::IP::Util_IS 1 + requirements: + ExtUtils::MakeMaker 0 + Test::More 0 Number-Bytes-Human-0.11 pathname: F/FE/FERREIRA/Number-Bytes-Human-0.11.tar.gz provides: diff --git a/lib/Lufi.pm b/lib/Lufi.pm index 5f47c7f..eaa0db0 100644 --- a/lib/Lufi.pm +++ b/lib/Lufi.pm @@ -4,6 +4,8 @@ use Mojo::Base 'Mojolicious'; use Net::LDAP; use Apache::Htpasswd; use Mojolicious::Sessions; +use Email::Valid; +use Data::Validate::URI qw(is_web_uri); $ENV{MOJO_MAX_WEBSOCKET_SIZE} = 100485760; # 10 * 1024 * 1024 = 10MiB @@ -38,7 +40,15 @@ sub startup { } }); - die "You need to provide a contact information in lufi.conf!" unless (defined($self->config('contact'))); + die 'You need to provide a contact information in lufi.conf!' unless (defined($self->config('contact'))); + die 'You need to provide a **report** information in lufi.conf!' unless (defined($self->config('report'))); + + if (Email::Valid->address($self->config('report'))) { + $self->config('report' => 'mailto:'.$self->config('report')); + } elsif (!is_web_uri($self->config('report'))) { + die 'You need to provide an email address or an URL as report information in lufi.conf!'; + } + # Themes handling shift @{$self->renderer->paths}; diff --git a/lufi.conf.template b/lufi.conf.template index 3ff1a97..0136e1b 100644 --- a/lufi.conf.template +++ b/lufi.conf.template @@ -18,8 +18,14 @@ }, # put a way to contact you here and uncomment it + # you can put some HTML in it # MANDATORY - #contact => 'admin[at]example.com', + #contact => 'Contact page', + + # put an URL or an email address to receive file reports and uncomment it + # it's for make reporting illegal files easy for users + # MANDATORY + #report => 'report@example.com', # array of random strings used to encrypt cookies # optional, default is ['fdjsofjoihrei'], PLEASE, CHANGE IT diff --git a/themes/default/lib/Lufi/I18N/ca.po b/themes/default/lib/Lufi/I18N/ca.po index 74437fd..7a35c95 100644 --- a/themes/default/lib/Lufi/I18N/ca.po +++ b/themes/default/lib/Lufi/I18N/ca.po @@ -44,7 +44,7 @@ msgstr "Un agraïment amb la foto d'un gatet a <%= l('Drag and drop files in the appropriate area or use the traditional way to send files and the files will be chunked, encrypted and sent to the server. You will get two links per file: a download link, that you give to the people you want to share the file with and a deletion link, allowing you to delete the file whenever you want.') %>

<%= l('You can see the list of your files by clicking on the "My files" link at the top right of this page.') %>

<%= l('How to report an illegal file?') %>

-

<%= l('Please contact the administrator: %1', config('contact')) %>

+

<%== l('Please contact the administrator: %1', config('contact')) %>

<%= l('Who wrote this software?') %>

<%== l('The original (and only for now) author is Luc Didry. If you want to support him, you can do it via Tipeee or via Liberapay.') %>
<%== l('A thank you with a photo of kitten on Diaspora* or Mastodon is cool too ;-)') %>

diff --git a/themes/default/templates/layouts/default.html.ep b/themes/default/templates/layouts/default.html.ep index e293b75..fb0c2fa 100644 --- a/themes/default/templates/layouts/default.html.ep +++ b/themes/default/templates/layouts/default.html.ep @@ -26,6 +26,7 @@