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

Update allowed file extensions in cleanDirectory function and enhance video filename handling to support forceIndex for both mp4 and mp3 formats. Add poster URL retrieval in getLiveKey.json.php for improved live stream metadata.

This commit is contained in:
Daniel Neto 2025-06-18 12:54:03 -03:00
parent 33cdfff043
commit bdfb58ef36
3 changed files with 9 additions and 3 deletions

View file

@ -137,7 +137,7 @@ function requestComesFromSafePlace()
* @param array $allowedExtensions
* @return string
*/
function cleanDirectory($dir, $allowedExtensions = ['key', 'm3u8', 'ts', 'vtt', 'jpg', 'gif', 'mp3', 'webm', 'webp'])
function cleanDirectory($dir, $allowedExtensions = ['key', 'm3u8', 'ts', 'vtt', 'jpg', 'gif', 'mp3', 'mp4', 'webm', 'webp'])
{
$ffs = scandir($dir);

View file

@ -4441,14 +4441,14 @@ if (!class_exists('Video')) {
} else {
$url = getCDN() . "{$relative}";
}
if ($cleanVideoFilename == 'index' && preg_match('/index.mp4$/', $videoFilename)) {
if ((!empty($_REQUEST['forceIndex']) && preg_match('/.mp4$/', $videoFilename)) || ($cleanVideoFilename == 'index' && preg_match('/index.mp4$/', $videoFilename))) {
$folder = str_replace('/index.mp4', '', $videoFilename);
$cleanVideoFilename = "$folder/index.mp4";
$relative = ("videos/{$cleanVideoFilename}");
$path = ("{$videosDir}{$cleanVideoFilename}");
$url = getCDN() . "{$cleanVideoFilename}";
$__getPaths[$videoFilename] = ['filename' => $cleanVideoFilename, 'path' => $path, 'url' => $url, 'relative' => $relative, 'videoFilename' => $videoFilename];
} else if ($cleanVideoFilename == 'index' && preg_match('/index.mp3$/', $videoFilename)) {
} else if ((!empty($_REQUEST['forceIndex']) && preg_match('/.mp3$/', $videoFilename)) || ($cleanVideoFilename == 'index' && preg_match('/index.mp3$/', $videoFilename))) {
$folder = str_replace('/index.mp3', '', $videoFilename);
$cleanVideoFilename = "$folder/index.mp3";
$relative = ("videos/{$cleanVideoFilename}");

View file

@ -64,6 +64,7 @@ if (empty($parametersJson) || empty($parametersJson->{'restream.ypt.me'})) {
'title' => $lt['title'],
'description' => $lt['description'],
'parameters64' => base64_encode(json_encode($parametersJson->{'restream.ypt.me'})),
'poster_url' => Live::getPosterThumbsImage($lt['users_id'], $lt['live_servers_id']),
);
if (!empty($_REQUEST['live_schedule_id'])) {
@ -75,6 +76,11 @@ if (empty($parametersJson) || empty($parametersJson->{'restream.ypt.me'})) {
if (!empty($ls->getDescription())) {
$array['description'] = $ls->getDescription();
}
$poster_url = $ls->getPosterURL(@$_REQUEST['live_schedule_id'], @$_REQUEST['ppv_schedule_id']);
if (!empty($poster_url)) {
$array['poster_url'] = $poster_url;
}
}
$response = postVariables($url, $array, false);