1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 17:59:55 +02:00

New mobile app assets

This commit is contained in:
DanieL 2023-01-04 10:29:20 -03:00
parent a4bfad10dc
commit 02fd89e23b
9 changed files with 1133 additions and 1122 deletions

File diff suppressed because it is too large Load diff

View file

@ -267,10 +267,12 @@ class API extends PluginAbstract {
global $global; global $global;
$playlists = AVideoPlugin::loadPlugin("PlayLists"); $playlists = AVideoPlugin::loadPlugin("PlayLists");
if (empty($parameters['playlists_id'])) { if (empty($parameters['playlists_id'])) {
return new ApiObject("Playlist ID is empty", true, $parameters); //return new ApiObject("Playlist ID is empty", true, $parameters);
$_POST['sort']['created'] = 'DESC';
$videos = Video::getAllVideos();
} else {
$videos = PlayLists::getOnlyVideosAndAudioIDFromPlaylistLight($parameters['playlists_id']);
} }
$videos = PlayLists::getOnlyVideosAndAudioIDFromPlaylistLight($parameters['playlists_id']);
if (empty($videos)) { if (empty($videos)) {
return new ApiObject("There are no videos for this playlist", true, $parameters); return new ApiObject("There are no videos for this playlist", true, $parameters);
} }
@ -315,6 +317,12 @@ class API extends PluginAbstract {
$parameters['videos'][$key]['info'] = Video::getTags($value['id']); $parameters['videos'][$key]['info'] = Video::getTags($value['id']);
$parameters['videos'][$key]['category'] = Category::getCategory($value['categories_id']); $parameters['videos'][$key]['category'] = Category::getCategory($value['categories_id']);
$parameters['videos'][$key]['media_session'] = Video::getMediaSession($value['id']);
$parameters['videos'][$key]['images'] = Video::getImageFromFilename_($value['filename'], $value['type']);
if (!empty($parameters['audioOnly'])) {
$parameters['videos'][$key]['mp3'] = convertVideoToMP3FileIfNotExists($value['id']);
}
} }
if (empty($parameters['totalPlaylistDuration'])) { if (empty($parameters['totalPlaylistDuration'])) {
$parameters['percentage_progress'] = 0; $parameters['percentage_progress'] = 0;
@ -330,6 +338,19 @@ class API extends PluginAbstract {
return new ApiObject("", false, $parameters); return new ApiObject("", false, $parameters);
} }
/**
* @param string $parameters
* 'APISecret' to list all videos
* 'playlists_id' the program id
* 'index' the position of the video
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&playlists_id=1&index=2&APISecret={APISecret}
* @return \ApiObject
*/
public function get_api_audio_from_program($parameters) {
$parameters['audioOnly'] = 1;
return $this->get_api_video_from_program($parameters);
}
/** /**
* @param string $parameters * @param string $parameters
* 'APISecret' to list all videos * 'APISecret' to list all videos
@ -948,22 +969,36 @@ class API extends PluginAbstract {
public function get_api_programs($parameters) { public function get_api_programs($parameters) {
global $global; global $global;
require_once $global['systemRootPath'] . 'objects/playlist.php'; require_once $global['systemRootPath'] . 'objects/playlist.php';
$playlists = PlayList::getAll();
$config = new Configuration();
$users_id = User::getId();
$list = []; $list = [];
foreach ($playlists as $value) { $obj = new stdClass();
$videosArrayId = PlayList::getVideosIdFromPlaylist($value['id']); $obj->id = 0;
if (empty($videosArrayId) || $value['status'] == "favorite" || $value['status'] == "watch_later") { $obj->photo = $config->getFavicon(true);
continue; $obj->channelLink = $global['webSiteRootURL'];
$obj->username = $config->getWebSiteTitle();
$obj->name = __('Date added');
$obj->link = $global['webSiteRootURL'];
$list[] = $obj;
if (!empty($users_id)) {
//getAllFromUserLight($userId, $publicOnly = true, $status = false, $playlists_id = 0, $onlyWithVideos = false, $includeSeries = false)
$playlists = PlayList::getAllFromUserLight($users_id, false, false, 0, true, true);
foreach ($playlists as $value) {
$videosArrayId = PlayList::getVideosIdFromPlaylist($value['id']);
if (empty($videosArrayId) || $value['status'] == "favorite" || $value['status'] == "watch_later") {
continue;
}
$obj = new stdClass();
$obj->id = $value['id'];
$obj->photo = User::getPhoto($value['users_id']);
$obj->channelLink = User::getChannelLink($value['users_id']);
$obj->username = User::getNameIdentificationById($value['users_id']);
$obj->name = $value['name'];
$obj->link = PlayLists::getLink($value['id']);
$list[] = $obj;
} }
$obj = new stdClass(); }
$obj->id = $value['id'];
$obj->photo = User::getPhoto($value['users_id']);
$obj->channelLink = User::getChannelLink($value['users_id']);
$obj->username = User::getNameIdentificationById($value['users_id']);
$obj->name = $value['name'];
$obj->link = PlayLists::getLink($value['id']);
$list[] = $obj;
}
return new ApiObject("", false, $list); return new ApiObject("", false, $list);
} }

View file

@ -97,14 +97,4 @@ class MobileManager extends PluginAbstract
return $obj; return $obj;
} }
public function upload()
{
}
public function getHTMLMenuLeft() {
global $global;
include $global['systemRootPath'] . 'plugin/MobileManager/HTMLMenuLeft.php';
}
} }

View file

@ -1,8 +1,5 @@
<?php <?php
if(!isOnDeveloperMode()){ $obj = AVideoPlugin::getObjectDataIfEnabled('MobileYPT');
return false;
}
$obj = AVideoPlugin::getObjectDataIfEnabled('MobileManager');
$url = 'http://192.168.1.4/youphptube.com/mobile/qrcode/'; $url = 'http://192.168.1.4/youphptube.com/mobile/qrcode/';
$url = 'https://youphp.tube/mobile/qrcode/'; $url = 'https://youphp.tube/mobile/qrcode/';
$url = addQueryStringParameter($url, 'site', $global['webSiteRootURL']); $url = addQueryStringParameter($url, 'site', $global['webSiteRootURL']);

View file

@ -0,0 +1,80 @@
<?php
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
require_once $global['systemRootPath'] . 'objects/video.php';
class MobileYPT extends PluginAbstract {
public function getTags() {
return [
PluginTags::$FREE,
PluginTags::$MOBILE,
];
}
public static function getVersion() {
return 2;
}
public function getDescription() {
$desc = "Manage the Mobile YPTApp";
$desc .= $this->isReadyLabel(['API']);
return $desc;
}
public function getName() {
return "MobileYPT";
}
public function getUUID() {
return "MobileYPT-184efe715c09";
}
public function getPluginVersion() {
return "1.0";
}
public function getEmptyDataObject() {
global $global;
$obj = new stdClass();
$obj->doNotAllowAnonimusAccess = false;
$obj->doNotAllowUpload = false;
$obj->hideCreateAccount = false;
$o = new stdClass();
$o->type = "textarea";
$o->value = "This Software must be used for Good, never Evil. There is no tolerance for objectionable content or abusive users. It is expressly forbidden to use this app to build porn sites, violence, racism or anything else that affects human integrity or denigrates the image of anyone.\n"
. "Any complaints, or through the application or any other electronic means will be analyzed and in case of any criteria established by the developer or local laws, are disrespected, we reserve the right to block and ban any site from our systems\n"
. "The banned site will be prohibited from using any of our resources, including mobile applications, encoder, plugins, etc.";
$obj->EULA = $o;
$obj->enableLivePublisher = true;
$obj->enableAudioPlayer = true;
return $obj;
}
public function getStart() {
$videos_id = getVideos_id();
self::getCheckMP3($videos_id);
}
public function onNewVideo($videos_id) {
self::getCheckMP3($videos_id);
}
static function getCheckMP3($videos_id) {
if (!empty($videos_id)) {
$obj = AVideoPlugin::getDataObject('MobileYPT');
if ($obj->enableAudioPlayer) {
return convertVideoToMP3FileIfNotExists($videos_id);
}
}
return false;
}
public function getHTMLMenuLeft() {
global $global;
include $global['systemRootPath'] . 'plugin/MobileYPT/HTMLMenuLeft.php';
}
}

View file

@ -0,0 +1,77 @@
<?php
header('Access-Control-Allow-Headers: Content-Type');
header('Content-Type: application/json');
require_once dirname(__FILE__) . '/../../videos/configuration.php';
allowOrigin();
$objMM = AVideoPlugin::getObjectData("MobileYPT");
$customizeUser = AVideoPlugin::getDataObject('CustomizeUser');
$objMM->doNotShowPhoneOnSignup = $customizeUser->doNotShowPhoneOnSignup;
$chat2 = AVideoPlugin::getDataObjectIfEnabled('Chat2');
if(!empty($chat2)){
$objMM->chat2ShowOnLive = $chat2->showOnLive;
$objMM->chat2ShowOnUserVideos = $chat2->showOnUserVideos;
}else{
$objMM->chat2ShowOnLive = false;
$objMM->chat2ShowOnUserVideos = false;
}
$objMM->homePageURL = AVideoPlugin::getMobileHomePageURL();
$objMM->logo = getURL($config->getLogo());
$objMM->favicon = $config->getFavicon(true);
$objMM->title = $config->getWebSiteTitle();
$objMM->version = $config->getVersion();
$objMM->EULA_original = $objMM->EULA->value;
$objMM->EULA = nl2br($objMM->EULA->value);
$objMM->YPTSocket = AVideoPlugin::getDataObjectIfEnabled('YPTSocket');
$objMM->language = $config->getLanguage();
@include_once "{$global['systemRootPath']}locale/{$objMM->language}.php";
$objMM->translations = $t;
if (!empty($objMM->YPTSocket)) {
$refl = new ReflectionClass('SocketMessageType');
$objMM->webSocketTypes = json_encode($refl->getConstants());
$objMM->webSocketURL = addQueryStringParameter(YPTSocket::getWebSocketURL(true), 'page_title', 'Mobile APP');
}
$objMM->tabMenuItems = [];
$objMM->leftMenuItems = [];
$objMM->tabMenuItemsInABrowser = [];
$objMM->leftMenuItemsInABrowser = [];
if (AVideoPlugin::isEnabledByName("TopMenu")) {
if (empty($_POST['sort'])) {
$_POST['sort'] = ['item_order'=>"ASC"];
}
$tabMenu = Menu::getAllActive(Menu::$typeMobileTabMenu);
foreach ($tabMenu as $key => $value) {
$menuItems = MenuItem::getAllFromMenu($value['id'], true);
foreach ($menuItems as $value2) {
$objMM->tabMenuItems[] = $value2;
}
}
$tabMenu = Menu::getAllActive(Menu::$typeMobileLeftMenu);
foreach ($tabMenu as $key => $value) {
$menuItems = MenuItem::getAllFromMenu($value['id'], true);
foreach ($menuItems as $value2) {
$objMM->leftMenuItems[] = $value2;
}
}
$tabMenu = Menu::getAllActive(Menu::$typeMobileTabMenuInABrowser);
foreach ($tabMenu as $key => $value) {
$menuItems = MenuItem::getAllFromMenu($value['id'], true);
foreach ($menuItems as $value2) {
$value2['target'] = '_blank';
$objMM->tabMenuItems[] = $value2;
}
}
$tabMenu = Menu::getAllActive(Menu::$typeMobileLeftMenuInABrowser);
foreach ($tabMenu as $key => $value) {
$menuItems = MenuItem::getAllFromMenu($value['id'], true);
foreach ($menuItems as $value2) {
$value2['target'] = '_blank';
$objMM->leftMenuItems[] = $value2;
}
}
}
echo json_encode($objMM);

174
plugin/MobileYPT/index.php Normal file
View file

@ -0,0 +1,174 @@
<?php
global $global, $config;
$global['isIframe'] = 1;
// is online
// recorder
// live users
$global['ignoreUserMustBeLoggedIn'] = 1;
if (!isset($global['systemRootPath'])) {
$configFile = '../../videos/configuration.php';
require_once $configFile;
}
$bodyClass = '';
$key = '';
$live_servers_id = '';
$live_index = '';
$users_id = User::getId();
if (!empty($_REQUEST['logoff'])) {
User::logoff();
}
$html = '';
if (!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
User::loginFromRequest();
}
if (User::isLogged()) {
if (!empty($_REQUEST['key'])) {
$key = $_REQUEST['key'];
$live_servers_id = @$_REQUEST['live_servers_id'];
$live_index = @$_REQUEST['live_index'];
} else if (User::isLogged()) {
$lth = LiveTransmitionHistory::getLatestFromUser($users_id);
$key = $lth['key'];
$live_servers_id = $lth['live_servers_id'];
$live_index = $lth['live_index'];
}
if (!empty($key)) {
$isLive = 1;
setLiveKey($key, $live_servers_id, $live_index);
if (!empty(LiveTransmitionHistory::isLive($key, $live_servers_id))) {
$bodyClass = 'isLiveOnline';
}
}
if (isLive()) {
//var_dump($livet, $getLiveKey, isLive());exit;
if (AVideoPlugin::isEnabledByName('Chat2')) {
$chat = new ChatIframeOptions();
$chat->set_room_users_id($users_id);
$chat->set_live_transmitions_history_id($latest['id']);
$chat->set_iframe(1);
$chat->set_noFade(1);
$chat->set_bubblesOnly(1);
$chat->set_addChatTextBox(1);
$chat->set_doNotAllowUsersSendMessagesToEachOther(1);
$chat->set_hideBubbleButtons(1);
$iframeURL = $chat->getURL(true);
$html = '<iframe
id="yptchat2Iframe"
src="' . $iframeURL . '"
frameborder="0" scrolling="no" title="chat widget"
allowtransparency="true"
sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-presentation allow-top-navigation"
style="
outline: none;
visibility: visible;
resize: none;
box-shadow: none;
overflow: visible;
background: none transparent;
opacity: 1;
padding: 0px;
margin: 0px;
transition-property: none;
transform: none;
width: 100%;
z-index: 999999;
cursor: auto;
float: none;
border-radius: unset;
pointer-events: auto;
display: block;
height: 100vh;"></iframe>';
//include "{$global['systemRootPath']}plugin/Chat2/index.php";
//return false;
}
if (AVideoPlugin::isEnabledByName('LiveUsers')) {
$html .= getLiveUsersLabelHTML();
//$html .= '<div id="LiveUsersLabelLive">'.getLiveUsersLabelLive($livet['key'], $livet['live_servers_id']).'</div>';
//$html .= '<div id="LiveUsersLabelLive">'.getLiveUsersLabelLive($lt['key'], $lt['live_servers_id']).'</div>';
//$html .= getIncludeFileContent($global['systemRootPath'] . 'plugin/Live/view/menuRight.php');
//var_dump($lt);exit;
}
if (AVideoPlugin::isEnabledByName('SendRecordedToEncoder')) {
$html .= '<!-- SendRecordedToEncoder start -->';
$html .= getIncludeFileContent($global['systemRootPath'] . 'plugin/SendRecordedToEncoder/actionButtonLive.php');
$html .= '<!-- SendRecordedToEncoder end -->';
}
}
} else {
header("Location: {$global['webSiteRootURL']}plugin/MobileYPT/loginPage.php");
exit;
}
?>
<!DOCTYPE html>
<html lang="">
<head>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<style>
#accessibility-toolbar, footer, #socket_info_container{
display: none !important;
}
body {
padding: 0;
}
.liveUsersLabel{
position: fixed;
top: 10px !important;
}
.liveUsersLabel{
left: 20px !important;
}
#recorderToEncoderActionButtons{
position: absolute;
top: 40px;
left: 0;
width: 100%;
}
.showWhenClosed, #closeRecorderButtons{
display: none;
}
#recorderToEncoderActionButtons.closed .recordLiveControlsDiv,
#recorderToEncoderActionButtons.closed .hideWhenClosed{
display: none !important;
}
#recorderToEncoderActionButtons.closed .showWhenClosed,
.isLiveOnline #closeRecorderButtons{
display: inline-block !important;
}
</style>
</head>
<body style="background-color: transparent; <?php echo $bodyClass; ?>">
<?php
echo $html;
?>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script>
function socketLiveONCallback(json) {
console.log('socketLiveONCallback MobileYPT', json);
if ((json.users_id == '<?php echo User::getId(); ?>' && json.live_transmitions_history_id) || (!empty(json.key) && json.key == '<?php echo @$_REQUEST['key']; ?>')) {
modal.showPleaseWait();
var url = addGetParam(window.location.href, 'live_transmitions_history_id', json.live_transmitions_history_id);
url = addGetParam(url, 'key', json.key);
url = addGetParam(url, 'live_servers_id', json.live_servers_id);
url = addGetParam(url, 'live_schedule', json.live_schedule);
url = addGetParam(url, 'live_index', json.live_index);
document.location = url;
}
}
</script>
</body>
</html>

View file

@ -0,0 +1,84 @@
<?php
global $global, $config;
$global['isIframe'] = 1;
// is online
// recorder
// live users
$global['ignoreUserMustBeLoggedIn'] = 1;
if (!isset($global['systemRootPath'])) {
$configFile = '../../videos/configuration.php';
require_once $configFile;
}
if (!empty($_REQUEST['logoff'])) {
User::logoff();
}
$html = '';
if (!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
User::loginFromRequest();
}
if (User::isLogged()) {
$html .= getIncludeFileContent($global['systemRootPath'] . 'plugin/MobileYPT/userButtons.php');
} else {
if (!empty($_REQUEST['SignUp'])) {
$html .= getIncludeFileContent($global['systemRootPath'] . 'view/userSignUpBody.php');
} else {
$redirectUri = "{$global['webSiteRootURL']}plugin/MobileYPT/loginPage.php";
if (empty($signUpURL)) {
$signUpURL = addQueryStringParameter($redirectUri, 'SignUp', 1);
}
$html .= getIncludeFileContent($global['systemRootPath'] . 'view/userLogin.php', array('signUpURL' => $signUpURL, '_GET[\'redirectUri\']' => $redirectUri, 'hideRememberMe' => 1));
}
}
?>
<!DOCTYPE html>
<html lang="">
<head>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<style>
#accessibility-toolbar, footer, #socket_info_container{
display: none !important;
}
body {
padding: 0;
}
.liveUsersLabel{
position: fixed;
top: 10px !important;
}
.liveUsersLabel{
left: 20px !important;
}
#recorderToEncoderActionButtons{
position: absolute;
top: 40px;
left: 0;
width: 100%;
}
.showWhenClosed, #closeRecorderButtons{
display: none;
}
#recorderToEncoderActionButtons.closed .recordLiveControlsDiv,
#recorderToEncoderActionButtons.closed .hideWhenClosed{
display: none !important;
}
#recorderToEncoderActionButtons.closed .showWhenClosed,
.isLiveOnline #closeRecorderButtons{
display: inline-block !important;
}
</style>
</head>
<body style="background-color: transparent; <?php echo $bodyClass; ?>">
<?php
echo $html;
?>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
</body>
</html>

View file

@ -45,6 +45,14 @@ try {
height = $('body').height(); height = $('body').height();
} }
parent.postMessage({height: height}, '*'); parent.postMessage({height: height}, '*');
}else if (e.data.play) {
var currentTime = e.data.play.currentTime;
var muted = !empty(e.data.play.muted);
if(!muted){
playerPlay(currentTime);
}else{
tryToPlayMuted(currentTime);
}
} }
}, false); }, false);