Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/OpenViduController.php
Show First 20 Lines • Show All 244 Lines • ▼ Show 20 Lines | public function joinRoom($id) | ||||
return $this->errorResponse(500, \trans('meet.session-create-error')); | return $this->errorResponse(500, \trans('meet.session-create-error')); | ||||
} | } | ||||
} | } | ||||
$password = (string) $room->getSetting('password'); | $password = (string) $room->getSetting('password'); | ||||
$config = [ | $config = [ | ||||
'locked' => $room->getSetting('locked') === 'true', | 'locked' => $room->getSetting('locked') === 'true', | ||||
'nomedia' => $room->getSetting('nomedia') === 'true', | |||||
'password' => $isOwner ? $password : '', | 'password' => $isOwner ? $password : '', | ||||
'requires_password' => !$isOwner && strlen($password), | 'requires_password' => !$isOwner && strlen($password), | ||||
]; | ]; | ||||
$response = ['config' => $config]; | $response = ['config' => $config]; | ||||
// Validate room password | // Validate room password | ||||
if (!$isOwner && strlen($password)) { | if (!$isOwner && strlen($password)) { | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | public function joinRoom($id) | ||||
return $this->errorResponse(422, $error, $response + ['code' => 327]); | return $this->errorResponse(422, $error, $response + ['code' => 327]); | ||||
} | } | ||||
} | } | ||||
// Initialize connection tokens | // Initialize connection tokens | ||||
if ($init) { | if ($init) { | ||||
// Choose the connection role | // Choose the connection role | ||||
$canPublish = !empty(request()->input('canPublish')); | $canPublish = empty($config['nomedia']) && !empty(request()->input('canPublish')); | ||||
$role = $canPublish ? Room::ROLE_PUBLISHER : Room::ROLE_SUBSCRIBER; | $role = $canPublish ? Room::ROLE_PUBLISHER : Room::ROLE_SUBSCRIBER; | ||||
if ($isOwner) { | if ($isOwner) { | ||||
$role |= Room::ROLE_MODERATOR; | $role |= Room::ROLE_MODERATOR; | ||||
$role |= Room::ROLE_OWNER; | $role |= Room::ROLE_OWNER; | ||||
} | } | ||||
// Create session token for the current user/connection | // Create session token for the current user/connection | ||||
$response = $room->getSessionToken($role); | $response = $room->getSessionToken($role); | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | public function setRoomConfig($id) | ||||
// TODO: Do we have to validate the password in any way? | // TODO: Do we have to validate the password in any way? | ||||
} | } | ||||
break; | break; | ||||
case 'locked': | case 'locked': | ||||
$input[$key] = $value ? 'true' : null; | $input[$key] = $value ? 'true' : null; | ||||
break; | break; | ||||
case 'nomedia': | |||||
$input[$key] = $value ? 'true' : null; | |||||
break; | |||||
default: | default: | ||||
$errors[$key] = \trans('meet.room-unsupported-option-error'); | $errors[$key] = \trans('meet.room-unsupported-option-error'); | ||||
} | } | ||||
} | } | ||||
if (!empty($errors)) { | if (!empty($errors)) { | ||||
return response()->json(['status' => 'error', 'errors' => $errors], 422); | return response()->json(['status' => 'error', 'errors' => $errors], 422); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 199 Lines • Show Last 20 Lines |