mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 03:50:04 +02:00
Update
This commit is contained in:
parent
fb70c2730d
commit
6fa6cf7dbf
3 changed files with 27 additions and 2 deletions
|
@ -320,6 +320,22 @@ function zipDirectory($source, $destination)
|
||||||
return file_exists($destinationOriginal);
|
return file_exists($destinationOriginal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPortOpenInternal($host, $port) {
|
||||||
|
$output = [];
|
||||||
|
$result = null;
|
||||||
|
exec("nc -zv {$host} {$port} 2>&1", $output, $result);
|
||||||
|
foreach ($output as $line) {
|
||||||
|
_log($line);
|
||||||
|
}
|
||||||
|
return $result === 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isPortOpenExternal($port) {
|
||||||
|
$ports = array($port);
|
||||||
|
//postVariables($url, $array, $httpcodeOnly = true, $timeout = 10)
|
||||||
|
$response = postVariables('https://search.ypt.me/checkPorts.json.php', $ports, false, 4);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
function getPIDUsingPort($port)
|
function getPIDUsingPort($port)
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,12 +98,17 @@ class WebRTC extends PluginAbstract
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function getWebRTC2RTMPFile(){
|
||||||
|
global $global;
|
||||||
|
return "{$global['systemRootPath']}plugin/WebRTC/WebRTC2RTMP";
|
||||||
|
}
|
||||||
|
|
||||||
static function startServer()
|
static function startServer()
|
||||||
{
|
{
|
||||||
_error_log('Starting WebRTC Server');
|
_error_log('Starting WebRTC Server');
|
||||||
global $global;
|
global $global;
|
||||||
$obj = AVideoPlugin::getDataObject('WebRTC');
|
$obj = AVideoPlugin::getDataObject('WebRTC');
|
||||||
$file = "{$global['systemRootPath']}plugin/WebRTC/WebRTC2RTMP";
|
$file = self::getWebRTC2RTMPFile();
|
||||||
$log = "{$global['systemRootPath']}videos/WebRTC2RTMP.log";
|
$log = "{$global['systemRootPath']}videos/WebRTC2RTMP.log";
|
||||||
$command = "{$file} --port={$obj->port} > $log ";
|
$command = "{$file} --port={$obj->port} > $log ";
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,14 @@ $objP = AVideoPlugin::getDataObject('WebRTC');
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
$obj = array('error'=>false, 'msg'=>'');
|
$obj = array('error'=>false, 'msg'=>'');
|
||||||
|
|
||||||
|
$file = WebRTC::getWebRTC2RTMPFile();
|
||||||
|
|
||||||
$obj['port'] = $objP->port;
|
$obj['port'] = $objP->port;
|
||||||
$obj['isActive'] = WebRTC::checkIfIsActive();
|
$obj['isActive'] = WebRTC::checkIfIsActive();
|
||||||
$obj['json'] = WebRTC::getJson();
|
$obj['json'] = WebRTC::getJson();
|
||||||
$obj['log'] = WebRTC::getLog();
|
$obj['log'] = WebRTC::getLog();
|
||||||
|
$obj['is_executable'] = is_executable($file);
|
||||||
|
$obj['portOpenInternally'] = isPortOpenInternal('localhost', $objP->port) ;
|
||||||
|
$obj['portOpenExternally'] = isPortOpenExternal($objP->port);
|
||||||
echo json_encode($obj);
|
echo json_encode($obj);
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue