Commit f94ae434 authored by Luc Didry's avatar Luc Didry Committed by Luc Didry
Browse files

Fix #13

parent 4feff526
......@@ -16,7 +16,7 @@ test:
clean:
rm -rf lufi.db files/
dev: clean
$(CARTON) morbo $(LUFI) --listen http://0.0.0.0:3000 --watch lib/ --watch script/ --watch themes/
$(CARTON) morbo $(LUFI) --listen http://0.0.0.0:3000 --watch lib/ --watch script/ --watch themes/ --watch lufi.conf
devlog:
multitail log/development.log
......
......@@ -23,6 +23,7 @@ sub startup {
},
mail_sender => 'no-reply@lufi.io',
theme => 'default',
upload_dir => 'files',
}
});
......@@ -170,7 +171,8 @@ sub startup {
$self->provisioning();
# Create directory if needed
mkdir('files', 0700) unless (-d 'files');
mkdir($self->config('upload_dir'), 0700) unless (-d $self->config('upload_dir'));
die ('The upload directory ('.$self->config('upload_dir').') is not writable') unless (-w $self->config('upload_dir'));
# Default layout
$self->defaults(layout => 'default');
......
......@@ -44,7 +44,7 @@ sub upload {
}
}
# Check that we have enough space (multiplying by 2 since it's encrypted, it takes more place that the original file)
elsif ($json->{part} == 0 && ($json->{size} * 2) >= dfportable('files')->{bavail}) {
elsif ($json->{part} == 0 && ($json->{size} * 2) >= dfportable($c->config('upload_dir'))->{bavail}) {
$stop = 1;
$c->send(sprintf('{"success": false, "msg":"'.$c->l('No enough space available on the server for this file (size: %1).', format_bytes($json->{size})).'", "sent_delay": %d, "i": %d}', $json->{delay}, $json->{i}));
}
......@@ -94,7 +94,7 @@ sub upload {
# In this case, we don't need to rewrite the file
unless ($f->slices->grep(sub { $_->j == $json->{part} })->size) {
# Create directory
my $dir = catdir('files', $f->short);
my $dir = catdir($c->config('upload_dir'), $f->short);
mkdir($dir, 0700) unless (-d $dir);
# Create slice file
......
......@@ -104,10 +104,17 @@
# 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 Lutim user
# remember that it has to be in a directory writable by Lufi user
# optional, default is lufi.db
#db_path => 'lufi.db',
# 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',
#########################
# Lufi cron jobs settings
#########################
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment