@@ -7,18 +7,21 @@ use Redis;
7
7
use LANraragi::Model::Stats;
8
8
use LANraragi::Model::Opds;
9
9
use LANraragi::Utils::TempFolder qw( get_tempsize clean_temp_full) ;
10
- use LANraragi::Utils::Generic qw( render_api_response) ;
11
- use LANraragi::Utils::Plugins qw( get_plugin get_plugins get_plugin_parameters use_plugin) ;
10
+ use LANraragi::Utils::Generic qw( render_api_response) ;
11
+ use LANraragi::Utils::Plugins qw( get_plugin get_plugins get_plugin_parameters use_plugin) ;
12
12
13
13
sub serve_serverinfo {
14
14
my $self = shift ;
15
15
16
16
my $redis = $self -> LRR_CONF-> get_redis_config;
17
17
my $last_clear = $redis -> hget( " LRR_SEARCHCACHE" , " created" ) || time ;
18
+ my $arc_stat = LANraragi::Model::Stats::get_archive_count;
18
19
my $page_stat = LANraragi::Model::Stats::get_page_stat;
19
20
$redis -> quit();
20
21
21
22
# A simple endpoint that forwards some info from LRR_CONF.
23
+ # TODO: This API renders every parameter as strings for compat, but at some point we could change it to actual JSON types:
24
+ # eg enable_pass ? \1 : \0, get_pagesize + 0, removing the quotes around numbers that force them to strings
22
25
$self -> render(
23
26
json => {
24
27
name => $self -> LRR_CONF-> get_htmltitle,
@@ -32,7 +35,8 @@ sub serve_serverinfo {
32
35
archives_per_page => $self -> LRR_CONF-> get_pagesize,
33
36
server_resizes_images => $self -> LRR_CONF-> enable_resize,
34
37
server_tracks_progress => $self -> LRR_CONF-> enable_localprogress ? " 0" : " 1" ,
35
- total_pages_read => $page_stat ,
38
+ total_pages_read => " $page_stat " ,
39
+ total_archives => " $arc_stat " ,
36
40
cache_last_cleared => " $last_clear "
37
41
}
38
42
);
@@ -130,7 +134,7 @@ sub download_url {
130
134
131
135
# Uses a plugin, with the standard global arguments and a provided oneshot argument.
132
136
sub use_plugin_sync {
133
- my ($self ) = shift ;
137
+ my ($self ) = shift ;
134
138
my $id = $self -> req-> param(' id' ) || 0;
135
139
my $plugname = $self -> req-> param(' plugin' );
136
140
my $input = $self -> req-> param(' arg' );
@@ -152,7 +156,7 @@ sub use_plugin_sync {
152
156
153
157
# Queues a plugin execution into Minion.
154
158
sub use_plugin_async {
155
- my ($self ) = shift ;
159
+ my ($self ) = shift ;
156
160
my $id = $self -> req-> param(' id' ) || 0;
157
161
my $priority = $self -> req-> param(' priority' ) || 0;
158
162
my $plugname = $self -> req-> param(' plugin' );
0 commit comments