diff --git a/lib/PoorBooru.pm b/lib/PoorBooru.pm index 9f53b22..9188815 100644 --- a/lib/PoorBooru.pm +++ b/lib/PoorBooru.pm @@ -58,11 +58,11 @@ get "/" => sub { send_error("API error", 500) if !$res->{success}; my $data = decode_json($res->{content}); - my @media = map +( { + my @media = map +{ # XXX point to a cache image_src => "$POORBOORU_API/download/$_", view_uri => uri_for("/view/$_"), - } ), @{$data->{media}}; + }, @{$data->{media}}; template "gallery" => { title => "PoorBooru", @@ -81,11 +81,11 @@ get "/tags" => sub { send_error("API error", 500) if !$res->{success}; my $data = decode_json($res->{content}); - my @tags = map +( { + my @tags = map +{ name => $_->{name}, count => $_->{count}, uri => uri_for("/tag/" . $_->{name}), - } ), @{$data->{tags}}; + }, @{$data->{tags}}; template "tags" => { title => "Tags", @@ -101,11 +101,11 @@ get "/tag/:tag_id_or_name" => sub { send_error("API error", 500) if !$res->{success}; my $data = decode_json($res->{content}); - my @media = map +( { + my @media = map +{ # XXX point to a cache image_src => "$POORBOORU_API/download/$_", view_uri => uri_for("/view/$_"), - } ), @{$data->{media}}; + }, @{$data->{media}}; template "gallery" => { title => $data->{name}, diff --git a/lib/PoorBooru/API/V0.pm b/lib/PoorBooru/API/V0.pm index 5e5a190..8febbc1 100644 --- a/lib/PoorBooru/API/V0.pm +++ b/lib/PoorBooru/API/V0.pm @@ -53,11 +53,11 @@ get "/tags" => sub { my $paged_tags = schema("default")->resultset("TagsCountView") ->search({}, $TAGS_COUNT_VIEW_SEARCH_OPTS)->page($page); - my @tags = map +( { + my @tags = map +{ id => $_->tag_id, name => $_->name, count => $_->count, - } ), $paged_tags->all; + }, $paged_tags->all; return { pager => mkpager($paged_tags), @@ -74,11 +74,11 @@ post "/tags" => sub { my @tags; eval { - @tags = map +( { + @tags = map +{ id => $_->tag_id, name => $_->name, - } ), schema("default")->resultset("Tag") - ->populate([map +({ name => $_ }), @tag_names]); + }, schema("default")->resultset("Tag") + ->populate([map +{ name => $_ }, @tag_names]); } or send_error("Tag exists", 409); return \@tags;