diff --git a/plugin/CDN/status.json.php b/plugin/CDN/status.json.php index 821f0316a..14ed79102 100644 --- a/plugin/CDN/status.json.php +++ b/plugin/CDN/status.json.php @@ -1,87 +1,99 @@ error = true; $resp->msg = ''; $obj = AVideoPlugin::getDataObjectIfEnabled('CDN'); if (empty($obj)) { $resp->msg = 'CDN Plugin disabled'; die(json_encode($resp)); } if (empty($_REQUEST['key'])) { $resp->msg = 'Key is empty'; die(json_encode($resp)); } if (!empty($obj->key)) { //check the key if ($obj->key !== $_REQUEST['key']) { $resp->msg = 'Key Does not match'; die(json_encode($resp)); } } $obj->key = $_REQUEST['key']; foreach ($_REQUEST['par'] as $key => $value) { $obj->{$key} = $value; $resp->{$key} = $value; } // Update S3 CDN -$resp->CDN_S3 = CDN::getS3URL(); +if (AVideoPlugin::isEnabledByName('AWS_S3')) { + $resp->CDN_S3 = CDN::getS3URL(); +}else{ + $resp->CDN_S3 = ''; +} // Update B2 CDN -$resp->CDN_B2 = CDN::getB2URL(); +if (AVideoPlugin::isEnabledByName('Blackblaze_B2')) { + $resp->CDN_B2 = CDN::getB2URL(); +}else{ + $resp->CDN_B2 = ''; +} // Update FTP CDN -$resp->CDN_FTP = CDN::getFTPURL(); +if (AVideoPlugin::isEnabledByName('FTP_Storage')) { + $resp->CDN_FTP = CDN::getFTPURL(); +}else{ + $resp->CDN_FTP = ''; +} // Update YPT Storage CDN $resp->CDN_YPTStorage = array(); $plugin = AVideoPlugin::getDataObjectIfEnabled('YPTStorage'); if (!empty($plugin)) { $rows = Sites::getAllActive(); foreach ($rows as $value) { if (empty($value['url'])) { continue; } $resp->CDN_YPTStorage[] = array( - 'id'=>$value['id'], - 'url'=>addLastSlash($value['url']) - ); + 'id' => $value['id'], + 'url' => addLastSlash($value['url']) + ); } } // Update Live CDN $resp->CDN_Live = ''; $resp->CDN_LiveServers = array(); $plugin = AVideoPlugin::getDataObjectIfEnabled('Live'); if (!empty($plugin)) { if ($plugin->useLiveServers) { $rows = Live_servers::getAllActive(); foreach ($rows as $value) { if (empty($value['playerServer'])) { continue; } $resp->CDN_LiveServers[] = array( - 'id'=>$value['id'], - 'url'=>addLastSlash($value['playerServer']) + 'id' => $value['id'], + 'url' => addLastSlash($value['playerServer']) ); } } else { $resp->CDN_Live = addLastSlash($plugin->playerServer); } } // Update Liveservers CDN $cdn = AVideoPlugin::loadPluginIfEnabled('CDN'); $id = $cdn->setDataObject($obj); if (!empty($id)) { $resp->error = false; } die(json_encode($resp));