Add a test suite

This commit is contained in:
Luc Didry 2018-10-24 21:42:45 +02:00
parent a4149b73ba
commit e41b08601d
No known key found for this signature in database
GPG Key ID: EA868E12D0257E3C
24 changed files with 1046 additions and 103 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
local/*
files/*
cover_db/*
lufi.conf
*.db
*.db-shm

126
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,126 @@
image: hatsoftwares/lufi-test-ci:latest
stages:
- podcheck
- carton
- carton_bdd
- tests
before_script:
- rm -f *db
variables:
POSTGRES_DB: lufi_db
POSTGRES_USER: lufi
POSTGRES_PASSWORD: lufi_pwd
MYSQL_DATABASE: lufi_db
MYSQL_USER: lufi
MYSQL_PASSWORD: lufi_pwd
MYSQL_ROOT_PASSWORD: root
### Jobs templates
##
#
.carton_bdd_template: &carton_bdd_definition
stage: carton_bdd
retry: 2
artifacts:
paths:
- local/
expire_in: 1 week
dependencies:
- carton
.sqlite_template: &sqlite_definition
stage: tests
retry: 2
dependencies:
- carton_sqlite
services:
- name: rroemhild/test-openldap
alias: rroemhild-test-openldap
coverage: '/Total.* (\d+\.\d+)$/'
.pg_template: &pg_definition
stage: tests
retry: 2
dependencies:
- carton_postgresql
services:
- name: postgres:9.6
alias: postgres
- name: rroemhild/test-openldap
alias: rroemhild-test-openldap
coverage: '/Total .*(\d+\.\d+)$/'
.mysql_template: &mysql_definition
stage: tests
retry: 2
dependencies:
- carton_mysql
services:
- name: mariadb:10.1
alias: mariadb
- name: rroemhild/test-openldap
alias: rroemhild-test-openldap
coverage: '/Total .*(\d+\.\d+)$/'
### Podcheck
##
#
podcheck:
stage: podcheck
script:
- make podcheck
### Install common dependencies
##
#
carton:
stage: carton
artifacts:
paths:
- local/
expire_in: 1 week
dependencies: []
script:
- carton install --deployment --without=sqlite --without=postgresql
when: always
retry: 2
### Install DB related dependencies
##
#
carton_sqlite:
<<: *carton_bdd_definition
script:
- carton install --deployment --without=postgresql
carton_postgresql:
<<: *carton_bdd_definition
script:
- carton install --deployment --without=sqlite
#carton_mysql:
# <<: *carton_bdd_definition
# script:
# - carton install --deployment --without=sqlite --without=postgresql
### SQLite tests
##
#
sqlite:
<<: *sqlite_definition
script:
- MOJO_CONFIG=t/sqlite.conf make test
- MOJO_CONFIG=t/sqlite.conf make cover
### PostgreSQL tests
##
#
postgresql:
<<: *pg_definition
script:
- MOJO_CONFIG=t/postgresql.conf make test
- MOJO_CONFIG=t/postgresql.conf make cover
### MySQL tests
##
#
#mysql:
# <<: *mysql_definition
# script:
# - MOJO_CONFIG=t/mysql.conf make test
# - MOJO_CONFIG=t/mysql.conf make cover

View File

@ -14,6 +14,7 @@ Revision history for Lufi
- Allow to choose your language
- Use a recurrent task to provision shorts
- Add a command to migrate data from SQLite to an other database
- Add a test suite
0.02.2 2017-09-18
- Fix cron tasks bug

View File

@ -23,11 +23,15 @@ locales:
podcheck:
podchecker lib/Lufi/DB/File.pm lib/Lufi/DB/Slice.pm
cover:
PERL5OPT='-Ilib/' HARNESS_PERL_SWITCHES='-MDevel::Cover' $(CARTON) cover --ignore_re '^local'
test:
$(CARTON) prove -l -f -o t/basic.t
@PERL5OPT='-Ilib/' HARNESS_PERL_SWITCHES='-MDevel::Cover' $(CARTON) prove -l -f -o t/test.t
clean:
rm -rf lufi.db files/
dev: clean
$(CARTON) morbo $(LUFI) --listen http://0.0.0.0:3000 --watch lib/ --watch script/ --watch themes/ --watch lufi.conf

View File

@ -21,6 +21,9 @@ requires 'Crypt::SaltedHash';
requires 'Data::Validate::URI';
requires 'Term::ProgressBar';
feature 'test' => sub {
requires 'Devel::Cover';
};
feature 'ldap', 'LDAP authentication support' => sub {
requires 'Net::LDAP';
requires 'Mojolicious::Plugin::Authentication';

View File

@ -323,6 +323,65 @@ DISTRIBUTIONS
Data::Validate::Domain 0
Data::Validate::IP 0
ExtUtils::MakeMaker 0
Devel-Cover-1.31
pathname: P/PJ/PJCJ/Devel-Cover-1.31.tar.gz
provides:
Devel::Cover 1.31
Devel::Cover::Annotation::Git 1.31
Devel::Cover::Annotation::Random 1.31
Devel::Cover::Annotation::Svk 1.31
Devel::Cover::Branch 1.31
Devel::Cover::Collection 1.31
Devel::Cover::Collection::Template::Provider 1.31
Devel::Cover::Condition 1.31
Devel::Cover::Condition_and_2 1.31
Devel::Cover::Condition_and_3 1.31
Devel::Cover::Condition_or_2 1.31
Devel::Cover::Condition_or_3 1.31
Devel::Cover::Condition_xor_4 1.31
Devel::Cover::Criterion 1.31
Devel::Cover::DB 1.31
Devel::Cover::DB::Criterion 1.31
Devel::Cover::DB::Digests 1.31
Devel::Cover::DB::File 1.31
Devel::Cover::DB::IO 1.31
Devel::Cover::DB::IO::Base 1.31
Devel::Cover::DB::IO::JSON 1.31
Devel::Cover::DB::IO::Sereal 1.31
Devel::Cover::DB::IO::Storable 1.31
Devel::Cover::DB::Run 1.31
Devel::Cover::DB::Structure 1.31
Devel::Cover::Html_Common 1.31
Devel::Cover::Op 1.31
Devel::Cover::Pod 1.31
Devel::Cover::Report::Compilation 1.31
Devel::Cover::Report::Html 1.31
Devel::Cover::Report::Html_basic 1.31
Devel::Cover::Report::Html_basic::Template::Provider 1.31
Devel::Cover::Report::Html_minimal 1.31
Devel::Cover::Report::Html_subtle 1.31
Devel::Cover::Report::Html_subtle::Template::Provider 1.31
Devel::Cover::Report::Json 1.31
Devel::Cover::Report::Sort 1.31
Devel::Cover::Report::Text 1.31
Devel::Cover::Report::Text2 1.31
Devel::Cover::Report::Vim 1.31
Devel::Cover::Report::Vim::Template::Provider 1.31
Devel::Cover::Statement 1.31
Devel::Cover::Subroutine 1.31
Devel::Cover::Test 1.31
Devel::Cover::Time 1.31
Devel::Cover::Truth_Table 1.31
Devel::Cover::Truth_Table::Row 1.31
Devel::Cover::Util 1.31
Devel::Cover::Web 1.31
requirements:
B::Debug 0
Digest::MD5 0
ExtUtils::MakeMaker 0
HTML::Entities 3.69
Storable 0
Test::More 0
Devel-GlobalDestruction-0.14
pathname: H/HA/HAARG/Devel-GlobalDestruction-0.14.tar.gz
provides:

View File

@ -143,7 +143,7 @@ sub startup {
# Logout page
$r->get('/logout')
->to('Auth#logout')
->to('Auth#log_out')
->name('logout');
}

View File

@ -26,7 +26,7 @@ sub login {
}
}
sub logout {
sub log_out {
my $c = shift;
if ($c->is_user_authenticated) {

View File

@ -200,6 +200,13 @@ sub upload {
$c->app->log->debug('Client disconnected');
}
);
} else {
$c->on(
message => sub {
$c->app->log->info(sprintf('Someone unauthenticated tried to upload a file. IP: %s', $c->ip));
$c->finish;
}
);
}
}

View File

@ -431,6 +431,28 @@ sub delete_creator_before {
$c->app->dbi->db->query('UPDATE files SET created_by = NULL WHERE created_by IS NOT NULL AND created_at < ?', $separation);
}
=head2 delete_all
=over 1
=item B<Usage> : C<$c-E<gt>delete_all()>
=item B<Arguments> : none
=item B<Purpose> : delete all file records from database unconditionnally
=item B<Returns> : nothing
=back
=cut
sub delete_all {
my $c = shift;
$c->app->dbi->db->delete('files');
}
=head2 _slurp
=over 1

View File

@ -136,6 +136,28 @@ sub get_slices_of_file {
return c(@slices);
}
=head2 delete_all
=over 1
=item B<Usage> : C<$c-E<gt>delete_all()>
=item B<Arguments> : none
=item B<Purpose> : delete all file records from database unconditionnally
=item B<Returns> : nothing
=back
=cut
sub delete_all {
my $c = shift;
$c->app->dbi->db->delete('slices');
}
=head2 _slurp
=over 1

View File

@ -1,9 +0,0 @@
use Mojo::Base -strict;
use Test::More;
use Test::Mojo;
my $t = Test::Mojo->new('Lufi');
$t->get_ok('/')->status_is(200)->content_like(qr/Lufi/i);
done_testing();

1
t/lufi.passwd Normal file
View File

@ -0,0 +1 @@
luc:$apr1$zG4UAKGa$FqSi4widrkVH/pT3qPawd.

233
t/postgresql.conf Normal file
View File

@ -0,0 +1,233 @@
# vim:set sw=4 ts=4 sts=4 ft=perl expandtab:
{
####################
# Hypnotoad settings
####################
# see http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad for a full list of settings
hypnotoad => {
# array of IP addresses and ports you want to listen to
listen => ['http://127.0.0.1:8081'],
# if you use Lufi behind a reverse proxy like Nginx, you want to set proxy to 1
# if you use Lufi directly, let it commented
#proxy => 1,
# Please read http://mojolicious.org/perldoc/Mojo/Server/Hypnotoad#workers
# to adjust this to your server
workers => 30,
clients => 1,
},
# put a way to contact you here and uncomment it
# you can put some HTML in it
# MANDATORY
contact => '<a href="https://contact.example.com">Contact page</a>',
# 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
#secrets => ['fdjsofjoihrei'],
# choose a theme. See the available themes in `themes` directory
# optional, default is 'default'
#theme => 'default',
# length of the random URL
# optional, default is 8
#length => 8,
# how many URLs will be provisioned in a batch ?
# optional, default is 5
#provis_step => 5,
# max number of URLs to be provisioned
# optional, default is 100
#provisioning => 100,
# length of the modify/delete token
# optional, default is 32
#token_length => 32,
# max file size, in octets
# you can write it 100*1024*1024
# optional, no default
#max_file_size => 104857600,
# if you want to have piwik statistics, provide a piwik image tracker
# only the image tracker is allowed, no javascript
# optional, no default
#piwik_img => 'https://piwik.example.org/piwik.php?idsite=1&amp;rec=1',
# broadcast_message which will displayed on the index page
# optional, no default
#broadcast_message => 'Maintenance',
# default time limit for files
# valid values are 0, 1, 7, 30 and 365
# optional, default is 0 (no limit)
#default_delay => 0,
# number of days after which the images will be deleted, even if they were uploaded with "no delay" (or value superior to max_delay)
# a warning message will be displayed on homepage
# optional, default is 0 (no limit)
#max_delay => 0,
# size thresholds: if you want to define max delays for different sizes of file
# the keys are size in Bytes, you can't have 10*1000*10000 as key
# if a file is smaller than the smallest configured size, it will have a expiration delay of max_delay (see above)
# optional, default is using max_delay (see above) for all sizes
#delay_for_size => {
# 10000000 => 90, # between 10MB and 50MB => max is 90 days, less than 10MB => max is max_delay (see above)
# 50000000 => 60, # between 50MB ans 1GB => max is 60 days
# 1000000000 => 2, # more than 1GB => max is 2 days
#},
# URL sub-directory in which you want Lufi to be accessible
# example: you want to have Lufi under https://example.org/lufi/
# => set prefix to '/lufi' or to '/lufi/', it doesn't matter
# optional, defaut is /
#prefix => '/',
# array of authorized domains for API calls.
# if you want to authorize everyone to use the API: ['*']
# optional, no domains allowed by default
#allowed_domains => ['http://1.example.com', 'http://2.example.com'],
# if set, the shortened URLs will use this domain
# optional
#fixed_domain => 'example.org',
# Mail configuration
# See https://metacpan.org/pod/Mojolicious::Plugin::Mail#EXAMPLES
# Optional, default to sendmail method with no arguments
#mail => {
# # Valid values are 'sendmail' and 'smtp'
# how => 'smtp',
# howargs => ['smtp.example.org']
#},
# Email sender address
# Optional, default to no-reply@lufi.io
#mail_sender => 'no-reply@lufi.io',
# choose what database you want to use
# valid choices are sqlite and postgresql (all lowercase)
# optional, default is sqlite
dbtype => 'postgresql',
# SQLite ONLY - only used if dbtype is set to sqlite
# define a path to the SQLite database
# you can define it relative to lufi directory or set an absolute path
# remember that it has to be in a directory writable by Lufi user
# optional, default is lufi.db
#db_path => 'lufi.db',
# PostgreSQL ONLY - only used if dbtype is set to postgresql
# these are the credentials to access the PostgreSQL database
# mandatory if you choosed postgresql as dbtype
pgdb => {
database => 'lufi_db',
host => 'postgres',
user => 'lufi',
pwd => 'lufi_pwd'
},
# define a path to the upload directory, where the uploaded files will be stored
# you can define it relative to lufi directory or set an absolute path
# remember that it has to be in a directory writable by Lufi user
# DO NOT CHANGE THIS IF FILES HAVE BEEN ALREADY UPLOADED: THEY WILL NOT BE DOWNLOADABLE ANYMORE
# optional, default is 'files'
#upload_dir => 'files',
# set `ldap` if you want that only authenticated users can upload files
# please note that everybody can still download files
# optional, no default
#ldap => { uri => 'ldap://rroemhild-test-openldap', user_tree => 'ou=people,dc=planetexpress,dc=com', bind_dn => 'cn=admin,dc=planetexpress,dc=com', bind_pwd => 'GoodNewsEveryone', user_attr => 'uid', user_filter => '' },
# set `htpasswd` if you want to use an htpasswd file instead of ldap
# see 'man htpasswd' to know how to create such file
#htpasswd => 't/lstu.passwd',
# if you've set ldap above, the session will last `session_duration` seconds before
# the user needs to reauthenticate
# optional, default is 3600
#session_duration => 3600,
# allow to add a password on files, asked before allowing to download files
# optional, default is 0
allow_pwd_on_files => 1,
# force all files to be in "Burn after reading mode"
# optional, default is 0
#force_burn_after_reading => 0,
# if set, the files' URLs will always use this domain
# optional, no default
#fixed_domain => 'example.org',
# abuse reasons
# set an integer in the abuse field of a file in the database and it will not be downloadable anymore
# the reason will be displayed to the downloader, according to the reasons you will configure here.
# optional, no default
abuse => {
0 => 'Copyright infringment',
1 => 'Illegal content',
},
# Content-Security-Policy header that will be sent by Lufi
# Set to '' to disable CSP header
# https://content-security-policy.com/ provides a good documentation about CSP.
# https://report-uri.com/home/generate provides a tool to generate a CSP header.
# optional, default is "base-uri 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; form-action 'self'; frame-ancestors 'none'; img-src 'self' blob:; media-src blob:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'"
# the default value is good for `default` and `milligram` themes
#csp => "base-uri 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; form-action 'self'; frame-ancestors 'none'; img-src 'self' blob:; media-src blob:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'"
# X-Frame-Options header that will be sent by Lufi
# Valid values are: 'DENY', 'SAMEORIGIN', 'ALLOW-FROM https://example.com/'
# Set to '' to disable X-Frame-Options header
# See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
# Please note that this will add a "frame-ancestors" directive to the CSP header (see above) accordingly
# to the chosen setting (See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors)
# optional, default is 'DENY'
#x_frame_options => 'DENY',
# X-Content-Type-Options that will be sent by Lufi
# See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
# Set to '' to disable X-Content-Type-Options header
# optional, default is 'nosniff'
#x_content_type_options => 'nosniff',
# X-XSS-Protection that will be sent by Lufi
# See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
# Set to '' to disable X-XSS-Protection header
# optional, default is '1; mode=block'
#x_xss_protection => '1; mode=block',
#########################
# Lufi cron jobs settings
#########################
# number of days senders' IP addresses are kept in database
# after that delay, they will be deleted from database (used with script/lufi cron cleanbdd)
# optional, default is 365
#keep_ip_during => 365,
# max size of the files directory, in octets
# used by script/lufi cron watch to trigger an action
# optional, no default
#max_total_size => 10*1024*1024*1024,
# default action when files directory is over max_total_size (used with script/lufi cron watch)
# valid values are 'warn', 'stop-upload' and 'delete'
# please, see readme
# optional, default is 'warn'
#policy_when_full => 'warn',
# images which are not viewed since delete_no_longer_viewed_files days will be deleted by the cron cleanfiles task
# if delete_no_longer_viewed_files is not set, the no longer viewed files will NOT be deleted
# optional, no default
#delete_no_longer_viewed_files => 90,
};

233
t/sqlite.conf Normal file
View File

@ -0,0 +1,233 @@
# vim:set sw=4 ts=4 sts=4 ft=perl expandtab:
{
####################
# Hypnotoad settings
####################
# see http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad for a full list of settings
hypnotoad => {
# array of IP addresses and ports you want to listen to
listen => ['http://127.0.0.1:8081'],
# if you use Lufi behind a reverse proxy like Nginx, you want to set proxy to 1
# if you use Lufi directly, let it commented
#proxy => 1,
# Please read http://mojolicious.org/perldoc/Mojo/Server/Hypnotoad#workers
# to adjust this to your server
workers => 30,
clients => 1,
},
# put a way to contact you here and uncomment it
# you can put some HTML in it
# MANDATORY
contact => '<a href="https://contact.example.com">Contact page</a>',
# 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
#secrets => ['fdjsofjoihrei'],
# choose a theme. See the available themes in `themes` directory
# optional, default is 'default'
#theme => 'default',
# length of the random URL
# optional, default is 8
#length => 8,
# how many URLs will be provisioned in a batch ?
# optional, default is 5
#provis_step => 5,
# max number of URLs to be provisioned
# optional, default is 100
#provisioning => 100,
# length of the modify/delete token
# optional, default is 32
#token_length => 32,
# max file size, in octets
# you can write it 100*1024*1024
# optional, no default
#max_file_size => 104857600,
# if you want to have piwik statistics, provide a piwik image tracker
# only the image tracker is allowed, no javascript
# optional, no default
#piwik_img => 'https://piwik.example.org/piwik.php?idsite=1&amp;rec=1',
# broadcast_message which will displayed on the index page
# optional, no default
#broadcast_message => 'Maintenance',
# default time limit for files
# valid values are 0, 1, 7, 30 and 365
# optional, default is 0 (no limit)
#default_delay => 0,
# number of days after which the images will be deleted, even if they were uploaded with "no delay" (or value superior to max_delay)
# a warning message will be displayed on homepage
# optional, default is 0 (no limit)
#max_delay => 0,
# size thresholds: if you want to define max delays for different sizes of file
# the keys are size in Bytes, you can't have 10*1000*10000 as key
# if a file is smaller than the smallest configured size, it will have a expiration delay of max_delay (see above)
# optional, default is using max_delay (see above) for all sizes
#delay_for_size => {
# 10000000 => 90, # between 10MB and 50MB => max is 90 days, less than 10MB => max is max_delay (see above)
# 50000000 => 60, # between 50MB ans 1GB => max is 60 days
# 1000000000 => 2, # more than 1GB => max is 2 days
#},
# URL sub-directory in which you want Lufi to be accessible
# example: you want to have Lufi under https://example.org/lufi/
# => set prefix to '/lufi' or to '/lufi/', it doesn't matter
# optional, defaut is /
#prefix => '/',
# array of authorized domains for API calls.
# if you want to authorize everyone to use the API: ['*']
# optional, no domains allowed by default
#allowed_domains => ['http://1.example.com', 'http://2.example.com'],
# if set, the shortened URLs will use this domain
# optional
#fixed_domain => 'example.org',
# Mail configuration
# See https://metacpan.org/pod/Mojolicious::Plugin::Mail#EXAMPLES
# Optional, default to sendmail method with no arguments
#mail => {
# # Valid values are 'sendmail' and 'smtp'
# how => 'smtp',
# howargs => ['smtp.example.org']
#},
# Email sender address
# Optional, default to no-reply@lufi.io
#mail_sender => 'no-reply@lufi.io',
# choose what database you want to use
# valid choices are sqlite and postgresql (all lowercase)
# optional, default is sqlite
#dbtype => 'sqlite',
# SQLite ONLY - only used if dbtype is set to sqlite
# define a path to the SQLite database
# you can define it relative to lufi directory or set an absolute path
# remember that it has to be in a directory writable by Lufi user
# optional, default is lufi.db
db_path => 'sqlite.db',
# PostgreSQL ONLY - only used if dbtype is set to postgresql
# these are the credentials to access the PostgreSQL database
# mandatory if you choosed postgresql as dbtype
#pgdb => {
# database => 'lufi',
# host => 'localhost',
# #user => 'DBUSER',
# #pwd => 'DBPASSWORD'
#},
# define a path to the upload directory, where the uploaded files will be stored
# you can define it relative to lufi directory or set an absolute path
# remember that it has to be in a directory writable by Lufi user
# DO NOT CHANGE THIS IF FILES HAVE BEEN ALREADY UPLOADED: THEY WILL NOT BE DOWNLOADABLE ANYMORE
# optional, default is 'files'
#upload_dir => 'files',
# set `ldap` if you want that only authenticated users can upload files
# please note that everybody can still download files
# optional, no default
#ldap => { uri => 'ldap://rroemhild-test-openldap', user_tree => 'ou=people,dc=planetexpress,dc=com', bind_dn => 'cn=admin,dc=planetexpress,dc=com', bind_pwd => 'GoodNewsEveryone', user_attr => 'uid', user_filter => '' },
# set `htpasswd` if you want to use an htpasswd file instead of ldap
# see 'man htpasswd' to know how to create such file
#htpasswd => 't/lstu.passwd',
# if you've set ldap above, the session will last `session_duration` seconds before
# the user needs to reauthenticate
# optional, default is 3600
#session_duration => 3600,
# allow to add a password on files, asked before allowing to download files
# optional, default is 0
allow_pwd_on_files => 1,
# force all files to be in "Burn after reading mode"
# optional, default is 0
#force_burn_after_reading => 0,
# if set, the files' URLs will always use this domain
# optional, no default
#fixed_domain => 'example.org',
# abuse reasons
# set an integer in the abuse field of a file in the database and it will not be downloadable anymore
# the reason will be displayed to the downloader, according to the reasons you will configure here.
# optional, no default
abuse => {
0 => 'Copyright infringment',
1 => 'Illegal content',
},
# Content-Security-Policy header that will be sent by Lufi
# Set to '' to disable CSP header
# https://content-security-policy.com/ provides a good documentation about CSP.
# https://report-uri.com/home/generate provides a tool to generate a CSP header.
# optional, default is "base-uri 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; form-action 'self'; frame-ancestors 'none'; img-src 'self' blob:; media-src blob:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'"
# the default value is good for `default` and `milligram` themes
#csp => "base-uri 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; form-action 'self'; frame-ancestors 'none'; img-src 'self' blob:; media-src blob:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'"
# X-Frame-Options header that will be sent by Lufi
# Valid values are: 'DENY', 'SAMEORIGIN', 'ALLOW-FROM https://example.com/'
# Set to '' to disable X-Frame-Options header
# See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
# Please note that this will add a "frame-ancestors" directive to the CSP header (see above) accordingly
# to the chosen setting (See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors)
# optional, default is 'DENY'
#x_frame_options => 'DENY',
# X-Content-Type-Options that will be sent by Lufi
# See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
# Set to '' to disable X-Content-Type-Options header
# optional, default is 'nosniff'
#x_content_type_options => 'nosniff',
# X-XSS-Protection that will be sent by Lufi
# See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
# Set to '' to disable X-XSS-Protection header
# optional, default is '1; mode=block'
#x_xss_protection => '1; mode=block',
#########################
# Lufi cron jobs settings
#########################
# number of days senders' IP addresses are kept in database
# after that delay, they will be deleted from database (used with script/lufi cron cleanbdd)
# optional, default is 365
#keep_ip_during => 365,
# max size of the files directory, in octets
# used by script/lufi cron watch to trigger an action
# optional, no default
#max_total_size => 10*1024*1024*1024,
# default action when files directory is over max_total_size (used with script/lufi cron watch)
# valid values are 'warn', 'stop-upload' and 'delete'
# please, see readme
# optional, default is 'warn'
#policy_when_full => 'warn',
# images which are not viewed since delete_no_longer_viewed_files days will be deleted by the cron cleanfiles task
# if delete_no_longer_viewed_files is not set, the no longer viewed files will NOT be deleted
# optional, no default
#delete_no_longer_viewed_files => 90,
};

237
t/test.t Normal file
View File

@ -0,0 +1,237 @@
# vim:set sw=4 ts=4 sts=4 ft=perl expandtab:
use Mojo::Base -strict;
use Mojo::File;
use Mojo::JSON qw(to_json from_json true);
use Mojolicious;
use Test::More;
use Test::Mojo;
use Lufi::DB::File;
use Lufi::DB::Slice;
use FindBin qw($Bin);
my ($m, $cfile, $config_orig, $config_file, $config_content);
my $msg = to_json {
"total" => 1,
"part" => 0,
"size" => 7,
"name" => "foobar.txt",
"type" => "text/plain",
"delay" => "0",
"del_at_first_view" => 0,
"id" => undef,
"i" => 0
};
my $encrypted = '"{\\"iv\\":\\"2RGAviAeYybBqcLCmnqlgA==\\",\\"v\\":1,\\"iter\\":10000,\\"ks\\":128,\\"ts\\":64,\\"mode\\":\\"ccm\\",\\"adata\\":\\"\\",\\"cipher\\":\\"aes\\",\\"salt\\":\\"1dvKtbZ8hxA=\\",\\"ct\\":\\"w9wDZCwNSyH/yL7q1GW5fPSdi+w=\\"}"';
my $encrypted_rgx = $encrypted;
$encrypted_rgx =~ s@\\@\\\\@g;
$encrypted_rgx =~ s@\+@\\+@g;
$encrypted_rgx =~ s@(\{|\})@\\$1@g;
BEGIN {
use lib 'lib';
$m = Mojolicious->new;
$cfile = Mojo::File->new($Bin, '..', 'lutim.conf');
if (defined $ENV{MOJO_CONFIG}) {
$cfile = Mojo::File->new($ENV{MOJO_CONFIG});
unless (-e $cfile->to_abs) {
$cfile = Mojo::File->new($Bin, '..', $ENV{MOJO_CONFIG});
}
}
my $config = $m->plugin(
'Config' => {
file => $cfile->to_abs->to_string,
default => {
prefix => '/',
provisioning => 100,
provis_step => 5,
length => 10,
token_length => 32,
secrets => ['hfudsifdsih'],
default_delay => 0,
max_delay => 0,
mail => {
how => 'sendmail'
},
mail_sender => 'no-reply@lufi.io',
theme => 'default',
upload_dir => 'files',
session_duration => 3600,
allow_pwd_on_files => 0,
dbtype => 'sqlite',
db_path => 'lufi.db',
force_burn_after_reading => 0,
x_frame_options => 'DENY',
x_content_type_options => 'nosniff',
x_xss_protection => '1; mode=block',
}
}
);
$m->plugin('Lufi::Plugin::Helpers');
$m->plugin('DebugDumperHelper');
} ## end BEGIN
Lufi::DB::Slice->new(app => $m)->delete_all;
Lufi::DB::File->new(app => $m)->delete_all;
my $t = Test::Mojo->new('Lufi');
## Wait for short generation
sleep 3;
## Let's go
$t->get_ok('/')
->status_is(200)
->content_like(qr@Lufi@i);
test_upload_file();
test_download_file();
## Test htpasswd
switch_to_htpasswd();
auth_test_suite('luc', 'toto');
restore_config();
## Test LDAP
switch_to_ldap();
auth_test_suite('zoidberg', 'zoidberg');
restore_config();
done_testing();
######
### Functions
##
sub test_upload_file {
$t->websocket_ok('/upload/')
->send_ok($msg.'XXMOJOXX'.$encrypted)
->message_ok
->message_like(qr@"created_at":\d+@)
->message_like(qr@"del_at_first_view":false@)
->message_like(qr@"delay":"0"@)
->message_like(qr@"duration":0@)
->message_like(qr@"i":0@)
->message_like(qr@"j":0@)
->message_like(qr@"name":"foobar\.txt"@)
->message_like(qr@"parts":1@)
->message_like(qr@"sent_delay":"0"@)
->message_like(qr@"short":"[^"]+"@)
->message_like(qr@"size":7@)
->message_like(qr@"success":true@)
->message_like(qr@"token":"[^"]+"}@)
->finish_ok;
}
sub test_download_file {
my $ws_msg;
$t->ua->websocket_p('/upload/')->then(sub {
my $tx = shift;
my $promise = Mojo::Promise->new;
$tx->on(finish => sub { $promise->resolve });
$tx->on(message => sub {
my $tx = shift;
$ws_msg = shift;
$tx->finish;
});
$tx->send($msg.'XXMOJOXX'.$encrypted);
return $promise;
})->catch(sub {
my $err = shift;
is($err, undef);
})->wait;
$ws_msg = from_json($ws_msg);
$t->websocket_ok('/download/'.$ws_msg->{short})
->send_ok(to_json({part => 0}))
->message_ok
->message_like(qr@"total":1@)
->message_like(qr@"part":0@)
->message_like(qr@"i":0@)
->message_like(qr@"id":null@)
->message_like(qr@"del_at_first_view":0@)
->message_like(qr@"delay":"0"@)
->message_like(qr@"name":"foobar\.txt"@)
->message_like(qr@"size":7@)
->message_like(qr@"type":"text\\/plain"@)
->message_like(qr@XXMOJOXX@)
->message_like(qr@$encrypted_rgx@)
->send_ok(to_json({ended => true}))
->finish_ok;
}
sub auth_test_suite {
my ($login, $pass) = @_;
$t->get_ok('/')
->status_is(302)
->header_is(Location => '/login');
test_fail_upload();
test_login($login, $pass);
test_upload_file();
test_download_file();
$t->get_ok('/logout')
->status_is(200)
->content_like(qr@You have been successfully logged out\.@);
test_fail_upload();
}
sub test_fail_upload {
# An empty message would make it fail if we were allowed to go in the authenticated part
$t->websocket_ok('/upload/')
->send_ok('')
->finish_ok;
}
sub test_login {
my ($login, $pass) = @_;
$t->get_ok('/login')
->status_is(200)
->content_like(qr@Signin@);
$t->post_ok('/login' => form => { login => $login, password => $pass })
->status_is(302)
->header_is(Location => '/');
$t->get_ok('/login')
->status_is(302)
->header_is(Location => '/');
}
sub restore_config {
$config_file->spurt($config_orig);
}
sub switch_to_htpasswd {
$config_file = Mojo::File->new($cfile->to_abs->to_string);
$config_content = $config_file->slurp;
$config_orig = $config_content;
$config_content =~ s/#?htpasswd.*/htpasswd => 't\/lufi.passwd',/gm;
$config_file->spurt($config_content);
Lufi::DB::Slice->new(app => $m)->delete_all;
Lufi::DB::File->new(app => $m)->delete_all;
$t = Test::Mojo->new('Lufi');
## Wait for short generation
sleep 3;
}
sub switch_to_ldap {
$config_content = $config_orig;
$config_content =~ s/^( +)#?ldap => \{ uri/$1ldap => { uri/gm;
$config_file->spurt($config_content);
Lufi::DB::Slice->new(app => $m)->delete_all;
Lufi::DB::File->new(app => $m)->delete_all;
$t = Test::Mojo->new('Lufi');
## Wait for short generation
sleep 3;
}

View File

@ -93,15 +93,15 @@ msgstr "Copia tots els enllaços al porta-retalls"
msgid "Copy to clipboard"
msgstr "Copia al porta-retalls"
#: lib/Lufi/Controller/Files.pm:453
#: lib/Lufi/Controller/Files.pm:460
msgid "Could not delete the file. You are not authenticated."
msgstr "No es pot esborrar el fitxer. No esteu autenticat."
#: lib/Lufi/Controller/Files.pm:435
#: lib/Lufi/Controller/Files.pm:442
msgid "Could not find the file. Are you sure of the URL and the token?"
msgstr "No es troba el fitxer. Esteu segur de la URL i el testimoni?"
#: lib/Lufi/Controller/Files.pm:346
#: lib/Lufi/Controller/Files.pm:353
msgid "Could not find the file. Are you sure of the URL?"
msgstr "No trobo el fitxer. Esteu segurs de la URL?"
@ -161,15 +161,15 @@ msgstr "correus electrònics"
msgid "Encrypting part XX1 of XX2"
msgstr "S'està xifrant la part XX1 de XX2"
#: lib/Lufi/Controller/Files.pm:235
#: lib/Lufi/Controller/Files.pm:242
msgid "Error: the file existed but was deleted."
msgstr "Error: el fitxer existia però va ser eliminat."
#: lib/Lufi/Controller/Files.pm:315
#: lib/Lufi/Controller/Files.pm:322
msgid "Error: the file has not been sent entirely."
msgstr "Error: el fitxer no s'ha enviat del tot."
#: lib/Lufi/Controller/Files.pm:325
#: lib/Lufi/Controller/Files.pm:332
msgid "Error: unable to find the file. Are you sure of your URL?"
msgstr "Error: no trobo el fitxer. Esteu segur de la URL ?"
@ -185,7 +185,7 @@ msgstr "Expira el"
msgid "Export localStorage data"
msgstr "Exporta dades a l'emmagatzematge local"
#: lib/Lufi/Controller/Files.pm:417
#: lib/Lufi/Controller/Files.pm:424
msgid "File deleted"
msgstr "Fitxer eliminat"
@ -383,7 +383,7 @@ msgstr "El cos del correu no pot estar buit."
msgid "The email subject can't be empty."
msgstr "L'assumpte dle correu no pot estar buit."
#: lib/Lufi/Controller/Files.pm:414
#: lib/Lufi/Controller/Files.pm:421
msgid "The file has already been deleted"
msgstr "El fitxer ja ha estat esborrat"
@ -412,7 +412,7 @@ msgstr "L'autor original (i per ara l'únic) és <a href=\"https://fiat-tux.fr\"
msgid "The server was unable to find the file record to add your file part to. Please, contact the administrator."
msgstr "El servidor no ha pogut trobar el registre del fitxer per afegir-hi el tros del fitxer. Si us plau, contacteu l'administrador."
#: lib/Lufi/Controller/Files.pm:241
#: lib/Lufi/Controller/Files.pm:248
msgid "This file has been deactivated by the admins. Contact them to know why."
msgstr ""
@ -425,17 +425,17 @@ msgid "Unable to copy the link(s) to your clipboard"
msgstr "No s'han pogut copiar l'enllaç o els enllaços al porta-retalls."
#. ($short)
#: lib/Lufi/Controller/Files.pm:385
#: lib/Lufi/Controller/Files.pm:392
msgid "Unable to get counter for %1. The file does not exists. It will be removed from your localStorage."
msgstr "No he pogut obtenir el comptador de %1. El fitxer no existeix. Serà eliminat del teu emmagatzematge local."
#. ($short)
#: lib/Lufi/Controller/Files.pm:375
#: lib/Lufi/Controller/Files.pm:382
msgid "Unable to get counter for %1. The token is invalid."
msgstr "No he pogut obtenir el comptador de %1. El testimoni no és vàlid."
#. ($short)
#: lib/Lufi/Controller/Files.pm:395
#: lib/Lufi/Controller/Files.pm:402
msgid "Unable to get counter for %1. You are not authenticated."
msgstr "No he pogut obtenir el comptador de %1. No esteu autenticat."
@ -500,7 +500,7 @@ msgstr ""
msgid "Your file is too big: %1 (maximum size allowed: %2)"
msgstr "El fitxer és massa gran: %1 (mida màxima admesa: %2)"
#: lib/Lufi/Controller/Files.pm:297
#: lib/Lufi/Controller/Files.pm:304
msgid "Your password is not valid. Please refresh the page to retry."
msgstr ""

View File

@ -90,15 +90,15 @@ msgstr ""
msgid "Copy to clipboard"
msgstr ""
#: lib/Lufi/Controller/Files.pm:453
#: lib/Lufi/Controller/Files.pm:460
msgid "Could not delete the file. You are not authenticated."
msgstr ""
#: lib/Lufi/Controller/Files.pm:435
#: lib/Lufi/Controller/Files.pm:442
msgid "Could not find the file. Are you sure of the URL and the token?"
msgstr ""
#: lib/Lufi/Controller/Files.pm:346
#: lib/Lufi/Controller/Files.pm:353
msgid "Could not find the file. Are you sure of the URL?"
msgstr ""
@ -158,15 +158,15 @@ msgstr ""
msgid "Encrypting part XX1 of XX2"
msgstr ""
#: lib/Lufi/Controller/Files.pm:235
#: lib/Lufi/Controller/Files.pm:242
msgid "Error: the file existed but was deleted."
msgstr ""
#: lib/Lufi/Controller/Files.pm:315
#: lib/Lufi/Controller/Files.pm:322
msgid "Error: the file has not been sent entirely."
msgstr ""
#: lib/Lufi/Controller/Files.pm:325
#: lib/Lufi/Controller/Files.pm:332
msgid "Error: unable to find the file. Are you sure of your URL?"
msgstr ""
@ -182,7 +182,7 @@ msgstr ""
msgid "Export localStorage data"
msgstr ""
#: lib/Lufi/Controller/Files.pm:417
#: lib/Lufi/Controller/Files.pm:424
msgid "File deleted"
msgstr ""
@ -377,7 +377,7 @@ msgstr ""
msgid "The email subject can't be empty."
msgstr ""
#: lib/Lufi/Controller/Files.pm:414
#: lib/Lufi/Controller/Files.pm:421
msgid "The file has already been deleted"
msgstr ""
@ -406,7 +406,7 @@ msgstr ""
msgid "The server was unable to find the file record to add your file part to. Please, contact the administrator."
msgstr ""
#: lib/Lufi/Controller/Files.pm:241
#: lib/Lufi/Controller/Files.pm:248
msgid "This file has been deactivated by the admins. Contact them to know why."
msgstr ""
@ -419,17 +419,17 @@ msgid "Unable to copy the link(s) to your clipboard"
msgstr ""
#. ($short)
#: lib/Lufi/Controller/Files.pm:385
#: lib/Lufi/Controller/Files.pm:392
msgid "Unable to get counter for %1. The file does not exists. It will be removed from your localStorage."
msgstr ""
#. ($short)
#: lib/Lufi/Controller/Files.pm:375
#: lib/Lufi/Controller/Files.pm:382
msgid "Unable to get counter for %1. The token is invalid."
msgstr ""
#. ($short)
#: lib/Lufi/Controller/Files.pm:395
#: lib/Lufi/Controller/Files.pm:402
msgid "Unable to get counter for %1. You are not authenticated."
msgstr ""
@ -494,7 +494,7 @@ msgstr ""
msgid "Your file is too big: %1 (maximum size allowed: %2)"
msgstr ""
#: lib/Lufi/Controller/Files.pm:297
#: lib/Lufi/Controller/Files.pm:304
msgid "Your password is not valid. Please refresh the page to retry."
msgstr ""

