fix(oembed.php): remove fallback hardcoded values; correct case where description might be empty
This commit is contained in:
parent
36fbba761a
commit
929bc9f9f8
3 changed files with 12 additions and 16 deletions
|
@ -19,7 +19,8 @@ class OembedHandler extends BaseHandler
|
|||
$globals['site_name'],
|
||||
$globals['url'],
|
||||
$globals['metadata']['open_graph_image'],
|
||||
$globals
|
||||
$globals,
|
||||
$globals['site_description']
|
||||
));
|
||||
|
||||
if (!$relativePath) $this->sendErrorResponse('Invalid url', 400);
|
||||
|
@ -89,8 +90,8 @@ class OembedHandler extends BaseHandler
|
|||
'provider_name' => $globals['site_name'],
|
||||
'provider_url' => $globals['url'],
|
||||
'thumbnail_url' => $globals['url'] . '/og/w800' . $imagePath,
|
||||
'html' => $html,
|
||||
'description' => $safeDescription,
|
||||
'html' => $html ?? $globals['site_description'],
|
||||
'description' => $safeDescription ?? $globals['site_description'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -100,12 +101,7 @@ class OembedHandler extends BaseHandler
|
|||
|
||||
if ($this->cache && $this->cache->exists($cacheKey)) return json_decode($this->cache->get($cacheKey), true);
|
||||
|
||||
$globals = $this->fetchFromApi('optimized_globals', 'limit=1')[0] ?? [
|
||||
'author' => 'Cory Dransfeldt',
|
||||
'site_name' => 'coryd.dev',
|
||||
'url' => 'https://www.coryd.dev',
|
||||
'avatar' => ''
|
||||
];
|
||||
$globals = $this->fetchFromApi('optimized_globals', 'limit=1')[0];
|
||||
|
||||
if ($this->cache) $this->cache->setex($cacheKey, 3600, json_encode($globals));
|
||||
|
||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "coryd.dev",
|
||||
"version": "7.0.7",
|
||||
"version": "7.0.8",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "coryd.dev",
|
||||
"version": "7.0.7",
|
||||
"version": "7.0.8",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"minisearch": "^7.1.2",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "coryd.dev",
|
||||
"version": "7.0.7",
|
||||
"version": "7.0.8",
|
||||
"description": "The source for my personal site. Built using 11ty (and other tools).",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue