mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Improving Sockets
This commit is contained in:
parent
a16246f93d
commit
b12e5c300e
17 changed files with 107 additions and 40 deletions
|
@ -173,7 +173,9 @@ switch ($_GET['page']) {
|
|||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $config->getLanguage(); ?>">
|
||||
<head>
|
||||
<title><?php echo __("Administration") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
|
||||
<?php
|
||||
echo getHTMLTitle(__("Administration"));
|
||||
?>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
if (!empty($includeHead) && file_exists($includeHead)) {
|
||||
|
|
|
@ -48,7 +48,9 @@ sort($vars);
|
|||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $config->getLanguage(); ?>">
|
||||
<head>
|
||||
<title><?php __("Translate AVideo") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
|
||||
<?php
|
||||
echo getHTMLTitle(__("Translate AVideo"));
|
||||
?>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
|
||||
|
|
|
@ -5667,3 +5667,33 @@ function getLiveUsersLabel($viewsClass = "label label-default", $counterClass =
|
|||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function getHTMLTitle($titleArray){
|
||||
global $config, $global;
|
||||
|
||||
if(!is_array($titleArray)){
|
||||
$titleArray = array();
|
||||
}
|
||||
$titleArray[] = $config->getWebSiteTitle();
|
||||
|
||||
$title = implode($config->getPageTitleSeparator(), $titleArray);
|
||||
$global['pageTitle'] = $title;
|
||||
return "<title>{$title}</title>";
|
||||
}
|
||||
|
||||
function getTitle(){
|
||||
global $global;
|
||||
if(empty($global['pageTitle'])){
|
||||
$url = getSelfURI();
|
||||
|
||||
$global['pageTitle'] = str_replace($global['webSiteRootURL'], '', $url);
|
||||
|
||||
if(preg_match('/\/plugin\/([^\/])/i', $url, $matches)){
|
||||
$global['pageTitle'] = __('Plugin').' '.__($matches[1]);
|
||||
}
|
||||
|
||||
$title = $global['pageTitle'];
|
||||
}
|
||||
|
||||
return $global['pageTitle'];
|
||||
}
|
|
@ -55,14 +55,14 @@ if (!(!empty($_GET['user']) && !empty($_GET['recoverpass']))) {
|
|||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $_SESSION['language']; ?>">
|
||||
<head>
|
||||
<title><?php echo __("Recover Password") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php'; ?>
|
||||
echo getHTMLTitle(__("Recover Password"));
|
||||
?>
|
||||
<?php include $global['systemRootPath'] . 'view/include/head.php'; ?>
|
||||
</head>
|
||||
|
||||
<body class="<?php echo $global['bodyClass']; ?>">
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/navbar.php'; ?>
|
||||
<?php include $global['systemRootPath'] . 'view/include/navbar.php'; ?>
|
||||
|
||||
<div class="container">
|
||||
<?php
|
||||
|
@ -100,16 +100,14 @@ if (!(!empty($_GET['user']) && !empty($_GET['recoverpass']))) {
|
|||
<div class="form-group">
|
||||
<label class="col-md-4 control-label"><?php echo __("New Password"); ?></label>
|
||||
<div class="col-md-8 inputGroupContainer">
|
||||
<?php
|
||||
getInputPassword("newPassword", 'class="form-control" required="required" autocomplete="off"', __("New Password")); ?>
|
||||
<?php getInputPassword("newPassword", 'class="form-control" required="required" autocomplete="off"', __("New Password")); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label"><?php echo __("Confirm New Password"); ?></label>
|
||||
<div class="col-md-8 inputGroupContainer">
|
||||
<?php
|
||||
getInputPassword("newPasswordConfirm", 'class="form-control" required="required" autocomplete="off"', __("Confirm New Password")); ?>
|
||||
<?php getInputPassword("newPasswordConfirm", 'class="form-control" required="required" autocomplete="off"', __("Confirm New Password")); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -124,14 +122,13 @@ if (!(!empty($_GET['user']) && !empty($_GET['recoverpass']))) {
|
|||
|
||||
</fieldset>
|
||||
</form>
|
||||
<?php
|
||||
} ?>
|
||||
<?php }
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div><!--/.container-->
|
||||
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/footer.php'; ?>
|
||||
<?php include $global['systemRootPath'] . 'view/include/footer.php'; ?>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
|
|
@ -12,7 +12,9 @@ if (!User::isAdmin()) {
|
|||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $_SESSION['language']; ?>">
|
||||
<head>
|
||||
<title><?php echo __("VAST") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
|
||||
<?php
|
||||
echo getHTMLTitle( __("VAST"));
|
||||
?>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
include $global['systemRootPath'] . 'plugin/AD_Server/index_head.php';
|
||||
|
|
|
@ -20,7 +20,9 @@ $reflector = new ReflectionClass('API');
|
|||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $_SESSION['language']; ?>">
|
||||
<head>
|
||||
<title><?php echo __("API") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
|
||||
<?php
|
||||
echo getHTMLTitle(__("API"));
|
||||
?>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
?>
|
||||
|
|
|
@ -9,7 +9,9 @@ if (!User::isAdmin()) {
|
|||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $_SESSION['language']; ?>">
|
||||
<head>
|
||||
<title><?php echo __("Audit") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
|
||||
<?php
|
||||
echo getHTMLTitle( __("Audit"));
|
||||
?>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
?>
|
||||
|
|
|
@ -14,7 +14,9 @@ $order = new BlockonomicsOrder($order_id);
|
|||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $_SESSION['language']; ?>">
|
||||
<head>
|
||||
<title><?php echo __("Invoice") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
|
||||
<?php
|
||||
echo getHTMLTitle( __("Invoice"));
|
||||
?>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
?>
|
||||
|
|
|
@ -9,7 +9,9 @@ $obj = AVideoPlugin::getObjectData("BulkEmbed");
|
|||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $_SESSION['language']; ?>">
|
||||
<head>
|
||||
<title><?php echo __("Bulk Embed") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
|
||||
<?php
|
||||
echo getHTMLTitle( __("Search"));
|
||||
?>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
?>
|
||||
|
|
|
@ -14,7 +14,9 @@ if (!User::isAdmin()) {
|
|||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $_SESSION['language']; ?>">
|
||||
<head>
|
||||
<title><?php echo __("Clone Site") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
|
||||
<?php
|
||||
echo getHTMLTitle( __("Clone Site"));
|
||||
?>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
?>
|
||||
|
|
|
@ -12,7 +12,9 @@ require_once $global['systemRootPath'] . 'plugin/CombineSites/Objects/CombineSit
|
|||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $_SESSION['language']; ?>">
|
||||
<head>
|
||||
<title><?php echo __("Combine Sites") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
|
||||
<?php
|
||||
echo getHTMLTitle( __("Combine Sites"));
|
||||
?>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
?>
|
||||
|
|
|
@ -9,9 +9,9 @@ $count = 1;
|
|||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $_SESSION['language']; ?>">
|
||||
<head>
|
||||
<title><?php
|
||||
echo $siteTitle;
|
||||
?></title>
|
||||
<?php
|
||||
echo getHTMLTitle( $siteTitle);
|
||||
?>
|
||||
<?php include $global['systemRootPath'] . 'view/include/head.php'; ?>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/infinite-scroll.pkgd.min.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
|
|
@ -22,12 +22,12 @@ class Message implements MessageComponentInterface {
|
|||
global $onMessageSentTo;
|
||||
$onMessageSentTo = array();
|
||||
$query = $conn->httpRequest->getUri()->getQuery();
|
||||
parse_str($query, $wsocketToken);
|
||||
if (empty($wsocketToken['webSocketToken'])) {
|
||||
parse_str($query, $wsocketGetVars);
|
||||
if (empty($wsocketGetVars['webSocketToken'])) {
|
||||
_log_message("Empty websocket token ");
|
||||
return false;
|
||||
}
|
||||
$json = getDecryptedInfo($wsocketToken['webSocketToken']);
|
||||
$json = getDecryptedInfo($wsocketGetVars['webSocketToken']);
|
||||
if (empty($json)) {
|
||||
_log_message("Invalid websocket token ");
|
||||
return false;
|
||||
|
@ -43,7 +43,8 @@ class Message implements MessageComponentInterface {
|
|||
$client['browser'] = $json->browser;
|
||||
$client['yptDeviceId'] = $json->yptDeviceId;
|
||||
$client['selfURI'] = $json->selfURI;
|
||||
$client['isCommandLine'] = $wsocketToken['isCommandLine'];
|
||||
$client['isCommandLine'] = $wsocketGetVars['isCommandLine'];
|
||||
$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;
|
||||
|
|
|
@ -37,7 +37,7 @@ class Socket extends PluginAbstract {
|
|||
}
|
||||
|
||||
public static function getServerVersion() {
|
||||
return "2.0";
|
||||
return "2.1";
|
||||
}
|
||||
|
||||
public function updateScript() {
|
||||
|
|
|
@ -5,13 +5,15 @@ function socketConnect() {
|
|||
return false;
|
||||
}
|
||||
socketConnectRequested = 1;
|
||||
console.log('Trying to reconnect on socket...');
|
||||
conn = new WebSocket(webSocketURL);
|
||||
var url = addGetParam(webSocketURL, 'page_title', $(document).find("title").text());
|
||||
console.log('Trying to reconnect on socket... ' + url);
|
||||
conn = new WebSocket(url);
|
||||
conn.onopen = function (e) {
|
||||
console.log("Socket onopen");
|
||||
return false;
|
||||
};
|
||||
conn.onmessage = function (e) {
|
||||
console.log(e.data);
|
||||
var json = JSON.parse(e.data);
|
||||
parseSocketResponse(json);
|
||||
if (json.type == webSocketTypes.ON_VIDEO_MSG) {
|
||||
|
@ -90,7 +92,7 @@ function defaultCallback(json) {
|
|||
function parseSocketResponse(json) {
|
||||
console.log("parseSocketResponse", json);
|
||||
if(json.isAdmin && webSocketServerVersion!==json.webSocketServerVersion){
|
||||
avideoToast("Please restart your socket server. You are running (v"+json.webSocketServerVersion+") and your client is expecting (v"+webSocketServerVersion+")");
|
||||
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') {
|
||||
$('.total_on').text(0);
|
||||
|
@ -128,7 +130,7 @@ function parseSocketResponse(json) {
|
|||
if (json.users_uri[prop][prop2][prop3] === false || typeof json.users_uri[prop][prop2][prop3] !== 'object') {
|
||||
continue;
|
||||
}
|
||||
var html = '<div><a href="' + json.users_uri[prop][prop2][prop3].selfURI + '" target="_blank"><img src="' + webSiteRootURL + 'user/' + json.users_uri[prop][prop2][prop3].users_id + '/foto.png" class="img img-circle img-responsive">IP: ' + json.users_uri[prop][prop2][prop3].ip + ' (' + json.users_uri[prop][prop2][prop3].user_name + ') </a></div>'
|
||||
var html = '<div><a href="' + json.users_uri[prop][prop2][prop3].selfURI + '" target="_blank"><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].page_title + ') ' + json.users_uri[prop][prop2][prop3].user_name + ' IP: ' + json.users_uri[prop][prop2][prop3].ip + ' </a></div>'
|
||||
//console.log(json.users_uri[prop]);
|
||||
$('#socketUsersURI').append(html);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ _error_log("Starting Socket server at port {$SocketDataObj->port}");
|
|||
killProcessOnPort();
|
||||
$scheme = parse_url($global['webSiteRootURL'], PHP_URL_SCHEME);
|
||||
|
||||
echo "Starting server on port {$SocketDataObj->port}".PHP_EOL;
|
||||
echo "Starting AVideo Socket server version {$SocketDataObj->serverVersion} on port {$SocketDataObj->port}".PHP_EOL;
|
||||
|
||||
if(strtolower($scheme)!=='https'){
|
||||
echo "Your socket server does NOT use a secure connection".PHP_EOL;
|
||||
|
|
|
@ -677,7 +677,7 @@ function playNext(url) {
|
|||
});
|
||||
}
|
||||
} else if (isPlayerLoop()) {
|
||||
$.toast("Looping video");
|
||||
avideoToast("Looping video");
|
||||
userIsControling = false;
|
||||
playerPlayTimeout = setTimeout(function () {
|
||||
playerPlay(currentTime);
|
||||
|
@ -861,8 +861,27 @@ function avideoAlert(title, msg, type) {
|
|||
}
|
||||
}
|
||||
|
||||
function _avideoToast(msg, icon) {
|
||||
var options = {text:msg, hideAfter:7000};
|
||||
if(icon){
|
||||
options.icon = icon;
|
||||
}
|
||||
$.toast(options);
|
||||
}
|
||||
function avideoToast(msg) {
|
||||
$.toast({text:msg, hideAfter:7000});
|
||||
_avideoToast(msg, null);
|
||||
}
|
||||
function avideoToastInfo(msg) {
|
||||
_avideoToast(msg, 'info');
|
||||
}
|
||||
function avideoToastError(msg) {
|
||||
_avideoToast(msg, 'error');
|
||||
}
|
||||
function avideoToastSuccess(msg) {
|
||||
_avideoToast(msg, 'success');
|
||||
}
|
||||
function avideoToastWarning(msg) {
|
||||
_avideoToast(msg, 'warning');
|
||||
}
|
||||
|
||||
function avideoAlertAJAXHTML(url) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue