From 615994e81751fc0309c1a7b01589ad32c3607429 Mon Sep 17 00:00:00 2001 From: Sergiotarxz Date: Tue, 19 Sep 2023 17:47:43 +0200 Subject: [PATCH] Forcing facebook to take whatsapp images. --- lib/BurguillosInfo/Controller/Attribute.pm | 1 + lib/BurguillosInfo/Controller/Page.pm | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/BurguillosInfo/Controller/Attribute.pm b/lib/BurguillosInfo/Controller/Attribute.pm index d0e1ef0..e904bcb 100644 --- a/lib/BurguillosInfo/Controller/Attribute.pm +++ b/lib/BurguillosInfo/Controller/Attribute.pm @@ -26,6 +26,7 @@ sub get_attribute_preview ($self) { } my $is_whatsapp = $self->req->headers->user_agent =~ /whatsapp/i; + $is_whatsapp ||= $self->req->headers->user_agent =~ /facebook/i; my $data; if ($is_whatsapp) { $data = BurguillosInfo::Preview->WhatsappAlternativeGenerate( diff --git a/lib/BurguillosInfo/Controller/Page.pm b/lib/BurguillosInfo/Controller/Page.pm index 94243c1..f9b63b8 100644 --- a/lib/BurguillosInfo/Controller/Page.pm +++ b/lib/BurguillosInfo/Controller/Page.pm @@ -172,6 +172,7 @@ sub get_category_preview { } my $category = $categories->{$category_slug}; my $is_whatsapp = $self->req->headers->user_agent =~ /whatsapp/i; + $is_whatsapp ||= $self->req->headers->user_agent =~ /facebook/i; $self->render( format => 'png', data => $category_model->PreviewOg( $category, $is_whatsapp ) @@ -188,6 +189,7 @@ sub get_post_preview { return; } 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; my $post = $posts_slug->{$slug}; $self->render(