login: return success status to whatsapp crawler
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 16 Sep 2021 07:48:10 +0000 (09:48 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 22 Sep 2021 15:00:37 +0000 (17:00 +0200)
An 403 forbidden error will prevent metadata parsing and consecutive link
preview.

login/index.php

index 85dc2f54a3cd893d5a55e9b30318eb377753b09f..cfe00278f0e1f6dfbb66ecef60a859859725b403 100644 (file)
@@ -39,7 +39,10 @@ elseif (isset($_GET['logout'])) {
 if (!$User or !$User->login) {
        $Page->title = 'Inloggen';
        if (isset($_REQUEST['goto'])) {
-               if (empty($message)) http_response_code(403);
+               if (empty($message)
+               and !preg_match('(^WhatsApp/)', $_SERVER['HTTP_USER_AGENT'])) {
+                       http_response_code(403);
+               }
                $target = ltrim($_REQUEST['goto'], '/');
                $target = new ArchiveArticle("$target.html");
                $target->index; # run forbidden handler to determine metadata