View File

@ -92,15 +92,15 @@ msgstr "Copier tous les liens dans le presse-papier"
msgid "Copy to clipboard"
msgstr "Copier dans le presse-papier"
#: lib/Lufi/Controller/Files.pm:453
#: lib/Lufi/Controller/Files.pm:460
msgid "Could not delete the file. You are not authenticated."
msgstr "Impossible de supprimer le fichier. Vous nêtes pas connecté·e."
#: lib/Lufi/Controller/Files.pm:435
#: lib/Lufi/Controller/Files.pm:442
msgid "Could not find the file. Are you sure of the URL and the token?"
msgstr "Impossible de retrouver le fichier. Êtes-vous sûr(e) que lURL et le jeton sont les bons ?"
#: lib/Lufi/Controller/Files.pm:346
#: lib/Lufi/Controller/Files.pm:353
msgid "Could not find the file. Are you sure of the URL?"
msgstr "Impossible de retrouver le fichier. Êtes-vous sûr(e) que lURL est la bonne ?"
@ -160,15 +160,15 @@ msgstr "Mails"
msgid "Encrypting part XX1 of XX2"
msgstr "Chiffrement du fragment XX1 sur XX2"
#: lib/Lufi/Controller/Files.pm:235
#: lib/Lufi/Controller/Files.pm:242
msgid "Error: the file existed but was deleted."
msgstr "Erreur : le fichier existait mais a été supprimé"
#: lib/Lufi/Controller/Files.pm:315
#: lib/Lufi/Controller/Files.pm:322
msgid "Error: the file has not been sent entirely."
msgstr "Erreur : le fichier na pas été envoyé dans son intégralité"
#: lib/Lufi/Controller/Files.pm:325
#: lib/Lufi/Controller/Files.pm:332
msgid "Error: unable to find the file. Are you sure of your URL?"
msgstr "Erreur : impossible de retrouver le fichier. Êtes-vous sûr(e) de lURL ?"
@ -184,7 +184,7 @@ msgstr "Expire le"
msgid "Export localStorage data"
msgstr "Exporter les données localStorage"
#: lib/Lufi/Controller/Files.pm:417
#: lib/Lufi/Controller/Files.pm:424
msgid "File deleted"
msgstr "Fichier supprimé"
@ -383,7 +383,7 @@ msgstr "Le corps du mail ne peut être vide."
msgid "The email subject can't be empty."
msgstr "Le sujet du mail ne peut être vide."
#: lib/Lufi/Controller/Files.pm:414
#: lib/Lufi/Controller/Files.pm:421
msgid "The file has already been deleted"
msgstr "Le fichier a déjà été supprimé"
@ -412,7 +412,7 @@ msgstr "Lauteur originel (et pour linstant, le seul) est <a href=\"https:/
msgid "The server was unable to find the file record to add your file part to. Please, contact the administrator."
msgstr "Le serveur a été incapable de retrouver lenregistrement du fichier auquel ajouter votre fragment de fichier. Veuillez contacter ladministrateur."
#: lib/Lufi/Controller/Files.pm:241
#: lib/Lufi/Controller/Files.pm:248
msgid "This file has been deactivated by the admins. Contact them to know why."
msgstr "The fichier a été désactivé par les administrateurs ou administratrices. Veuillez les contacter pour savoir pourquoi."
@ -425,17 +425,17 @@ msgid "Unable to copy the link(s) to your clipboard"
msgstr "Impossible de copier le(s) lien(s) dans votre presse-papier"
#. ($short)
#: lib/Lufi/Controller/Files.pm:385
#: lib/Lufi/Controller/Files.pm:392
msgid "Unable to get counter for %1. The file does not exists. It will be removed from your localStorage."
msgstr "Impossible de récupérer le compteur pour %1. Le fichier nexiste pas. Il va être supprimé de votre localStorage."
#. ($short)
#: lib/Lufi/Controller/Files.pm:375
#: lib/Lufi/Controller/Files.pm:382
msgid "Unable to get counter for %1. The token is invalid."
msgstr "Impossible de récupérer le compteur pour %1. Le jeton est invalide."
#. ($short)
#: lib/Lufi/Controller/Files.pm:395
#: lib/Lufi/Controller/Files.pm:402
msgid "Unable to get counter for %1. You are not authenticated."
msgstr "Impossible de récupérer le compteur pour %1. Vous nêtes pas connecté·e."
@ -500,7 +500,7 @@ msgstr "Votre navigateur na pas assez dentropie pour générer une clé de
msgid "Your file is too big: %1 (maximum size allowed: %2)"
msgstr "Votre fichier est trop volumineux : %1 (la taille maximum autorisée est %2)"
#: lib/Lufi/Controller/Files.pm:297
#: lib/Lufi/Controller/Files.pm:304
msgid "Your password is not valid. Please refresh the page to retry."
msgstr "Votre mot de passe est invalide. Veuillez rafraîchir la page pour réessayer."

