api: always return a list of media_ids
This commit is contained in:
parent
0876464b5b
commit
216422f50a
@ -63,8 +63,8 @@ get "/tag/:tag_id_or_name" => sub {
|
|||||||
my $data = decode_json($res->{content});
|
my $data = decode_json($res->{content});
|
||||||
my @media = map +( {
|
my @media = map +( {
|
||||||
# XXX point to a cache
|
# XXX point to a cache
|
||||||
image_src => $POORBOORU_API . $_->{download_path},
|
image_src => "$POORBOORU_API/download/$_",
|
||||||
view_uri => uri_for("/view/" . $_->{id}),
|
view_uri => uri_for("/view/$_"),
|
||||||
} ), @{$data->{media}};
|
} ), @{$data->{media}};
|
||||||
|
|
||||||
template "gallery" => {
|
template "gallery" => {
|
||||||
|
@ -73,13 +73,7 @@ get "/tag/:tag_id_or_name" => sub {
|
|||||||
return {
|
return {
|
||||||
id => $tag->tag_id,
|
id => $tag->tag_id,
|
||||||
name => $tag->name,
|
name => $tag->name,
|
||||||
media => [
|
media => \@media,
|
||||||
map +( {
|
|
||||||
id => $_,
|
|
||||||
path => "/media/$_",
|
|
||||||
download_path => "/download/$_",
|
|
||||||
} ), @media,
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -92,7 +86,7 @@ get "/media" => sub {
|
|||||||
->page($page);
|
->page($page);
|
||||||
|
|
||||||
my ($prev, $next) = surrounding_pages($paged_media);
|
my ($prev, $next) = surrounding_pages($paged_media);
|
||||||
my @media = map { "/media/" . $_->media_id } $paged_media->all;
|
my @media = map { $_->media_id } $paged_media->all;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
next => ($next and "/media?page=$next"),
|
next => ($next and "/media?page=$next"),
|
||||||
|
Loading…
Reference in New Issue
Block a user