/** * @NoAdminRequired * @NoCSRFRequired * @PublicPage */ public function getConfig() { $_response = array('success' => false); try { $_response['spreed_webrtc'] = array('url' => Helper::getSpreedWebRtcUrl()); $_response['success'] = true; } catch (\Exception $e) { $_response['error'] = $e->getCode(); } return new DataResponse($_response); }
/** * @NoAdminRequired * @NoCSRFRequired * @PublicPage */ public function getConfig() { $_response = array('success' => false); try { $_response['spreed_webrtc'] = array('url' => Helper::getSpreedWebRtcUrl()); $_response['owncloud'] = array('login' => array('url' => $this->urlGenerator->linkTo('index.php'))); $_response['success'] = true; } catch (\Exception $e) { $_response['error'] = $e->getCode(); } return new DataResponse($_response); }
private static function testSpreedWebRTCAPI() { // Force ?debug param removal $url = Helper::getSpreedWebRtcUrl(false); $config_url = $url . 'api/v1/config'; // TODO(leon): Switch to curl as this is shitty? $response = file_get_contents($config_url, false, stream_context_create(array('http' => array('timeout' => 5), 'ssl' => array('verify_peer' => false, 'verify_peer_name' => false)))); if (empty($response)) { return 'Unable to connect to WebRTC at ' . $url . '. Did you set a correct SPREED_WEBRTC_ORIGIN and SPREED_WEBRTC_BASEPATH in config/config.php?'; } $json = json_decode($response, true); $error = json_last_error(); if ($error !== JSON_ERROR_NONE) { return 'WebRTC API config endpoint returned incorrect json response: <pre>' . htmlspecialchars($response) . '</pre>'; } if (!isset($json['Plugin']) || empty($json['Plugin'])) { return 'WebRTC API config endpoint does not include a plugin'; } }
<?php use OCA\SpreedME\Helper\Helper; $iframe_url = Helper::getSpreedWebRtcUrl(); script('spreedme', '../extra/static/PostMessageAPI'); script('spreedme', 'webrtc'); style('spreedme', 'webrtc'); $sharedConfig = array('is_guest' => $_['is_guest'] === true, 'features' => array('temporary_password' => Helper::getConfigValue('OWNCLOUD_TEMPORARY_PASSWORD_LOGIN_ENABLED') === true)); ?> <script id="sharedconfig" type="application/json"><?php // Not an issue to output this directly, json_encode by default has disabled JSON_UNESCAPED_SLASHES echo json_encode($sharedConfig); ?> </script> <div id="debug"><b>Debug</b><br /></div> <div id="container"> <iframe src="<?php echo $iframe_url; ?> " allowfullscreen></iframe> </div>