Forcing facebook to take whatsapp images.

This commit is contained in:
Sergiotarxz 2023-09-19 17:47:43 +02:00
parent 556b8bb4d1
commit 615994e817
2 changed files with 3 additions and 0 deletions

View File

@ -26,6 +26,7 @@ sub get_attribute_preview ($self) {
} }
my $is_whatsapp = $self->req->headers->user_agent =~ /whatsapp/i; my $is_whatsapp = $self->req->headers->user_agent =~ /whatsapp/i;
$is_whatsapp ||= $self->req->headers->user_agent =~ /facebook/i;
my $data; my $data;
if ($is_whatsapp) { if ($is_whatsapp) {
$data = BurguillosInfo::Preview->WhatsappAlternativeGenerate( $data = BurguillosInfo::Preview->WhatsappAlternativeGenerate(

View File

@ -172,6 +172,7 @@ sub get_category_preview {
} }
my $category = $categories->{$category_slug}; my $category = $categories->{$category_slug};
my $is_whatsapp = $self->req->headers->user_agent =~ /whatsapp/i; my $is_whatsapp = $self->req->headers->user_agent =~ /whatsapp/i;
$is_whatsapp ||= $self->req->headers->user_agent =~ /facebook/i;
$self->render( $self->render(
format => 'png', format => 'png',
data => $category_model->PreviewOg( $category, $is_whatsapp ) data => $category_model->PreviewOg( $category, $is_whatsapp )
@ -188,6 +189,7 @@ sub get_post_preview {
return; return;
} }
my $is_whatsapp = $self->req->headers->user_agent =~ /whatsapp/i; my $is_whatsapp = $self->req->headers->user_agent =~ /whatsapp/i;
$is_whatsapp ||= $self->req->headers->user_agent =~ /facebook/i;
say $self->req->headers->user_agent; say $self->req->headers->user_agent;
my $post = $posts_slug->{$slug}; my $post = $posts_slug->{$slug};
$self->render( $self->render(