View File

@ -92,15 +92,15 @@ msgstr "Copiare tutti i link negli appunti"
msgid "Copy to clipboard"
msgstr "Copiare negli appunti"
#: lib/Lufi/Controller/Files.pm:453
#: lib/Lufi/Controller/Files.pm:460
msgid "Could not delete the file. You are not authenticated."
msgstr "Impossibile cancellare il file. Non siete autenticati."
#: lib/Lufi/Controller/Files.pm:435
#: lib/Lufi/Controller/Files.pm:442
msgid "Could not find the file. Are you sure of the URL and the token?"
msgstr "Impossibile trovare il file. Sei sicuro che URL e token siano corretti ?"
#: lib/Lufi/Controller/Files.pm:346
#: lib/Lufi/Controller/Files.pm:353
msgid "Could not find the file. Are you sure of the URL?"
msgstr "Impossibile trovare il file. Sei sicuro che l'URL sia corretto?"
@ -160,15 +160,15 @@ msgstr "Email"
msgid "Encrypting part XX1 of XX2"
msgstr "Cifratura della parte XX1 di XX2"
#: lib/Lufi/Controller/Files.pm:235
#: lib/Lufi/Controller/Files.pm:242
msgid "Error: the file existed but was deleted."
msgstr "Errore: il file esisteva ma è stato eliminato"
#: lib/Lufi/Controller/Files.pm:315
#: lib/Lufi/Controller/Files.pm:322
msgid "Error: the file has not been sent entirely."
msgstr "Errore: il file non è stato inviato completamente"
#: lib/Lufi/Controller/Files.pm:325
#: lib/Lufi/Controller/Files.pm:332
msgid "Error: unable to find the file. Are you sure of your URL?"
msgstr "Errore: impossibile trovare il file. Sei certo dell'URL ?"
@ -184,7 +184,7 @@ msgstr "Scadrà il"
msgid "Export localStorage data"
msgstr "Esportare i dati del localStorage"
#: lib/Lufi/Controller/Files.pm:417
#: lib/Lufi/Controller/Files.pm:424
msgid "File deleted"
msgstr "File cancellato"
@ -387,7 +387,7 @@ msgstr "Il corpo dell'email non può essere vuoto."
msgid "The email subject can't be empty."
msgstr "Il soggetto dell'email non può essere vuoto."
#: lib/Lufi/Controller/Files.pm:414
#: lib/Lufi/Controller/Files.pm:421
msgid "The file has already been deleted"
msgstr "Il file è già stato cancellato"
@ -416,7 +416,7 @@ msgstr "L'autore ( e per ora l'unico) è <a href=\"https://fiat-tux.fr\" class=\
msgid "The server was unable to find the file record to add your file part to. Please, contact the administrator."
msgstr "Il server non è stato in grado di trovare il file record a cui aggiungere la vostra porzione di file. Prego contattare l'amministratore."
#: lib/Lufi/Controller/Files.pm:241
#: lib/Lufi/Controller/Files.pm:248
msgid "This file has been deactivated by the admins. Contact them to know why."
msgstr ""
@ -429,17 +429,17 @@ msgid "Unable to copy the link(s) to your clipboard"
msgstr "Impossibile copiare i link negli appunti"
#. ($short)
#: lib/Lufi/Controller/Files.pm:385
#: lib/Lufi/Controller/Files.pm:392
msgid "Unable to get counter for %1. The file does not exists. It will be removed from your localStorage."
msgstr "Impossibile recuperare il contatore per %1. Il file non esiste. Il file sarà eliminato dal tuo localStorage."
#. ($short)
#: lib/Lufi/Controller/Files.pm:375
#: lib/Lufi/Controller/Files.pm:382
msgid "Unable to get counter for %1. The token is invalid."
msgstr "Impossibile recuperare il contatore per %1. Il token non è valido."
#. ($short)
#: lib/Lufi/Controller/Files.pm:395
#: lib/Lufi/Controller/Files.pm:402
msgid "Unable to get counter for %1. You are not authenticated."
msgstr "Impossibile recuperare il contatore per %1. Non sei autenticato."
@ -504,7 +504,7 @@ msgstr ""
msgid "Your file is too big: %1 (maximum size allowed: %2)"
msgstr "Il vostro file è troppo grande : %1 (la dimensione massima permessa è %2)"
#: lib/Lufi/Controller/Files.pm:297
#: lib/Lufi/Controller/Files.pm:304
msgid "Your password is not valid. Please refresh the page to retry."
msgstr ""

