Skip to content

Commit

Permalink
Allow opencast running on localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis531 committed Dec 6, 2024
1 parent 34181c6 commit b4499fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/Models/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function updateEndpoints()
}

if ($comp) {
$services = RESTConfig::retrieveRESTservices($comp, $service_url['scheme']);
$services = RESTConfig::retrieveRESTservices($comp, $service_url);

if (empty($services)) {
Endpoints::removeEndpoint($this->id, 'services');
Expand Down
6 changes: 3 additions & 3 deletions lib/Models/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ static function getDates($seminar_id)
return $dates;
}

static function retrieveRESTservices($components, $match_protocol)
static function retrieveRESTservices($components, $service_url)
{
$services = array();
foreach ($components as $service) {
if (!preg_match('/remote/', $service->type)
&& !preg_match('#https?://localhost.*#', $service->host)
&& mb_strpos($service->host, $match_protocol) === 0
&& ($service_url['host'] == "localhost" || !preg_match('#https?://localhost.*#', $service->host))
&& mb_strpos($service->host, $service_url['scheme']) === 0
) {
$services[preg_replace(array("/\/docs/"), array(''), $service->host.$service->path)]
= preg_replace("/\//", '', $service->path);
Expand Down
6 changes: 3 additions & 3 deletions lib/Models/REST/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ public static function getOCBaseVersion($config_id)
return false;
}

public static function retrieveRESTservices($components, $match_protocol)
public static function retrieveRESTservices($components, $service_url)
{
$oc_services = self::SERVICES;
$services = [];

foreach ($components as $service) {
if (!preg_match('#https?://localhost.*#', $service->host)
&& mb_strpos($service->host, $match_protocol) === 0
if (($service_url['host'] == "localhost" || !preg_match('#https?://localhost.*#', $service->host))
&& mb_strpos($service->host, $service_url['scheme']) === 0
) {
// check if service is wanted, active and online
if (isset($oc_services[$service->type])
Expand Down

0 comments on commit b4499fe

Please sign in to comment.