backend: link to /media/:media_id instead of raw image

This commit is contained in:
Lucas 2023-03-17 20:57:08 +00:00
parent 84cbc5dd30
commit 171c6ee8cd
3 changed files with 5 additions and 3 deletions

View File

@ -23,7 +23,8 @@ sub list ($self)
$self->title("Pooru~"); $self->title("Pooru~");
my @media = map +{ my @media = map +{
media_src => $self->seaweed->url_for( media_link => $self->url_for("media_show", media_id => $_->{media_id}),
media_src => $self->seaweed->url_for(
SeaweedFS::FID->from_string($_->{seaweedfs_fid}) SeaweedFS::FID->from_string($_->{seaweedfs_fid})
), ),
}, @{$res->json->{media}}; }, @{$res->json->{media}};

View File

@ -50,7 +50,8 @@ sub show ($self)
$self->title($res->json->{name}); $self->title($res->json->{name});
my @media = map +{ my @media = map +{
media_src => $self->seaweed->url_for( media_link => $self->url_for("media_show", media_id => $_->{media_id}),
media_src => $self->seaweed->url_for(
SeaweedFS::FID->from_string($_->{seaweedfs_fid}) SeaweedFS::FID->from_string($_->{seaweedfs_fid})
), ),
}, @{$res->json->{media}}; }, @{$res->json->{media}};

View File

@ -2,7 +2,7 @@
<div class="flex-c-horizontal flex-c-wrap gallery"> <div class="flex-c-horizontal flex-c-wrap gallery">
% for my $m (@$media) { % for my $m (@$media) {
<%= link_to $m->{media_src} => begin %> <%= link_to $m->{media_link} => begin %>
<%= image $m->{media_src} %> <%= image $m->{media_src} %>
<% end %> <% end %>
% } % }