1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

Update restream

This commit is contained in:
DanieL 2022-09-27 15:48:24 -03:00
parent 572480d126
commit a182f7451f
10 changed files with 45 additions and 15 deletions

1
.gitignore vendored
View file

@ -81,3 +81,4 @@ objects/ezyang/
/plugin/VideoOffline/ /plugin/VideoOffline/
/plugin/TestOnly/ /plugin/TestOnly/
view/videoComments_bkp.php view/videoComments_bkp.php
/.compose/

View file

@ -9,7 +9,6 @@ LABEL maintainer="TRW <trw@acoby.de>" \
org.label-schema.vendor="WWBN" org.label-schema.vendor="WWBN"
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
ARG VERSION_ENCODER=3.7
ENV DB_MYSQL_HOST database ENV DB_MYSQL_HOST database
ENV DB_MYSQL_PORT 3306 ENV DB_MYSQL_PORT 3306
@ -76,7 +75,7 @@ RUN chmod 755 /usr/local/bin/docker-entrypoint && \
pip3 install youtube-dl && \ pip3 install youtube-dl && \
cd /var/www/html/AVideo && \ cd /var/www/html/AVideo && \
git config --global advice.detachedHead false && \ git config --global advice.detachedHead false && \
git clone -b $VERSION_ENCODER --depth 1 https://github.com/WWBN/AVideo-Encoder.git Encoder && \ git clone https://github.com/WWBN/AVideo-Encoder.git Encoder && \
chown -R www-data:www-data /var/www/html/AVideo && \ chown -R www-data:www-data /var/www/html/AVideo && \
cd /var/www/html/AVideo/plugin/User_Location/install && \ cd /var/www/html/AVideo/plugin/User_Location/install && \
unzip install.zip && \ unzip install.zip && \

View file

@ -149,7 +149,9 @@ class Cache extends PluginAbstract
if ($isBot && $lifetime < 3600) { if ($isBot && $lifetime < 3600) {
$lifetime = 3600; $lifetime = 3600;
} }
if(empty($_REQUEST['debug_cache'])){
$firstPageCache = ObjectYPT::getCache($cacheName, $lifetime, true); $firstPageCache = ObjectYPT::getCache($cacheName, $lifetime, true);
}
if (!empty($firstPageCache) && strtolower($firstPageCache) != 'false') { if (!empty($firstPageCache) && strtolower($firstPageCache) != 'false') {
if ($isBot && $_SERVER['REQUEST_URI'] !== '/login') { if ($isBot && $_SERVER['REQUEST_URI'] !== '/login') {
//_error_log("Bot Detected, showing the cache ({$_SERVER['REQUEST_URI']}) FROM: {$_SERVER['REMOTE_ADDR']} Browser: {$_SERVER['HTTP_USER_AGENT']}"); //_error_log("Bot Detected, showing the cache ({$_SERVER['REQUEST_URI']}) FROM: {$_SERVER['REMOTE_ADDR']} Browser: {$_SERVER['HTTP_USER_AGENT']}");

View file

@ -516,9 +516,13 @@ class Layout extends PluginAbstract {
static function organizeHTML($html) { static function organizeHTML($html) {
global $global; // add socket twice on live page global $global; // add socket twice on live page
//return $html; //return $html;
if (!empty($global['doNOTOrganizeHTML']) || !empty($_REQUEST['debug'])) { if (!empty($global['doNOTOrganizeHTML'])) {
//var_dump('doNOTOrganizeHTML');exit; //var_dump('doNOTOrganizeHTML');exit;
return $html; return $html.PHP_EOL.'<!-- Layout::organizeHTML doNOTOrganizeHTML -->';
}
if (!empty($_REQUEST['debug'])) {
//var_dump('doNOTOrganizeHTML');exit;
return $html.PHP_EOL.'<!-- Layout::organizeHTML debug -->';
} }
self::$tags = array(); self::$tags = array();
//return $html; //return $html;
@ -685,10 +689,6 @@ class Layout extends PluginAbstract {
public function getEnd() { public function getEnd() {
global $global; global $global;
if(!empty($global['layoutend'])){
return false;
}
$global['layoutend'] = 1;
$html = _ob_get_clean(); $html = _ob_get_clean();
$html = self::organizeHTML($html); $html = self::organizeHTML($html);
//_ob_clean(); //_ob_clean();

View file

@ -103,7 +103,12 @@ class Live_restreams extends ObjectYPT {
$row['restreamsToken'] = encryptString($row['id']); $row['restreamsToken'] = encryptString($row['id']);
$row['display_name'] = getWordOrIcon($row['name'], 'fa-2x'); $row['display_name'] = getWordOrIcon($row['name'], 'fa-2x');
$row['token_expired'] = self::checkIfTokenIsExpired($row['parameters']); $row['token_expired'] = self::checkIfTokenIsExpired($row['parameters']);
$row['valid'] = $row['token_expired']->needToRevalidate?'<i class="fas fa-times"></i>':'<i class="fas fa-check"></i>'; $row['provider'] = self::getProviderName($row['parameters']);
if ($row['token_expired']->needToRevalidate) {
$row['revalidateButton'] = '<button class="btn btn-primary btn-xs" onclick="openRestream(\''.$row['provider'].'\');"><i class="fas fa-sync"></i> '.__("Revalidate").'</button>';
} else {
$row['revalidateButton'] = '<i class="fas fa-check text-success"></i>';
}
$rows[] = $row; $rows[] = $row;
} }
} else { } else {
@ -112,6 +117,22 @@ class Live_restreams extends ObjectYPT {
return $rows; return $rows;
} }
private static function getProviderName($parameters) {
if (is_string($parameters)) {
$parameters = object_to_array(json_decode($parameters));
}
if (!empty($parameters['restream.ypt.me'])) {
foreach ($parameters['restream.ypt.me'] as $key => $value) {
if (preg_match('/(youtube|facebook|twitch)/i', $key)) {
return $key;
}
}
}
return false;
}
private static function checkIfTokenIsExpired($parameters) { private static function checkIfTokenIsExpired($parameters) {
if (is_string($parameters)) { if (is_string($parameters)) {
$parameters = object_to_array(json_decode($parameters)); $parameters = object_to_array(json_decode($parameters));
@ -140,6 +161,7 @@ class Live_restreams extends ObjectYPT {
} }
} }
$obj->isExpired = true; $obj->isExpired = true;
return $obj; return $obj;
} }

View file

@ -75,10 +75,10 @@ if (!Live::canRestream()) {
</div> </div>
<div id="Live_restreamsbtnModelLinks" style="display: none;"> <div id="Live_restreamsbtnModelLinks" style="display: none;">
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<button href="" class="edit_Live_restreams btn btn-default btn-xs"> <button class="edit_Live_restreams btn btn-default btn-xs">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</button> </button>
<button href="" class="delete_Live_restreams btn btn-danger btn-xs"> <button class="delete_Live_restreams btn btn-danger btn-xs">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</button> </button>
</div> </div>
@ -125,7 +125,7 @@ if (!Live::canRestream()) {
}, },
{"data": "status"}, {"data": "status"},
{"data": "stream_key_short"}, {"data": "stream_key_short"},
{"data": "valid"}, {"data": "revalidateButton"},
{ {
sortable: false, sortable: false,
data: null, data: null,

View file

@ -35,7 +35,7 @@ if (!$ms->canManageSchedule()) {
$obj->error = false; $obj->error = false;
ob_end_clean(); _ob_end_clean();
_ob_start(); _ob_start();

View file

@ -13,7 +13,7 @@ $default_socket_timeout = 4;
$cacheTimeout = 60; $cacheTimeout = 60;
$forceRecreate = false; $forceRecreate = false;
if (isCommandLineInterface()) { if (isCommandLineInterface()) {
ob_end_clean(); _ob_end_clean();
_error_log('Commandline: Command line EPG'); _error_log('Commandline: Command line EPG');
$forceRecreate = true; $forceRecreate = true;
$default_socket_timeout = 10; $default_socket_timeout = 10;

View file

@ -77,3 +77,6 @@ $metaDescription = "About Page";
</script> </script>
</body> </body>
</html> </html>
<?php
include $global['systemRootPath'].'objects/include_end.php';
?>

View file

@ -112,3 +112,6 @@ require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php';
</script> </script>
</body> </body>
</html> </html>
<?php
include $global['systemRootPath'].'objects/include_end.php';
?>