1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +02:00
This commit is contained in:
DanielnetoDotCom 2021-01-29 18:10:02 -03:00
parent d2b03a1011
commit 75bd236da6
4 changed files with 38 additions and 33 deletions

View file

@ -43,13 +43,14 @@ class Message implements MessageComponentInterface {
$client['user_name'] = $json->user_name;
$client['browser'] = $json->browser;
$client['yptDeviceId'] = $json->yptDeviceId;
$client['client'] = deviceIdToObject($json->yptDeviceId);
if(!empty($wsocketGetVars['webSocketSelfURI'])){
$client['selfURI'] = $wsocketGetVars['webSocketSelfURI'];
}else{
$client['selfURI'] = $json->selfURI;
}
$client['isCommandLine'] = $wsocketGetVars['isCommandLine'];
$client['page_title'] = utf8_encode($wsocketGetVars['page_title']);
$client['page_title'] = utf8_encode(@$wsocketGetVars['page_title']);
$client['videos_id'] = $json->videos_id;
$client['live_key'] = object_to_array(@$json->live_key);
$client['autoEvalCodeOnHTML'] = $json->autoEvalCodeOnHTML;

View file

@ -37,7 +37,7 @@ class YPTSocket extends PluginAbstract {
}
public static function getServerVersion() {
return "2.2";
return "2.3";
}
public function updateScript() {
@ -127,6 +127,7 @@ class YPTSocket extends PluginAbstract {
//echo "Received: {$msg}\n";
//$conn->close();
$SocketSendResponseObj->error = false;
$SocketSendResponseObj->msg = $msg;
});
foreach ($SocketSendUsers_id as $users_id) {

View file

@ -124,19 +124,22 @@ if (!empty($obj->debugAllUsersSocket) || (User::isAdmin() && !empty($obj->debugS
.socketUserDiv.visible .socketUserPages{
display: block;
}
.socketButtons{
margin-left: 10px;
}
</style>
<div id="socket_info_container" class="hidden-xs socketStatus disconnected <?php echo $socket_info_container_class; ?>" >
<div class="socketTitle">
<div class=" ">
<div class="pull-left">
<?php
echo getSocketConnectionLabel();
?>
</div>
<div class="pull-right">
<button class="btn btn-xs" id="socketBtnMinimize">
<div class="pull-right socketButtons">
<button class="btn btn-default btn-xs" id="socketBtnMinimize">
<i class="fas fa-window-minimize"></i>
</button>
<button class="btn btn-xs maximize" id="socketBtnMaximize">
<button class="btn btn-default btn-xs maximize" id="socketBtnMaximize">
<i class="far fa-window-maximize"></i>
</button>
</div>

View file

@ -90,9 +90,9 @@ function defaultCallback(json) {
function parseSocketResponse(json) {
console.log("parseSocketResponse", json);
if(json.isAdmin && webSocketServerVersion>json.webSocketServerVersion){
if(typeof avideoToastWarning == 'funciton'){
avideoToastWarning("Please restart your socket server. You are running (v"+json.webSocketServerVersion+") and your client is expecting (v"+webSocketServerVersion+")");
if (json.isAdmin && webSocketServerVersion > json.webSocketServerVersion) {
if (typeof avideoToastWarning == 'funciton') {
avideoToastWarning("Please restart your socket server. You are running (v" + json.webSocketServerVersion + ") and your client is expecting (v" + webSocketServerVersion + ")");
}
}
if (json && typeof json.autoUpdateOnHTML !== 'undefined') {
@ -105,7 +105,7 @@ function parseSocketResponse(json) {
}
var val = json.autoUpdateOnHTML[prop];
$('.' + prop).text(val);
if(parseInt(val)>0){
if (parseInt(val) > 0) {
$('.' + prop).parent().addClass('text-success');
}
}
@ -136,32 +136,32 @@ function parseSocketResponse(json) {
if (json.users_uri[prop][prop2][prop3] === false || typeof json.users_uri[prop][prop2][prop3] !== 'object') {
continue;
}
var socketUserDivID = 'socketUser'+json.users_uri[prop][prop2][prop3].users_id;
if(!$('#'+socketUserDivID).length){
var html = '<div class="socketUserDiv" id="'+socketUserDivID+'" >';
html += '<div class="socketUserName" onclick="socketUserNameToggle(\'#'+socketUserDivID+'\');">';
html += '<i class="fas fa-caret-down"></i><i class="fas fa-caret-up"></i> <img src="'+webSiteRootURL+'user/' + json.users_uri[prop][prop2][prop3].users_id + '/foto.png" class="img img-circle img-responsive">' + json.users_uri[prop][prop2][prop3].user_name + '</div>';
var socketUserDivID = 'socketUser' + json.users_uri[prop][prop2][prop3].users_id;
if (!$('#' + socketUserDivID).length) {
var html = '<div class="socketUserDiv" id="' + socketUserDivID + '" >';
html += '<div class="socketUserName" onclick="socketUserNameToggle(\'#' + socketUserDivID + '\');">';
html += '<i class="fas fa-caret-down"></i><i class="fas fa-caret-up"></i> <img src="' + webSiteRootURL + 'user/' + json.users_uri[prop][prop2][prop3].users_id + '/foto.png" class="img img-circle img-responsive">' + json.users_uri[prop][prop2][prop3].user_name + '</div>';
html += '<div class="socketUserPages"></div></div>';
$('#socketUsersURI').append(html);
}
var text = '';
if(json.ResourceID == json.users_uri[prop][prop2][prop3].resourceId){
text += '<stcong>(YOU)</strong>' ;
if (json.ResourceID == json.users_uri[prop][prop2][prop3].resourceId) {
text += '<stcong>(YOU)</strong>';
}
text = ' ' + json.users_uri[prop][prop2][prop3].page_title;
text += '<br><small>' + json.users_uri[prop][prop2][prop3].ip+'</small>' ;
if(json.users_uri[prop][prop2][prop3].location){
text += '<br><i class="flagstrap-icon flagstrap-'+json.users_uri[prop][prop2][prop3].location.country_code+'" style="margin-right: 10px;"></i>';
text += ' '+json.users_uri[prop][prop2][prop3].location.country_name;
text += '<br><small>(' + json.users_uri[prop][prop2][prop3].client.browser + ' - ' + json.users_uri[prop][prop2][prop3].client.os + ') ' + json.users_uri[prop][prop2][prop3].ip + '</small>';
if (json.users_uri[prop][prop2][prop3].location) {
text += '<br><i class="flagstrap-icon flagstrap-' + json.users_uri[prop][prop2][prop3].location.country_code + '" style="margin-right: 10px;"></i>';
text += ' ' + json.users_uri[prop][prop2][prop3].location.country_name;
}
html = '<a href="' + json.users_uri[prop][prop2][prop3].selfURI + '" target="_blank" class="btn btn-xs btn-default btn-block"><i class="far fa-compass"></i> '+text+'</a>';
$('#'+socketUserDivID+' .socketUserPages').append(html);
var isVisible = Cookies.get('#'+socketUserDivID);
if(isVisible && isVisible !== 'false'){
$('#'+socketUserDivID).addClass('visible')
html = '<a href="' + json.users_uri[prop][prop2][prop3].selfURI + '" target="_blank" class="btn btn-xs btn-default btn-block"><i class="far fa-compass"></i> ' + text + '</a>';
$('#' + socketUserDivID + ' .socketUserPages').append(html);
var isVisible = Cookies.get('#' + socketUserDivID);
if (isVisible && isVisible !== 'false') {
$('#' + socketUserDivID).addClass('visible')
}
}
}
@ -179,12 +179,12 @@ $(function () {
$.ajax({
url: getWebSocket,
success: function (response) {
if(response.error){
console.log('Getting webSocketToken ERROR '+response.msg);
if(typeof avideoToastError == 'funciton'){
if (response.error) {
console.log('Getting webSocketToken ERROR ' + response.msg);
if (typeof avideoToastError == 'funciton') {
avideoToastError(response.msg);
}
}else{
} else {
console.log('Getting webSocketToken SUCCESS ', response);
webSocketToken = response.webSocketToken;
webSocketURL = response.webSocketURL;