mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-22 07:21:28 +00:00
Merge branch 'master' into master
This commit is contained in:
@@ -1751,9 +1751,10 @@ class Feeds extends Handler_Protected {
|
|||||||
author, score,
|
author, score,
|
||||||
(SELECT count(label_id) FROM ttrss_user_labels2 WHERE article_id = ttrss_entries.id) AS num_labels,
|
(SELECT count(label_id) FROM ttrss_user_labels2 WHERE article_id = ttrss_entries.id) AS num_labels,
|
||||||
(SELECT count(id) FROM ttrss_enclosures WHERE post_id = ttrss_entries.id) AS num_enclosures
|
(SELECT count(id) FROM ttrss_enclosures WHERE post_id = ttrss_entries.id) AS num_enclosures
|
||||||
FROM ttrss_entries, ttrss_user_entries, ttrss_tags, ttrss_feeds
|
FROM ttrss_entries,
|
||||||
|
ttrss_user_entries LEFT JOIN ttrss_feeds ON (ttrss_feeds.id = ttrss_user_entries.feed_id),
|
||||||
|
ttrss_tags
|
||||||
WHERE
|
WHERE
|
||||||
ttrss_feeds.id = ttrss_user_entries.feed_id AND
|
|
||||||
ref_id = ttrss_entries.id AND
|
ref_id = ttrss_entries.id AND
|
||||||
ttrss_user_entries.owner_uid = ".$pdo->quote($owner_uid)." AND
|
ttrss_user_entries.owner_uid = ".$pdo->quote($owner_uid)." AND
|
||||||
post_int_id = int_id AND
|
post_int_id = int_id AND
|
||||||
|
|||||||
@@ -487,4 +487,26 @@ class UrlHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function url_to_youtube_vid($url) {
|
||||||
|
$url = str_replace("youtube.com", "youtube-nocookie.com", $url);
|
||||||
|
|
||||||
|
$regexps = [
|
||||||
|
"/\/\/www\.youtube-nocookie\.com\/v\/([\w-]+)/",
|
||||||
|
"/\/\/www\.youtube-nocookie\.com\/embed\/([\w-]+)/",
|
||||||
|
"/\/\/www\.youtube-nocookie\.com\/watch?v=([\w-]+)/",
|
||||||
|
"/\/\/youtu.be\/([\w-]+)/",
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($regexps as $re) {
|
||||||
|
$matches = [];
|
||||||
|
|
||||||
|
if (preg_match($re, $url, $matches)) {
|
||||||
|
return $matches[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -282,7 +282,11 @@ const Article = {
|
|||||||
console.log("packing", row.id);
|
console.log("packing", row.id);
|
||||||
row.setAttribute("data-is-packed", "1");
|
row.setAttribute("data-is-packed", "1");
|
||||||
|
|
||||||
row.querySelector(".content-inner").innerHTML = `<div class="text-center text-muted">
|
const content_inner = row.querySelector(".content-inner");
|
||||||
|
|
||||||
|
// missing in unexpanded mode
|
||||||
|
if (content_inner)
|
||||||
|
content_inner.innerHTML = `<div class="text-center text-muted">
|
||||||
${__("Loading, please wait...")}
|
${__("Loading, please wait...")}
|
||||||
</div>`
|
</div>`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -425,13 +425,7 @@ class Af_RedditImgur extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$matches = array();
|
$matches = array();
|
||||||
if (!$found && (preg_match("/youtube\.com\/v\/([\w-]+)/", $entry_href, $matches) ||
|
if (!$found && $vid_id = UrlHelper::url_to_youtube_vid($entry_href)) {
|
||||||
preg_match("/youtube\.com\/.*?[\&\?]v=([\w-]+)/", $entry_href, $matches) ||
|
|
||||||
preg_match("/youtube\.com\/embed\/([\w-]+)/", $entry_href, $matches) ||
|
|
||||||
preg_match("/youtube\.com\/watch\?v=([\w-]+)/", $entry_href, $matches) ||
|
|
||||||
preg_match("/\/\/youtu.be\/([\w-]+)/", $entry_href, $matches))) {
|
|
||||||
|
|
||||||
$vid_id = $matches[1];
|
|
||||||
|
|
||||||
Debug::log("Handling as youtube: $vid_id", Debug::LOG_VERBOSE);
|
Debug::log("Handling as youtube: $vid_id", Debug::LOG_VERBOSE);
|
||||||
|
|
||||||
|
|||||||
@@ -16,18 +16,16 @@ class Af_Youtube_Embed extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hook_iframe_whitelisted($src) {
|
function hook_iframe_whitelisted($src) {
|
||||||
return in_array($src, ["www.youtube.com", "youtube.com", "youtu.be"]);
|
return in_array($src, ["www.youtube.com", "youtube.com",
|
||||||
|
"www.youtube-nocookie.com", "youtube-nocookie.com",
|
||||||
|
"youtu.be"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hook_render_enclosure($entry, $hide_images) {
|
function hook_render_enclosure($entry, $hide_images) {
|
||||||
|
|
||||||
$matches = array();
|
$url = $entry["content_url"];
|
||||||
|
|
||||||
if (preg_match("/\/\/www\.youtube\.com\/v\/([\w-]+)/", $entry["content_url"], $matches) ||
|
if ($vid_id = UrlHelper::url_to_youtube_vid($url)) {
|
||||||
preg_match("/\/\/www\.youtube\.com\/watch?v=([\w-]+)/", $entry["content_url"], $matches) ||
|
|
||||||
preg_match("/\/\/youtu.be\/([\w-]+)/", $entry["content_url"], $matches)) {
|
|
||||||
|
|
||||||
$vid_id = $matches[1];
|
|
||||||
|
|
||||||
return "<div class='embed-responsive'>
|
return "<div class='embed-responsive'>
|
||||||
<iframe class='youtube-player'
|
<iframe class='youtube-player'
|
||||||
|
|||||||
Reference in New Issue
Block a user