mirror of
https://framagit.org/fiat-tux/hat-softwares/lutim.git
synced 2026-03-28 17:42:54 +01:00
25
README.md
25
README.md
@@ -43,7 +43,9 @@ vi lutim.conf
|
||||
* hosted\_by: if someone hosts your LUTIm instance, you can add some HTML (a logo for example) to make it appear on index page ;
|
||||
* tweet\_card\_via: a twitter account which will appear on twitter cards ;
|
||||
* max\_file\_size: well, this is explicit (default is 10Mio = 10485760 octets) ;
|
||||
* https: 1 if you want to provide secure images URLs.
|
||||
* https: 1 if you want to provide secure images URLs (default is 0) ;
|
||||
* stats\_day\_num: when you generate statistics with `script/lutim cron stats`, you will have stats for the last `stats_day_num` days (default is 365) ;
|
||||
* keep\_ip\_during: when you delete IP addresses of image's senders with `script/lutim cron cleanbdd`, the IP addresses of images older than `keep_ip_during` days will be deleted (default is 365) ;
|
||||
|
||||
##Usage
|
||||
```
|
||||
@@ -81,6 +83,27 @@ sub vcl_recv {
|
||||
}
|
||||
```
|
||||
|
||||
##Cron jobs
|
||||
LUTIm have commands which can be used in cron jobs.
|
||||
|
||||
To see what commands are available:
|
||||
```shell
|
||||
carton exec script/lutim cron
|
||||
```
|
||||
|
||||
###Statistics
|
||||
To generate statistics which can be viewed at the address `/stats`:
|
||||
```shell
|
||||
carton exec script/lutim cron stats
|
||||
```
|
||||
|
||||
###Delete IP adresses from database
|
||||
To automatically delete the IP addresses of image's senders after a configurable delay:
|
||||
```shell
|
||||
carton exec script/lutim cron cleanbdd
|
||||
```
|
||||
|
||||
|
||||
##Shutter integration
|
||||
See where Shutter (<http://en.wikipedia.org/wiki/Shutter_%28software%29>) keeps its plugins on your computer.
|
||||
On my computer, it's in `/usr/share/shutter/resources/system/upload_plugins/upload`.
|
||||
|
||||
38
lib/Mojolicious/Command/cron/cleanbdd.pm
Normal file
38
lib/Mojolicious/Command/cron/cleanbdd.pm
Normal file
@@ -0,0 +1,38 @@
|
||||
package Mojolicious::Command::cron::cleanbdd;
|
||||
use Mojo::Base 'Mojolicious::Command';
|
||||
use LutimModel;
|
||||
use Mojo::Util qw(slurp decode);
|
||||
use Mojolicious::Plugin::Config;
|
||||
|
||||
has description => 'Delete IP addresses from database after configured delay.';
|
||||
has usage => sub { shift->extract_usage };
|
||||
|
||||
sub run {
|
||||
my $c = shift;
|
||||
|
||||
my $config = Mojolicious::Plugin::Config->parse(decode('UTF-8', slurp 'lutim.conf'), 'lutim.conf');
|
||||
|
||||
$config->{keep_ip_during} = (defined($config->{keep_ip_during})) ? $config->{keep_ip_during} : 365;
|
||||
|
||||
my $separation = time() - $config->{keep_ip_during} * 86400;
|
||||
|
||||
LutimModel->do(
|
||||
'UPDATE lutim SET created_by = "" WHERE path IS NOT NULL AND created_at < ?',
|
||||
{},
|
||||
$separation
|
||||
);
|
||||
}
|
||||
|
||||
=encoding utf8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Mojolicious::Command::cron::cleanbdd - Delete IP addresses from database after configured delay
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
Usage: script/lutim cron cleanbdd
|
||||
|
||||
=cut
|
||||
|
||||
1;
|
||||
@@ -16,5 +16,6 @@
|
||||
max_file_size => 10485760, # optional, size in octets, you can write it 10*1024*1024
|
||||
#hosted_by => 'My super hoster <img src="http://hoster.example.com" alt="Hoster logo">', # optional
|
||||
#https => 0, # optional, set to 1 if you use Lutim behind a secure web server
|
||||
#stats_day_num => 365, # optional, number of days shown in /stats page
|
||||
#stats_day_num => 365, # optional, number of days shown in /stats page (used with script/lutim cron stats)
|
||||
#keep_ip_during => 365, # optional, number of days, after that delay, the IP addresses of image creators will be deleted (used with script/lutim cron cleanbdd)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user