diff --git a/api/oembed.php b/api/oembed.php index d33118a..a1a5731 100644 --- a/api/oembed.php +++ b/api/oembed.php @@ -1,5 +1,6 @@ sendErrorResponse('No match found', 404); } - private function buildResponse(string $title, string $url, string $imagePath, array $globals): array + private function buildResponse(string $title, string $url, string $imagePath, array $globals, string $description = ''): array { + $safeDescription = truncateText(strip_tags(parseMarkdown($description)), 175); + $html = '
' . htmlspecialchars($title) . '
'; + if ($description) $html .= '' . htmlspecialchars($safeDescription, ENT_QUOTES, 'UTF-8') . '
'; + return [ 'version' => '1.0', 'type' => 'link', @@ -59,7 +65,8 @@ class OembedHandler extends BaseHandler 'provider_name' => $globals['site_name'], 'provider_url' => $globals['url'], 'thumbnail_url' => $globals['url'] . '/og/w800' . $imagePath, - 'html' => '' . htmlspecialchars($title) . '', + 'html' => $html, + 'description' => $safeDescription, ]; } diff --git a/package-lock.json b/package-lock.json index 0d1931f..0dbeac6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coryd.dev", - "version": "4.0.4", + "version": "4.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coryd.dev", - "version": "4.0.4", + "version": "4.0.5", "license": "MIT", "dependencies": { "html-minifier-terser": "7.2.0", @@ -1890,9 +1890,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.151", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.151.tgz", - "integrity": "sha512-Rl6uugut2l9sLojjS4H4SAr3A4IgACMLgpuEMPYCVcKydzfyPrn5absNRju38IhQOf/NwjJY8OGWjlteqYeBCA==", + "version": "1.5.152", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.152.tgz", + "integrity": "sha512-xBOfg/EBaIlVsHipHl2VdTPJRSvErNUaqW8ejTq5OlOlIYx1wOllCHsAvAIrr55jD1IYEfdR86miUEt8H5IeJg==", "dev": true, "license": "ISC" }, @@ -4263,9 +4263,9 @@ } }, "node_modules/semver": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", - "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", "dev": true, "license": "ISC", "bin": { diff --git a/package.json b/package.json index 55fcb5c..2b41dc3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "4.0.4", + "version": "4.0.5", "description": "The source for my personal site. Built using 11ty (and other tools).", "type": "module", "engines": {