diff --git a/lib/PoorBooru.pm b/lib/PoorBooru.pm index 187bc47..fafbd30 100644 --- a/lib/PoorBooru.pm +++ b/lib/PoorBooru.pm @@ -63,8 +63,8 @@ get "/tag/:tag_id_or_name" => sub { my $data = decode_json($res->{content}); my @media = map +( { # XXX point to a cache - image_src => $POORBOORU_API . $_->{download_path}, - view_uri => uri_for("/view/" . $_->{id}), + image_src => "$POORBOORU_API/download/$_", + view_uri => uri_for("/view/$_"), } ), @{$data->{media}}; template "gallery" => { diff --git a/lib/PoorBooru/API/V0.pm b/lib/PoorBooru/API/V0.pm index 80381a1..5caae23 100644 --- a/lib/PoorBooru/API/V0.pm +++ b/lib/PoorBooru/API/V0.pm @@ -73,13 +73,7 @@ get "/tag/:tag_id_or_name" => sub { return { id => $tag->tag_id, name => $tag->name, - media => [ - map +( { - id => $_, - path => "/media/$_", - download_path => "/download/$_", - } ), @media, - ], + media => \@media, }; }; @@ -92,7 +86,7 @@ get "/media" => sub { ->page($page); 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 { next => ($next and "/media?page=$next"),