fix(og-image.php): re-use redirect logic + fix og image

This commit is contained in:
Cory Dransfeldt 2025-05-20 15:52:44 -07:00
parent 5168b13c99
commit 13b5b9c5cb
No known key found for this signature in database
4 changed files with 10 additions and 13 deletions

View file

@ -1,5 +1,7 @@
<?php <?php
require __DIR__ . '/../server/utils/init.php';
$id = $_GET['id'] ?? null; $id = $_GET['id'] ?? null;
$class = $_GET['class'] ?? null; $class = $_GET['class'] ?? null;
$extension = $_GET['extension'] ?? 'png'; $extension = $_GET['extension'] ?? 'png';
@ -24,12 +26,7 @@
curl_close($ch); curl_close($ch);
if ($httpCode !== 200 || $image === false || strpos($contentType, 'image/') !== 0) { if ($httpCode !== 200 || $image === false || strpos($contentType, 'image/') !== 0) redirectTo404();
error_log("Failed to fetch image: $cdnUrl ($httpCode - $contentType)");
header("Location: /404", true, 302);
exit;
}
header("Content-Type: $contentType"); header("Content-Type: $contentType");

10
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "coryd.dev", "name": "coryd.dev",
"version": "6.0.13", "version": "6.0.14",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "coryd.dev", "name": "coryd.dev",
"version": "6.0.13", "version": "6.0.14",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"minisearch": "^7.1.2", "minisearch": "^7.1.2",
@ -245,9 +245,9 @@
} }
}, },
"node_modules/@asamuzakjp/css-color": { "node_modules/@asamuzakjp/css-color": {
"version": "3.1.7", "version": "3.2.0",
"resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-3.1.7.tgz", "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-3.2.0.tgz",
"integrity": "sha512-Ok5fYhtwdyJQmU1PpEv6Si7Y+A4cYb8yNM9oiIJC9TzXPMuN9fvdonKJqcnz9TbFqV6bQ8z0giRq0iaOpGZV2g==", "integrity": "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {

View file

@ -1,6 +1,6 @@
{ {
"name": "coryd.dev", "name": "coryd.dev",
"version": "6.0.13", "version": "6.0.14",
"description": "The source for my personal site. Built using 11ty (and other tools).", "description": "The source for my personal site. Built using 11ty (and other tools).",
"type": "module", "type": "module",
"engines": { "engines": {

View file

@ -82,7 +82,7 @@
oembedUrl:oembedUrl, oembedUrl:oembedUrl,
pageTitle:pageTitle, pageTitle:pageTitle,
pageDescription:pageDescription, pageDescription:pageDescription,
ogImage:ogImage, ogImage:globals.avatar,
globals:globals, globals:globals,
%} %}
{%- else -%} {%- else -%}