api: return paths instead of URIs
This commit is contained in:
parent
ead5728a99
commit
46cb5c19ec
@ -63,7 +63,7 @@ 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 => $_->{download_uri},
|
image_src => $POORBOORU_API . $_->{download_path},
|
||||||
view_uri => uri_for("/view/" . $_->{id}),
|
view_uri => uri_for("/view/" . $_->{id}),
|
||||||
} ), @{$data->{media}};
|
} ), @{$data->{media}};
|
||||||
|
|
||||||
|
@ -66,9 +66,9 @@ get "/tag/:tag_id_or_name" => sub {
|
|||||||
name => $tag->name,
|
name => $tag->name,
|
||||||
media => [
|
media => [
|
||||||
map +( {
|
map +( {
|
||||||
id => $_,
|
id => $_,
|
||||||
uri => uri_for("/media/$_"),
|
path => "/media/$_",
|
||||||
download_uri => uri_for("/download/$_"),
|
download_path => "/download/$_",
|
||||||
} ), @media,
|
} ), @media,
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
@ -90,10 +90,10 @@ get "/media/:media_id" => sub {
|
|||||||
send_error("Media not found", 404) if !defined($media);
|
send_error("Media not found", 404) if !defined($media);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id => $media->media_id,
|
id => $media->media_id,
|
||||||
filename => $media->filename,
|
filename => $media->filename,
|
||||||
size => length($media->content),
|
size => length($media->content),
|
||||||
download_uri => uri_for("/download/" . $media->media_id),
|
download_path => "/download/" . $media->media_id,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user