api: return paths instead of URIs

This commit is contained in:
Lucas 2023-02-18 15:05:52 +00:00
parent ead5728a99
commit 46cb5c19ec
2 changed files with 8 additions and 8 deletions

View File

@ -63,7 +63,7 @@ get "/tag/:tag_id_or_name" => sub {
my $data = decode_json($res->{content});
my @media = map +( {
# XXX point to a cache
image_src => $_->{download_uri},
image_src => $POORBOORU_API . $_->{download_path},
view_uri => uri_for("/view/" . $_->{id}),
} ), @{$data->{media}};

View File

@ -66,9 +66,9 @@ get "/tag/:tag_id_or_name" => sub {
name => $tag->name,
media => [
map +( {
id => $_,
uri => uri_for("/media/$_"),
download_uri => uri_for("/download/$_"),
id => $_,
path => "/media/$_",
download_path => "/download/$_",
} ), @media,
],
};
@ -90,10 +90,10 @@ get "/media/:media_id" => sub {
send_error("Media not found", 404) if !defined($media);
return {
id => $media->media_id,
filename => $media->filename,
size => length($media->content),
download_uri => uri_for("/download/" . $media->media_id),
id => $media->media_id,
filename => $media->filename,
size => length($media->content),
download_path => "/download/" . $media->media_id,
};
};