Compare commits

...

4 commits

Author SHA1 Message Date
Michael 79d144740f Issue 13812: Public groups with manual request approval 2024-04-16 05:05:13 +00:00
Hypolite Petovan 38466415b3 Merge pull request '[invidious] Now replaces YouTube links without a leading "www."' (#1494) from loma-one/friendica-addons:develop into develop
Reviewed-on: friendica/friendica-addons#1494
Reviewed-by: Hypolite Petovan <hypolite@mrpetovan.com>
2024-04-15 07:12:31 +02:00
loma-one 3bf547ee6e invidious/invidious.php aktualisiert
Note taken from @MrPetovan
2024-04-15 01:12:06 -04:00
loma-one 9627e95b19 invidious/invidious.php aktualisiert
Now intercepts YouTube links without a leading "www".
2024-04-15 01:08:29 -04:00
3 changed files with 12 additions and 12 deletions

View file

@ -104,8 +104,8 @@ function forumdirectory_content()
$total = 0;
$cnt = DBA::fetchFirst("SELECT COUNT(*) AS `total` FROM `profile`
INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND `user`.`page-flags` = ? $sql_extra",
User::PAGE_FLAGS_COMMUNITY);
WHERE $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND `user`.`page-flags` IN (?, ?) $sql_extra",
User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_COMM_MAN);
if (DBA::isResult($cnt)) {
$total = $cnt['total'];
}
@ -120,8 +120,8 @@ function forumdirectory_content()
`contact`.`addr`, `contact`.`url` FROM `profile`
INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid`
WHERE $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND `user`.`page-flags` = ? AND `contact`.`self`
$sql_extra $order LIMIT $limit", User::PAGE_FLAGS_COMMUNITY
WHERE $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND `user`.`page-flags` IN (?, ?) AND `contact`.`self`
$sql_extra $order LIMIT $limit", User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_COMM_MAN
);
if (DBA::isResult($r)) {

View file

@ -101,8 +101,8 @@ function groupdirectory_content()
$total = 0;
$cnt = DBA::fetchFirst("SELECT COUNT(*) AS `total` FROM `profile`
INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND `user`.`page-flags` = ? $sql_extra",
User::PAGE_FLAGS_COMMUNITY);
WHERE $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND `user`.`page-flags` IN (?, ?) $sql_extra",
User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_COMM_MAN);
if (DBA::isResult($cnt)) {
$total = $cnt['total'];
}
@ -117,8 +117,8 @@ function groupdirectory_content()
`contact`.`addr`, `contact`.`url` FROM `profile`
INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid`
WHERE $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND `user`.`page-flags` = ? AND `contact`.`self`
$sql_extra $order LIMIT $limit", User::PAGE_FLAGS_COMMUNITY
WHERE $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND `user`.`page-flags` IN (?, ?) AND `contact`.`self`
$sql_extra $order LIMIT $limit", User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_COMM_MAN
);
if (DBA::isResult($r)) {

View file

@ -2,7 +2,7 @@
/*
* Name: invidious
* Description: Replaces links to youtube.com to an invidious instance in all displays of postings on a node.
* Version: 0.3
* Version: 0.4
* Author: Matthias Ebers <https://loma.ml/profile/feb>
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
* Status: Unsupported
@ -93,9 +93,9 @@ function invidious_render(array &$b)
$original = $b['html'];
$server = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'invidious', 'server', DI::config()->get('invidious', 'server', INVIDIOUS_DEFAULT));
$b['html'] = preg_replace("/https?:\/\/www.youtube.com\/watch\?v\=(.*?)/ism", $server . '/watch?v=$1', $b['html']);
$b['html'] = preg_replace("/https?:\/\/www.youtube.com\/embed\/(.*?)/ism", $server . '/embed/$1', $b['html']);
$b['html'] = preg_replace("/https?:\/\/www.youtube.com\/shorts\/(.*?)/ism", $server . '/shorts/$1', $b['html']);
$b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/watch\?v=(.*?)~ism", $server . '/watch?v=$1', $b['html']);
$b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/embed/(.*?)~ism", $server . '/embed/$1', $b['html']);
$b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/shorts/(.*?)~ism", $server . '/shorts/$1', $b['html']);
$b['html'] = preg_replace("/https?:\/\/youtu.be\/(.*?)/ism", $server . '/watch?v=$1', $b['html']);
if ($original != $b['html']) {