Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Jan 13, 2025
1 parent 7ae32ef commit 1c65136
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions objects/functionsExec.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,15 @@ function isPortOpenInternal($host, $port) {
}

function isPortOpenExternal($port) {
global $isPortOpenExternalResponse;
$ports = array($port);
//postVariables($url, $array, $httpcodeOnly = true, $timeout = 10)
$isPortOpenExternalResponse = new stdClass();
$response = postVariables('https://search.ypt.me/checkPorts.json.php', $ports, false, 4);
if(!empty($response)){
$json = json_decode($response);
if(!empty($json)){
$isPortOpenExternalResponse = $json;
$json->ports[0]->isOpen;
}
}
Expand Down
7 changes: 6 additions & 1 deletion plugin/WebRTC/WebRTC.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,18 @@ static function getWebRTC2RTMPFile(){
return "{$global['systemRootPath']}plugin/WebRTC/WebRTC2RTMP";
}

static function getWebRTC2RTMPLogFile(){
global $global;
return "{$global['systemRootPath']}videos/WebRTC2RTMP.log";
}

static function startServer()
{
_error_log('Starting WebRTC Server');
global $global;
$obj = AVideoPlugin::getDataObject('WebRTC');
$file = self::getWebRTC2RTMPFile();
$log = "{$global['systemRootPath']}videos/WebRTC2RTMP.log";
$log = self::getWebRTC2RTMPLogFile();
$command = "{$file} --port={$obj->port} > $log ";

// Check if the file has executable permissions
Expand Down
1 change: 1 addition & 0 deletions plugin/WebRTC/status.json.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
$obj['is_executable'] = is_executable($file);
$obj['portOpenInternally'] = isPortOpenInternal('localhost', $objP->port) ;
$obj['portOpenExternally'] = isPortOpenExternal($objP->port);
$obj['portOpenExternallyResponse'] = $isPortOpenExternalResponse;
$obj['file'] = $file;
$obj['file_exists'] = file_exists($file);
echo json_encode($obj);
Expand Down

0 comments on commit 1c65136

Please sign in to comment.