rewrite relative urls for html5 audio source elements
This commit is contained in:
parent
270c0a00e5
commit
8519c68d93
|
@ -896,7 +896,7 @@
|
||||||
$ttrss_uses_https = parse_url(get_self_url_prefix(), PHP_URL_SCHEME) === 'https';
|
$ttrss_uses_https = parse_url(get_self_url_prefix(), PHP_URL_SCHEME) === 'https';
|
||||||
$rewrite_base_url = $site_url ? $site_url : SELF_URL_PATH;
|
$rewrite_base_url = $site_url ? $site_url : SELF_URL_PATH;
|
||||||
|
|
||||||
$entries = $xpath->query('(//a[@href]|//img[@src]|//video/source[@src])');
|
$entries = $xpath->query('(//a[@href]|//img[@src]|//video/source[@src]|//audio/source[@src])');
|
||||||
|
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
|
|
||||||
|
@ -910,6 +910,9 @@
|
||||||
if ($entry->hasAttribute('src')) {
|
if ($entry->hasAttribute('src')) {
|
||||||
$src = rewrite_relative_url($rewrite_base_url, $entry->getAttribute('src'));
|
$src = rewrite_relative_url($rewrite_base_url, $entry->getAttribute('src'));
|
||||||
|
|
||||||
|
// check cache only for video and images for the time being
|
||||||
|
if ($entry->nodeName == 'img' || ($entry->parentNode && $entry->parentNode->nodeName == "video")) {
|
||||||
|
|
||||||
$extension = $entry->tagName == 'source' ? '.mp4' : '.png';
|
$extension = $entry->tagName == 'source' ? '.mp4' : '.png';
|
||||||
$cached_filename = CACHE_DIR . '/images/' . sha1($src) . $extension;
|
$cached_filename = CACHE_DIR . '/images/' . sha1($src) . $extension;
|
||||||
|
|
||||||
|
@ -924,6 +927,7 @@
|
||||||
$entry->removeAttribute('sizes');
|
$entry->removeAttribute('sizes');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$entry->setAttribute('src', $src);
|
$entry->setAttribute('src', $src);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue