Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PriviblurBridge] Fix invalid favicon, use either Tumblr or blog icon #4327

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion bridges/PriviblurBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class PriviblurBridge extends BridgeAbstract
];

private $title;
private $favicon = 'https://www.tumblr.com/favicon.ico';

public function collectData()
{
Expand All @@ -25,6 +26,11 @@ public function collectData()
$html = defaultLinkTo($html, $url);
$this->title = $html->find('head title', 0)->innertext;

if ($html->find('#blog-header img.avatar', 0)) {
$icon = $html->find('#blog-header img.avatar', 0)->src;
$this->favicon = str_replace('pnj', 'png', $icon);
}

$elements = $html->find('.post');
foreach ($elements as $element) {
$item = [];
Expand Down Expand Up @@ -64,6 +70,11 @@ public function getName()

public function getURI()
{
return $this->getInput('url') ? $this->getInput('url') : parent::getURI();
return $this->getInput('url') ?? parent::getURI();
}

public function getIcon()
{
return $this->favicon;
}
}