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

View File

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

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 %>
% } % }