Skip to content

Commit 35298a0

Browse files
committed
fixes #1004
1 parent c4cd079 commit 35298a0

File tree

3 files changed

+35
-30
lines changed

3 files changed

+35
-30
lines changed

app/controllers/redirect.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function perform_action($action, $token)
5858

5959
// get correct endpoint for redirect type
6060
if ($action == 'video' || $action == 'share') {
61-
$ltilink = self::getLtiLinkFor($lti, 'search');
61+
$ltilink = self::getLtiLinkFor($lti, 'play');
6262
} else {
6363
$ltilink = self::getLtiLinkFor($lti, 'apievents');
6464
}

lib/Models/Config.php

+1-24
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,6 @@ class Config extends \SimpleOrMap
1616
'lti_consumerkey', 'lti_consumersecret', 'debug'
1717
];
1818

19-
const SERVICES = [
20-
"apievents", // alles admin-node
21-
"apiseries",
22-
"apiworkflows",
23-
"apiplaylists",
24-
"capture-admin",
25-
"ingest",
26-
"recordings",
27-
"search", // ausser hier: engage-node
28-
"series",
29-
"services",
30-
"upload",
31-
"workflow",
32-
];
33-
3419
protected static function configure($config = [])
3520
{
3621
$config['db_table'] = 'oc_config';
@@ -265,15 +250,7 @@ public function updateEndpoints()
265250
} else {
266251

267252
foreach($services as $service_url => $service_type) {
268-
if (in_array(
269-
strtolower($service_type),
270-
self::SERVICES
271-
) !== false
272-
) {
273-
Endpoints::setEndpoint($this->id, $service_url, $service_type);
274-
} else {
275-
unset($services[$service_url]);
276-
}
253+
Endpoints::setEndpoint($this->id, $service_url, $service_type);
277254
}
278255

279256
// create new entries for workflow_config table

lib/Models/REST/Config.php

+33-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@
66

77
class Config
88
{
9+
const SERVICES = [
10+
'org.opencastproject.external.events' => 'apievents',
11+
'org.opencastproject.external' => 'apiseries',
12+
'org.opencastproject.external.workflows.instances' => 'apiworkflows',
13+
'org.opencastproject.external.playlists' => 'apiplaylists',
14+
'org.opencastproject.capture.admin' => 'capture-admin',
15+
'org.opencastproject.ingest' => 'ingest',
16+
'org.opencastproject.scheduler' => 'recordings',
17+
'org.opencastproject.engage.ui.player.redirect' => 'play', // ausser hier: engage-node
18+
'org.opencastproject.search' => 'search', // ausser hier: engage-node
19+
'org.opencastproject.series' => 'series',
20+
'org.opencastproject.serviceregistry' => 'services',
21+
'org.opencastproject.fileupload' => 'upload',
22+
'org.opencastproject.workflow' => 'workflow',
23+
];
24+
925
/**
1026
* Get the connected opencast instance version
1127
*
@@ -39,14 +55,26 @@ public static function getOCBaseVersion($config_id)
3955

4056
public static function retrieveRESTservices($components, $match_protocol)
4157
{
42-
$services = array();
58+
$oc_services = self::SERVICES;
59+
$services = [];
60+
4361
foreach ($components as $service) {
44-
if (!preg_match('/remote/', $service->type)
45-
&& !preg_match('#https?://localhost.*#', $service->host)
62+
if (!preg_match('#https?://localhost.*#', $service->host)
4663
&& mb_strpos($service->host, $match_protocol) === 0
4764
) {
48-
$services[preg_replace(array("/\/docs/"), array(''), $service->host.$service->path)]
49-
= preg_replace("/\//", '', $service->path);
65+
// check if service is wanted, active and online
66+
if (isset($oc_services[$service->type])
67+
&& $service->online && $service->active
68+
) {
69+
// TODO: check duplicate entries for same service-type
70+
$services[$service->host . $service->path]
71+
= $oc_services[$service->type];
72+
}
73+
74+
if ($service->path == '/admin-ng/event') {
75+
$services[$service->host . $service->path]
76+
= 'adming-ngevent';
77+
}
5078
}
5179
}
5280

0 commit comments

Comments
 (0)