diff --git a/CHANGELOG b/CHANGELOG index 3f7c042..f2614e6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,8 @@ Revision history for Lutim 0.17.0 ????-??-?? - - 🐛 — AVIF format support + - 🐛 — AVIF format support (#139) + - ✨ — Allow to configure the directory where to store the images (#125) 0.16.0 2023-12-29 - ⬆️ Update jQuery diff --git a/lib/Lutim.pm b/lib/Lutim.pm index 4c1ff9e..286b31e 100644 --- a/lib/Lutim.pm +++ b/lib/Lutim.pm @@ -109,6 +109,10 @@ sub startup { $self->plugin('Lutim::Plugin::Helpers'); $self->plugin('Lutim::Plugin::Lang'); + # Create directory if needed + 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')); + # Minion if ($config->{minion}->{enabled}) { $self->config->{minion}->{dbtype} = 'sqlite' unless defined $config->{minion}->{dbtype}; diff --git a/lib/Lutim/Controller/Image.pm b/lib/Lutim/Controller/Image.pm index 5f56b95..f584ee8 100644 --- a/lib/Lutim/Controller/Image.pm +++ b/lib/Lutim/Controller/Image.pm @@ -2,6 +2,7 @@ package Lutim::Controller::Image; use Mojo::Asset::Memory; use Mojo::Base 'Mojolicious::Controller'; +use Mojo::File qw(path); use Mojo::Util qw(url_escape url_unescape b64_encode encode); use Mojo::JSON qw(true false); use Lutim::DB::Image; @@ -390,9 +391,6 @@ sub add { my ($msg, $short, $real_short, $token, $thumb, $limit, $created); # Check file type if (index($mediatype, 'image/') >= 0) { - # Create directory if needed - mkdir('files', 0700) unless (-d 'files'); - if ($c->req->is_limit_exceeded) { $msg = $c->l('The file exceed the size limit (%1)', $c->req->max_message_size); if (defined($c->param('format')) && $c->param('format') eq 'json') { @@ -413,7 +411,7 @@ sub add { # Save file and create record my $filename = unidecode($upload->filename); my $ext = ($filename =~ m/([^.]+)$/)[0]; - my $path = 'files/'.$record->short.'.'.$ext; + my $path = path($c->config('upload_dir'), $record->short.'.'.$ext)->to_string; my ($width, $height); if ($im_loaded && $mediatype ne 'image/svg+xml' # ImageMagick doesn't work with SVG, xcf or avif files @@ -646,7 +644,7 @@ sub short { if ($image->mediatype eq 'image/gif') { if (defined($image->width) && defined($image->height)) { ($width, $height) = ($image->width, $image->height); - } elsif ($im_loaded) { + } elsif ($im_loaded && $image->mediatype !~ m/xcf|avif/) { my $upload = $c->decrypt($key, $image->path, $image->iv); my $im = Image::Magick->new; $im->BlobToImage($upload->slurp); diff --git a/lib/Lutim/DefaultConfig.pm b/lib/Lutim/DefaultConfig.pm index 3f42af4..ef47a48 100644 --- a/lib/Lutim/DefaultConfig.pm +++ b/lib/Lutim/DefaultConfig.pm @@ -23,6 +23,7 @@ our $default_config = { watermark_enforce => 'none', theme => 'default', disable_api => 0, + upload_dir => 'files', dbtype => 'sqlite', db_path => 'lutim.db', max_files_in_zip => 15, diff --git a/lib/Lutim/Plugin/Helpers.pm b/lib/Lutim/Plugin/Helpers.pm index 65725eb..c025765 100644 --- a/lib/Lutim/Plugin/Helpers.pm +++ b/lib/Lutim/Plugin/Helpers.pm @@ -144,7 +144,7 @@ sub _render_file { my $asset = Mojo::Asset::Memory->new; $asset->add_chunk($cache->{asset}); - if (defined $thumb && $im_loaded && $mediatype ne 'image/svg+xml' && $mediatype !~ m#image/(x-)?xcf# && $mediatype ne 'image/webp') { # ImageMagick don't work in Debian with svg (for now?) + if (defined $thumb && $im_loaded && $mediatype ne 'image/svg+xml' && $mediatype !~ m#image/(x-)?xcf# && $mediatype ne 'image/avif') { # ImageMagick don't work in Debian with svg (for now?) my $im = Image::Magick->new; $im->BlobToImage($asset->slurp); diff --git a/lutim.conf.template b/lutim.conf.template index b6a55d0..6423067 100644 --- a/lutim.conf.template +++ b/lutim.conf.template @@ -134,6 +134,15 @@ # optional, default is 0 #disable_api => 0, + # Define a path to the upload directory, where the uploaded images will be stored. + # You can define it relative to lutim directory or set an absolute path. + # The path is stored in database for each uploaded file, so you’ll need to do some + # SQL commands if you move the images in an other directory (if you keep the old directory + # where it was, you have nothing to do). + # Remember that it has to be in a directory writable by Lutim user + # optional, default is 'files' + #upload_dir => 'files', + # choose what database you want to use # valid choices are sqlite and postgresql (all lowercase) # optional, default is sqlite diff --git a/t/postgresql1.conf b/t/postgresql1.conf index 7a7a460..6a30bd7 100644 --- a/t/postgresql1.conf +++ b/t/postgresql1.conf @@ -97,6 +97,29 @@ # optional, default is 0 #always_encrypt => 0, + # you can allow to use a watermark on the uploaded images (or enforce its use) + # define a path to the watermark image (provide an image with alpha channel) + # you can define the path relative to lutim directory or set an absolute path + # to disable the usage of a watermark, leave it blank or commented + # optional, no default + #watermark_path => '', + + # the watermark can be a tiling one or a single one + # when using a small one, you can choose where to place it + # valid values are 'Center', 'North', 'NorthEast', 'East', 'SouthEast', 'South', 'SouthWest', 'West' and 'NorthWest' (case insensitive) + # optional, default is 'SouthEast' + #watermark_placement => 'SouthEast', + + # choose which watermark (tiling, single or none) should be used by default + # valid values are 'tiling', 'single' or 'none' (case insensitive) + # optional, default is 'none' + #watermark_default => 'none', + + # choose which watermark (tiling, single or none) should be enforced (users will always have a watermark and won’t be able to disable it) + # valid values are 'tiling', 'single' or 'none' (case insensitive) + # optional, default is 'none' + #watermark_enforce => 'none', + # length of the image's delete token # optional, default is 24 #token_length => 24, @@ -107,6 +130,18 @@ # optional, defaut is / #prefix => '/', + # if set to 1, Lutim will try to prevent its use without using the web interface + # optional, default is 0 + #disable_api => 0, + + # Define a path to the upload directory, where the uploaded images will be stored + # You can define it relative to lutim directory or set an absolute path + # The path is stored in database for each uploaded file, so you’ll need to do some + # SQL commands if you change the upload_dir after getting images uploaded. + # Remember that it has to be in a directory writable by Lutim user + # optional, default is 'files' + #upload_dir => 'files', + # choose what database you want to use # valid choices are sqlite and postgresql (all lowercase) # optional, default is sqlite @@ -154,6 +189,29 @@ # } #}, + # set `ldap` if you want that only authenticated users can shorten URLs + # please note that everybody can still use shortend URLs + # optional, no default + #ldap => { + # uri => 'ldaps://ldap.example.org', # server URI + # user_tree => 'ou=users,dc=example,dc=org', # search base DN + # bind_dn => 'uid=ldap_user,ou=users,dc=example,dc=org', # search bind DN + # bind_pwd => 'secr3t', # search bind password + # user_attr => 'uid', # user attribute (uid, mail, sAMAccountName, etc.) + # user_filter => '(!(uid=ldap_user))', # user filter (to exclude some users, etc.) + #}, + + # set `htpasswd` if you want to use an htpasswd file instead of ldap + # create the file with `htpasswd -c lutim.passwd user`, update it with `htpasswd lutim.passwd user2` + # make sure that lutim can read the file! + # optional, no default + #htpasswd => 'lutim.passwd', + + # if you've set ldap or htpasswd above, the session will last `session_duration` seconds before + # the user needs to reauthenticate + # optional, default is 3600 + #session_duration => 3600, + # disable counters of images # set to 1 to disable counters # optional, counters are enabled by default @@ -200,7 +258,7 @@ # optional, default is 0 #quiet_logs => 0, - # Content-Security-Policy header that will be sent by Lstu + # Content-Security-Policy header that will be sent by Lutim # 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. @@ -210,7 +268,7 @@ # the default value is good for `default` theme #csp => "base-uri 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'", - # X-Frame-Options header that will be sent by Lstu + # X-Frame-Options header that will be sent by Lutim # 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 @@ -219,18 +277,22 @@ # optional, default is 'DENY' #x_frame_options => 'DENY', - # X-Content-Type-Options that will be sent by Lstu + # X-Content-Type-Options that will be sent by Lutim # 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 Lstu + # X-XSS-Protection that will be sent by Lutim # 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', + # if set, the uploaded images will use this domain + # optional + #fixed_domain => 'example.org', + ########################## # Lutim cron jobs settings ########################## diff --git a/t/postgresql2.conf b/t/postgresql2.conf index 3958ed0..860d67c 100644 --- a/t/postgresql2.conf +++ b/t/postgresql2.conf @@ -97,6 +97,29 @@ # optional, default is 0 #always_encrypt => 0, + # you can allow to use a watermark on the uploaded images (or enforce its use) + # define a path to the watermark image (provide an image with alpha channel) + # you can define the path relative to lutim directory or set an absolute path + # to disable the usage of a watermark, leave it blank or commented + # optional, no default + #watermark_path => '', + + # the watermark can be a tiling one or a single one + # when using a small one, you can choose where to place it + # valid values are 'Center', 'North', 'NorthEast', 'East', 'SouthEast', 'South', 'SouthWest', 'West' and 'NorthWest' (case insensitive) + # optional, default is 'SouthEast' + #watermark_placement => 'SouthEast', + + # choose which watermark (tiling, single or none) should be used by default + # valid values are 'tiling', 'single' or 'none' (case insensitive) + # optional, default is 'none' + #watermark_default => 'none', + + # choose which watermark (tiling, single or none) should be enforced (users will always have a watermark and won’t be able to disable it) + # valid values are 'tiling', 'single' or 'none' (case insensitive) + # optional, default is 'none' + #watermark_enforce => 'none', + # length of the image's delete token # optional, default is 24 #token_length => 24, @@ -107,6 +130,18 @@ # optional, defaut is / #prefix => '/', + # if set to 1, Lutim will try to prevent its use without using the web interface + # optional, default is 0 + #disable_api => 0, + + # Define a path to the upload directory, where the uploaded images will be stored + # You can define it relative to lutim directory or set an absolute path + # The path is stored in database for each uploaded file, so you’ll need to do some + # SQL commands if you change the upload_dir after getting images uploaded. + # Remember that it has to be in a directory writable by Lutim user + # optional, default is 'files' + #upload_dir => 'files', + # choose what database you want to use # valid choices are sqlite and postgresql (all lowercase) # optional, default is sqlite @@ -152,7 +187,30 @@ # #user => 'DBUSER', # #pwd => 'DBPASSWORD' # } - }, + #}, + + # set `ldap` if you want that only authenticated users can shorten URLs + # please note that everybody can still use shortend URLs + # optional, no default + #ldap => { + # uri => 'ldaps://ldap.example.org', # server URI + # user_tree => 'ou=users,dc=example,dc=org', # search base DN + # bind_dn => 'uid=ldap_user,ou=users,dc=example,dc=org', # search bind DN + # bind_pwd => 'secr3t', # search bind password + # user_attr => 'uid', # user attribute (uid, mail, sAMAccountName, etc.) + # user_filter => '(!(uid=ldap_user))', # user filter (to exclude some users, etc.) + #}, + + # set `htpasswd` if you want to use an htpasswd file instead of ldap + # create the file with `htpasswd -c lutim.passwd user`, update it with `htpasswd lutim.passwd user2` + # make sure that lutim can read the file! + # optional, no default + #htpasswd => 'lutim.passwd', + + # if you've set ldap or htpasswd above, the session will last `session_duration` seconds before + # the user needs to reauthenticate + # optional, default is 3600 + #session_duration => 3600, # disable counters of images # set to 1 to disable counters @@ -200,7 +258,7 @@ # optional, default is 0 #quiet_logs => 0, - # Content-Security-Policy header that will be sent by Lstu + # Content-Security-Policy header that will be sent by Lutim # 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. @@ -210,7 +268,7 @@ # the default value is good for `default` theme #csp => "base-uri 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'", - # X-Frame-Options header that will be sent by Lstu + # X-Frame-Options header that will be sent by Lutim # 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 @@ -219,18 +277,22 @@ # optional, default is 'DENY' #x_frame_options => 'DENY', - # X-Content-Type-Options that will be sent by Lstu + # X-Content-Type-Options that will be sent by Lutim # 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 Lstu + # X-XSS-Protection that will be sent by Lutim # 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', + # if set, the uploaded images will use this domain + # optional + #fixed_domain => 'example.org', + ########################## # Lutim cron jobs settings ########################## diff --git a/t/postgresql3.conf b/t/postgresql3.conf index 7cb7aed..7747c77 100644 --- a/t/postgresql3.conf +++ b/t/postgresql3.conf @@ -97,6 +97,29 @@ # optional, default is 0 #always_encrypt => 0, + # you can allow to use a watermark on the uploaded images (or enforce its use) + # define a path to the watermark image (provide an image with alpha channel) + # you can define the path relative to lutim directory or set an absolute path + # to disable the usage of a watermark, leave it blank or commented + # optional, no default + #watermark_path => '', + + # the watermark can be a tiling one or a single one + # when using a small one, you can choose where to place it + # valid values are 'Center', 'North', 'NorthEast', 'East', 'SouthEast', 'South', 'SouthWest', 'West' and 'NorthWest' (case insensitive) + # optional, default is 'SouthEast' + #watermark_placement => 'SouthEast', + + # choose which watermark (tiling, single or none) should be used by default + # valid values are 'tiling', 'single' or 'none' (case insensitive) + # optional, default is 'none' + #watermark_default => 'none', + + # choose which watermark (tiling, single or none) should be enforced (users will always have a watermark and won’t be able to disable it) + # valid values are 'tiling', 'single' or 'none' (case insensitive) + # optional, default is 'none' + #watermark_enforce => 'none', + # length of the image's delete token # optional, default is 24 #token_length => 24, @@ -107,6 +130,18 @@ # optional, defaut is / #prefix => '/', + # if set to 1, Lutim will try to prevent its use without using the web interface + # optional, default is 0 + #disable_api => 0, + + # Define a path to the upload directory, where the uploaded images will be stored + # You can define it relative to lutim directory or set an absolute path + # The path is stored in database for each uploaded file, so you’ll need to do some + # SQL commands if you change the upload_dir after getting images uploaded. + # Remember that it has to be in a directory writable by Lutim user + # optional, default is 'files' + #upload_dir => 'files', + # choose what database you want to use # valid choices are sqlite and postgresql (all lowercase) # optional, default is sqlite @@ -200,7 +235,7 @@ # optional, default is 0 #quiet_logs => 0, - # Content-Security-Policy header that will be sent by Lstu + # Content-Security-Policy header that will be sent by Lutim # 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. @@ -210,7 +245,7 @@ # the default value is good for `default` theme #csp => "base-uri 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'", - # X-Frame-Options header that will be sent by Lstu + # X-Frame-Options header that will be sent by Lutim # 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 @@ -219,18 +254,22 @@ # optional, default is 'DENY' #x_frame_options => 'DENY', - # X-Content-Type-Options that will be sent by Lstu + # X-Content-Type-Options that will be sent by Lutim # 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 Lstu + # X-XSS-Protection that will be sent by Lutim # 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', + # if set, the uploaded images will use this domain + # optional + #fixed_domain => 'example.org', + ########################## # Lutim cron jobs settings ########################## diff --git a/t/sqlite1.conf b/t/sqlite1.conf index 75f22e5..06fa9bd 100644 --- a/t/sqlite1.conf +++ b/t/sqlite1.conf @@ -97,6 +97,29 @@ # optional, default is 0 #always_encrypt => 0, + # you can allow to use a watermark on the uploaded images (or enforce its use) + # define a path to the watermark image (provide an image with alpha channel) + # you can define the path relative to lutim directory or set an absolute path + # to disable the usage of a watermark, leave it blank or commented + # optional, no default + #watermark_path => '', + + # the watermark can be a tiling one or a single one + # when using a small one, you can choose where to place it + # valid values are 'Center', 'North', 'NorthEast', 'East', 'SouthEast', 'South', 'SouthWest', 'West' and 'NorthWest' (case insensitive) + # optional, default is 'SouthEast' + #watermark_placement => 'SouthEast', + + # choose which watermark (tiling, single or none) should be used by default + # valid values are 'tiling', 'single' or 'none' (case insensitive) + # optional, default is 'none' + #watermark_default => 'none', + + # choose which watermark (tiling, single or none) should be enforced (users will always have a watermark and won’t be able to disable it) + # valid values are 'tiling', 'single' or 'none' (case insensitive) + # optional, default is 'none' + #watermark_enforce => 'none', + # length of the image's delete token # optional, default is 24 #token_length => 24, @@ -107,6 +130,18 @@ # optional, defaut is / #prefix => '/', + # if set to 1, Lutim will try to prevent its use without using the web interface + # optional, default is 0 + #disable_api => 0, + + # Define a path to the upload directory, where the uploaded images will be stored + # You can define it relative to lutim directory or set an absolute path + # The path is stored in database for each uploaded file, so you’ll need to do some + # SQL commands if you change the upload_dir after getting images uploaded. + # Remember that it has to be in a directory writable by Lutim user + # optional, default is 'files' + #upload_dir => 'files', + # choose what database you want to use # valid choices are sqlite and postgresql (all lowercase) # optional, default is sqlite @@ -154,6 +189,29 @@ # } #}, + # set `ldap` if you want that only authenticated users can shorten URLs + # please note that everybody can still use shortend URLs + # optional, no default + #ldap => { + # uri => 'ldaps://ldap.example.org', # server URI + # user_tree => 'ou=users,dc=example,dc=org', # search base DN + # bind_dn => 'uid=ldap_user,ou=users,dc=example,dc=org', # search bind DN + # bind_pwd => 'secr3t', # search bind password + # user_attr => 'uid', # user attribute (uid, mail, sAMAccountName, etc.) + # user_filter => '(!(uid=ldap_user))', # user filter (to exclude some users, etc.) + #}, + + # set `htpasswd` if you want to use an htpasswd file instead of ldap + # create the file with `htpasswd -c lutim.passwd user`, update it with `htpasswd lutim.passwd user2` + # make sure that lutim can read the file! + # optional, no default + #htpasswd => 'lutim.passwd', + + # if you've set ldap or htpasswd above, the session will last `session_duration` seconds before + # the user needs to reauthenticate + # optional, default is 3600 + #session_duration => 3600, + # disable counters of images # set to 1 to disable counters # optional, counters are enabled by default @@ -200,7 +258,7 @@ # optional, default is 0 #quiet_logs => 0, - # Content-Security-Policy header that will be sent by Lstu + # Content-Security-Policy header that will be sent by Lutim # 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. @@ -210,7 +268,7 @@ # the default value is good for `default` theme #csp => "base-uri 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'", - # X-Frame-Options header that will be sent by Lstu + # X-Frame-Options header that will be sent by Lutim # 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 @@ -219,18 +277,22 @@ # optional, default is 'DENY' #x_frame_options => 'DENY', - # X-Content-Type-Options that will be sent by Lstu + # X-Content-Type-Options that will be sent by Lutim # 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 Lstu + # X-XSS-Protection that will be sent by Lutim # 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', + # if set, the uploaded images will use this domain + # optional + #fixed_domain => 'example.org', + ########################## # Lutim cron jobs settings ########################## diff --git a/t/sqlite2.conf b/t/sqlite2.conf index 67e9bcf..af51634 100644 --- a/t/sqlite2.conf +++ b/t/sqlite2.conf @@ -97,6 +97,29 @@ # optional, default is 0 #always_encrypt => 0, + # you can allow to use a watermark on the uploaded images (or enforce its use) + # define a path to the watermark image (provide an image with alpha channel) + # you can define the path relative to lutim directory or set an absolute path + # to disable the usage of a watermark, leave it blank or commented + # optional, no default + #watermark_path => '', + + # the watermark can be a tiling one or a single one + # when using a small one, you can choose where to place it + # valid values are 'Center', 'North', 'NorthEast', 'East', 'SouthEast', 'South', 'SouthWest', 'West' and 'NorthWest' (case insensitive) + # optional, default is 'SouthEast' + #watermark_placement => 'SouthEast', + + # choose which watermark (tiling, single or none) should be used by default + # valid values are 'tiling', 'single' or 'none' (case insensitive) + # optional, default is 'none' + #watermark_default => 'none', + + # choose which watermark (tiling, single or none) should be enforced (users will always have a watermark and won’t be able to disable it) + # valid values are 'tiling', 'single' or 'none' (case insensitive) + # optional, default is 'none' + #watermark_enforce => 'none', + # length of the image's delete token # optional, default is 24 #token_length => 24, @@ -107,6 +130,18 @@ # optional, defaut is / #prefix => '/', + # if set to 1, Lutim will try to prevent its use without using the web interface + # optional, default is 0 + #disable_api => 0, + + # Define a path to the upload directory, where the uploaded images will be stored + # You can define it relative to lutim directory or set an absolute path + # The path is stored in database for each uploaded file, so you’ll need to do some + # SQL commands if you change the upload_dir after getting images uploaded. + # Remember that it has to be in a directory writable by Lutim user + # optional, default is 'files' + #upload_dir => 'files', + # choose what database you want to use # valid choices are sqlite and postgresql (all lowercase) # optional, default is sqlite @@ -152,7 +187,30 @@ # #user => 'DBUSER', # #pwd => 'DBPASSWORD' # } - }, + #}, + + # set `ldap` if you want that only authenticated users can shorten URLs + # please note that everybody can still use shortend URLs + # optional, no default + #ldap => { + # uri => 'ldaps://ldap.example.org', # server URI + # user_tree => 'ou=users,dc=example,dc=org', # search base DN + # bind_dn => 'uid=ldap_user,ou=users,dc=example,dc=org', # search bind DN + # bind_pwd => 'secr3t', # search bind password + # user_attr => 'uid', # user attribute (uid, mail, sAMAccountName, etc.) + # user_filter => '(!(uid=ldap_user))', # user filter (to exclude some users, etc.) + #}, + + # set `htpasswd` if you want to use an htpasswd file instead of ldap + # create the file with `htpasswd -c lutim.passwd user`, update it with `htpasswd lutim.passwd user2` + # make sure that lutim can read the file! + # optional, no default + #htpasswd => 'lutim.passwd', + + # if you've set ldap or htpasswd above, the session will last `session_duration` seconds before + # the user needs to reauthenticate + # optional, default is 3600 + #session_duration => 3600, # disable counters of images # set to 1 to disable counters @@ -200,7 +258,7 @@ # optional, default is 0 #quiet_logs => 0, - # Content-Security-Policy header that will be sent by Lstu + # Content-Security-Policy header that will be sent by Lutim # 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. @@ -210,7 +268,7 @@ # the default value is good for `default` theme #csp => "base-uri 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'", - # X-Frame-Options header that will be sent by Lstu + # X-Frame-Options header that will be sent by Lutim # 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 @@ -219,18 +277,22 @@ # optional, default is 'DENY' #x_frame_options => 'DENY', - # X-Content-Type-Options that will be sent by Lstu + # X-Content-Type-Options that will be sent by Lutim # 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 Lstu + # X-XSS-Protection that will be sent by Lutim # 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', + # if set, the uploaded images will use this domain + # optional + #fixed_domain => 'example.org', + ########################## # Lutim cron jobs settings ########################## diff --git a/t/sqlite3.conf b/t/sqlite3.conf index 872b8e9..1ff0c8b 100644 --- a/t/sqlite3.conf +++ b/t/sqlite3.conf @@ -97,6 +97,29 @@ # optional, default is 0 #always_encrypt => 0, + # you can allow to use a watermark on the uploaded images (or enforce its use) + # define a path to the watermark image (provide an image with alpha channel) + # you can define the path relative to lutim directory or set an absolute path + # to disable the usage of a watermark, leave it blank or commented + # optional, no default + #watermark_path => '', + + # the watermark can be a tiling one or a single one + # when using a small one, you can choose where to place it + # valid values are 'Center', 'North', 'NorthEast', 'East', 'SouthEast', 'South', 'SouthWest', 'West' and 'NorthWest' (case insensitive) + # optional, default is 'SouthEast' + #watermark_placement => 'SouthEast', + + # choose which watermark (tiling, single or none) should be used by default + # valid values are 'tiling', 'single' or 'none' (case insensitive) + # optional, default is 'none' + #watermark_default => 'none', + + # choose which watermark (tiling, single or none) should be enforced (users will always have a watermark and won’t be able to disable it) + # valid values are 'tiling', 'single' or 'none' (case insensitive) + # optional, default is 'none' + #watermark_enforce => 'none', + # length of the image's delete token # optional, default is 24 #token_length => 24, @@ -107,6 +130,18 @@ # optional, defaut is / #prefix => '/', + # if set to 1, Lutim will try to prevent its use without using the web interface + # optional, default is 0 + #disable_api => 0, + + # Define a path to the upload directory, where the uploaded images will be stored + # You can define it relative to lutim directory or set an absolute path + # The path is stored in database for each uploaded file, so you’ll need to do some + # SQL commands if you change the upload_dir after getting images uploaded. + # Remember that it has to be in a directory writable by Lutim user + # optional, default is 'files' + #upload_dir => 'files', + # choose what database you want to use # valid choices are sqlite and postgresql (all lowercase) # optional, default is sqlite @@ -200,7 +235,7 @@ # optional, default is 0 #quiet_logs => 0, - # Content-Security-Policy header that will be sent by Lstu + # Content-Security-Policy header that will be sent by Lutim # 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. @@ -210,7 +245,7 @@ # the default value is good for `default` theme #csp => "base-uri 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'", - # X-Frame-Options header that will be sent by Lstu + # X-Frame-Options header that will be sent by Lutim # 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 @@ -219,18 +254,22 @@ # optional, default is 'DENY' #x_frame_options => 'DENY', - # X-Content-Type-Options that will be sent by Lstu + # X-Content-Type-Options that will be sent by Lutim # 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 Lstu + # X-XSS-Protection that will be sent by Lutim # 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', + # if set, the uploaded images will use this domain + # optional + #fixed_domain => 'example.org', + ########################## # Lutim cron jobs settings ##########################