View File

@ -79,15 +79,15 @@ msgstr "Kopieer alle links naar klembord"
msgid "Copy to clipboard"
msgstr "Kopieer naar klembord"
#: lib/Lufi/Controller/Files.pm:453
#: lib/Lufi/Controller/Files.pm:460
msgid "Could not delete the file. You are not authenticated."
msgstr "Kan het bestand niet verwijderen. Je bent niet geautoriseerd."
#: lib/Lufi/Controller/Files.pm:435
#: lib/Lufi/Controller/Files.pm:442
msgid "Could not find the file. Are you sure of the URL and the token?"
msgstr "Kan het bestand niet vinden. Klopt de URL en token wel?"
#: lib/Lufi/Controller/Files.pm:346
#: lib/Lufi/Controller/Files.pm:353
msgid "Could not find the file. Are you sure of the URL?"
msgstr "Kan het bestand niet vinden. Klopt de URL?"
@ -147,15 +147,15 @@ msgstr "Emails"
msgid "Encrypting part XX1 of XX2"
msgstr "Encrypten deel XX1 van XX2 "
#: lib/Lufi/Controller/Files.pm:235
#: lib/Lufi/Controller/Files.pm:242
msgid "Error: the file existed but was deleted."
msgstr "Fout: het bestand bestond wel maar is verwijderd."
#: lib/Lufi/Controller/Files.pm:315
#: lib/Lufi/Controller/Files.pm:322
msgid "Error: the file has not been sent entirely."
msgstr "Fout: het bestand is niet volledig opgestuurd."
#: lib/Lufi/Controller/Files.pm:325
#: lib/Lufi/Controller/Files.pm:332
msgid "Error: unable to find the file. Are you sure of your URL?"
msgstr "Fout: kan het bestand niet vinden. Is de URL juist?"
@ -171,7 +171,7 @@ msgstr "Vervalt op"
msgid "Export localStorage data"
msgstr "Exporteer opgeslagen data"
#: lib/Lufi/Controller/Files.pm:417
#: lib/Lufi/Controller/Files.pm:424
msgid "File deleted"
msgstr "Bestand verwijderd"
@ -370,7 +370,7 @@ msgstr "Mail inhoud kan niet leeg zijn."
msgid "The email subject can't be empty."
msgstr "Onderwerp kan niet leeg zijn."
#: lib/Lufi/Controller/Files.pm:414
#: lib/Lufi/Controller/Files.pm:421
msgid "The file has already been deleted"
msgstr "Bestand is reeds verwijderd"
@ -399,7 +399,7 @@ msgstr "De oorspronkelijke auteur is <a href=\"https://fiat-tux.fr\" class=\"cla
msgid "The server was unable to find the file record to add your file part to. Please, contact the administrator."
msgstr "Server kon een deel van het bestand niet vinden. Neem contact op met beheerder."
#: lib/Lufi/Controller/Files.pm:241
#: lib/Lufi/Controller/Files.pm:248
msgid "This file has been deactivated by the admins. Contact them to know why."
msgstr ""
@ -412,17 +412,17 @@ msgid "Unable to copy the link(s) to your clipboard"
msgstr "Kan de link(s) niet naar je klembord kopieeren"
#. ($short)
#: lib/Lufi/Controller/Files.pm:385
#: lib/Lufi/Controller/Files.pm:392
msgid "Unable to get counter for %1. The file does not exists. It will be removed from your localStorage."
msgstr "Kan geen teller verkrijgen voor %1. Bestand bestaat niet. Het zal verwijderd worden van opgeslagen data."
#. ($short)
#: lib/Lufi/Controller/Files.pm:375
#: lib/Lufi/Controller/Files.pm:382
msgid "Unable to get counter for %1. The token is invalid."
msgstr "Kan geen teller verkrijgen voor %1. De token is ongeldig."
#. ($short)
#: lib/Lufi/Controller/Files.pm:395
#: lib/Lufi/Controller/Files.pm:402
msgid "Unable to get counter for %1. You are not authenticated."
msgstr "Kan geen teller verkrijgen voor %1. Je bent niet geauthenticeerd."
@ -487,7 +487,7 @@ msgstr ""
msgid "Your file is too big: %1 (maximum size allowed: %2)"
msgstr "Je bestand is te groot: %1 (max: %2)"
#: lib/Lufi/Controller/Files.pm:297
#: lib/Lufi/Controller/Files.pm:304
msgid "Your password is not valid. Please refresh the page to retry."
msgstr ""

View File

@ -92,15 +92,15 @@ msgstr "Copiar totes los ligams al quicha-papièrs"
msgid "Copy to clipboard"
msgstr "Copiar al quicha-papièrs"
#: lib/Lufi/Controller/Files.pm:453
#: lib/Lufi/Controller/Files.pm:460
msgid "Could not delete the file. You are not authenticated."
msgstr "Impossible de suprimir lo fichièr. Sètz pas connectat-ada."
#: lib/Lufi/Controller/Files.pm:435
#: lib/Lufi/Controller/Files.pm:442
msgid "Could not find the file. Are you sure of the URL and the token?"
msgstr "Impossible de trobar lo fichièr. Sètz segur-a que lURL e lo geton son bons?"
#: lib/Lufi/Controller/Files.pm:346
#: lib/Lufi/Controller/Files.pm:353
msgid "Could not find the file. Are you sure of the URL?"
msgstr "Impossible de trobar lo fichièr. Sètz segur-a que lURL es bona?"
@ -160,15 +160,15 @@ msgstr "Corrièl"
msgid "Encrypting part XX1 of XX2"
msgstr "Chiframent del tròç XX1 sus XX2"
#: lib/Lufi/Controller/Files.pm:235
#: lib/Lufi/Controller/Files.pm:242
msgid "Error: the file existed but was deleted."
msgstr "Error:lo fichièr existissiá mas es estat suprimit"
#: lib/Lufi/Controller/Files.pm:315
#: lib/Lufi/Controller/Files.pm:322
msgid "Error: the file has not been sent entirely."
msgstr "Error:lo fichièr es pas estat mandat completament"
#: lib/Lufi/Controller/Files.pm:325
#: lib/Lufi/Controller/Files.pm:332
msgid "Error: unable to find the file. Are you sure of your URL?"
msgstr "Error:impossible de trobar lo fichièr. Sètz segur-a de lURL?"
@ -184,7 +184,7 @@ msgstr "Expira lo"
msgid "Export localStorage data"
msgstr "Exportar las donadas localStorage"
#: lib/Lufi/Controller/Files.pm:417
#: lib/Lufi/Controller/Files.pm:424
msgid "File deleted"
msgstr "Fichièr suprimit"
@ -387,7 +387,7 @@ msgstr "Lo contengut del corrièl pòt pas èsser void."
msgid "The email subject can't be empty."
msgstr "Lo sujècte del corrièl pòt pas èsser void."
#: lib/Lufi/Controller/Files.pm:414
#: lib/Lufi/Controller/Files.pm:421
msgid "The file has already been deleted"
msgstr "Lo fichièr es ja estat suprimit"
@ -416,7 +416,7 @@ msgstr "Lautor original (e pel moment, lo sol) es <a href=\"https://fiat-tux.
msgid "The server was unable to find the file record to add your file part to. Please, contact the administrator."
msgstr "Lo servidor es pas estat capable de retrobar lenregistrament del fichièr que li cal ajustar vòstre tròç de fichièr. Mercés de contactar ladministrator."
#: lib/Lufi/Controller/Files.pm:241
#: lib/Lufi/Controller/Files.pm:248
msgid "This file has been deactivated by the admins. Contact them to know why."
msgstr ""
@ -429,17 +429,17 @@ msgid "Unable to copy the link(s) to your clipboard"
msgstr "Impossible de copiar lo(s) ligams(s) dins vòstre quicha-papièrs"
#. ($short)
#: lib/Lufi/Controller/Files.pm:385
#: lib/Lufi/Controller/Files.pm:392
msgid "Unable to get counter for %1. The file does not exists. It will be removed from your localStorage."
msgstr "Impossible de recuperar lo comptador per %1. Lo fichièr existís pas. Serà levat de vòstre localStorage."
#. ($short)
#: lib/Lufi/Controller/Files.pm:375
#: lib/Lufi/Controller/Files.pm:382
msgid "Unable to get counter for %1. The token is invalid."
msgstr "Impossible de recuperar lo comptador per %1. Lo geton es invalid."
#. ($short)
#: lib/Lufi/Controller/Files.pm:395
#: lib/Lufi/Controller/Files.pm:402
msgid "Unable to get counter for %1. You are not authenticated."
msgstr "Impossible de recuperar lo comptador per %1. Sètz pas connectat·ada."
@ -504,7 +504,7 @@ msgstr ""
msgid "Your file is too big: %1 (maximum size allowed: %2)"
msgstr "Vòstre fichièr es tròp voluminós:%1 (la talha maximum autorizada es %2)"
#: lib/Lufi/Controller/Files.pm:297
#: lib/Lufi/Controller/Files.pm:304
msgid "Your password is not valid. Please refresh the page to retry."
msgstr "Lo senhal es pas valid. Mercés dactualizar la pagina e ensajar tornamai."

View File

@ -93,15 +93,15 @@ msgstr "Copiar todos os links para a área de transferência"
msgid "Copy to clipboard"
msgstr "Copiar para a área de transferência"
#: lib/Lufi/Controller/Files.pm:453
#: lib/Lufi/Controller/Files.pm:460
msgid "Could not delete the file. You are not authenticated."
msgstr "Impossível apagar o ficheiro. Não está conectado."
#: lib/Lufi/Controller/Files.pm:435
#: lib/Lufi/Controller/Files.pm:442
msgid "Could not find the file. Are you sure of the URL and the token?"
msgstr "Impossível encontrar o ficheiro.Tem a certeza que o URL e os símbolos estão corretos?"
#: lib/Lufi/Controller/Files.pm:346
#: lib/Lufi/Controller/Files.pm:353
msgid "Could not find the file. Are you sure of the URL?"
msgstr "Impossível encontar o ficheiro. Tem a certeza de que o URL está correto?"
@ -165,15 +165,15 @@ msgstr "E-mails"
msgid "Encrypting part XX1 of XX2"
msgstr "Codificação do fragmento XX1 de XX2"
#: lib/Lufi/Controller/Files.pm:235
#: lib/Lufi/Controller/Files.pm:242
msgid "Error: the file existed but was deleted."
msgstr "Erro: o ficheiro existia mas foi apagado."
#: lib/Lufi/Controller/Files.pm:315
#: lib/Lufi/Controller/Files.pm:322
msgid "Error: the file has not been sent entirely."
msgstr "Erro: o ficheiro não foi enviado na totalidade."
#: lib/Lufi/Controller/Files.pm:325
#: lib/Lufi/Controller/Files.pm:332
msgid "Error: unable to find the file. Are you sure of your URL?"
msgstr "Erro: impossível encontrar o ficheiro. Tem a certeza do URL?"
@ -189,7 +189,7 @@ msgstr "Expira no"
msgid "Export localStorage data"
msgstr "Exportar os dados localStorage"
#: lib/Lufi/Controller/Files.pm:417
#: lib/Lufi/Controller/Files.pm:424
msgid "File deleted"
msgstr "Ficheiro apagado"
@ -388,7 +388,7 @@ msgstr "A mensagem do e-mail não pode estar vazia."
msgid "The email subject can't be empty."
msgstr "O assunto do e-mail não pode estar vazio."
#: lib/Lufi/Controller/Files.pm:414
#: lib/Lufi/Controller/Files.pm:421
msgid "The file has already been deleted"
msgstr "O ficheiro já foi apagado"
@ -417,7 +417,7 @@ msgstr "O autor original (e por agora, o único) é <a href=\"https://fiat-tux.f
msgid "The server was unable to find the file record to add your file part to. Please, contact the administrator."
msgstr "O servidor foi incapaz de encontrar o registo do ficheiro no qual devia-se juntar o fragmento do seu ficheiro. Contacte o administrador."
#: lib/Lufi/Controller/Files.pm:241
#: lib/Lufi/Controller/Files.pm:248
msgid "This file has been deactivated by the admins. Contact them to know why."
msgstr ""
@ -430,17 +430,17 @@ msgid "Unable to copy the link(s) to your clipboard"
msgstr "Impossível copiar o(s) link(s) na sua área de transferência"
#. ($short)
#: lib/Lufi/Controller/Files.pm:385
#: lib/Lufi/Controller/Files.pm:392
msgid "Unable to get counter for %1. The file does not exists. It will be removed from your localStorage."
msgstr "Impossível recuperar o contador para %1. O ficheiro não existe. Isso vai apagar a sua localStorage."
#. ($short)
#: lib/Lufi/Controller/Files.pm:375
#: lib/Lufi/Controller/Files.pm:382
msgid "Unable to get counter for %1. The token is invalid."
msgstr "Impossível recuperar o contador para %1. O símbolo é inválido."
#. ($short)
#: lib/Lufi/Controller/Files.pm:395
#: lib/Lufi/Controller/Files.pm:402
msgid "Unable to get counter for %1. You are not authenticated."
msgstr "Impossível recuperar o contador para %1. Não está conectado."
@ -509,7 +509,7 @@ msgstr ""
msgid "Your file is too big: %1 (maximum size allowed: %2)"
msgstr "O seu ficheiro é grande de mais: %1 (o tamanho máximo autorizado é de %2)"
#: lib/Lufi/Controller/Files.pm:297
#: lib/Lufi/Controller/Files.pm:304
msgid "Your password is not valid. Please refresh the page to retry."
msgstr ""

View File

@ -195,7 +195,9 @@ function sliceAndUpload(randomkey, i, parts, j, delay, del_at_first_view, short)
// Prepare json
var data = {
// number of parts
total: parts,
// part X of total
part: j,
size: file.size,
name: file.name,
@ -203,6 +205,7 @@ function sliceAndUpload(randomkey, i, parts, j, delay, del_at_first_view, short)
delay: delay,
del_at_first_view: del_at_first_view,
id: short,
// number of the sent file in the queue
i: i
};
if ($('#file_pwd').length === 1) {