Fix passing of configured servers to the UI and wrong own URL to validate users.

Signed-off-by: Joachim Bauch <bauch@struktur.de>
This commit is contained in:
Joachim Bauch 2017-10-30 15:19:10 +01:00
Родитель 0b1596435e
Коммит 51889d5376
Не удалось извлечь подпись
5 изменённых файлов: 14 добавлений и 13 удалений

Просмотреть файл

@ -607,7 +607,7 @@
};
} else {
var user = OC.getCurrentUser();
var url = OC.generateUrl("/apps/spreed/signalling/backend");
var url = OC.generateUrl("/ocs/v2.php/apps/spreed/api/v1/signaling/backend");
msg = {
"type": "hello",
"hello": {

Просмотреть файл

@ -68,12 +68,13 @@ class BackendNotifier{
* @param array $data
*/
private function backendRequest($url, $data) {
$signaling = $this->config->getSignalingServer();
if (empty($signaling)) {
$servers = $this->config->getSignalingServers();
if (empty($servers)) {
return;
}
// We can use any server of the available backends.
$signaling = $servers[mt_rand(0, count($servers) - 1)];
$signaling['server'] = rtrim($signaling['server'], '/');
$url = rtrim($signaling['server'], '/') . $url;
if (substr($url, 0, 6) === 'wss://') {

Просмотреть файл

@ -106,20 +106,19 @@ class Config {
}
/**
* Returns list of signaling servers. Each entry contains the URL of the
* server and a flag whether the certificate should be verified.
*
* @return array
*/
public function getSignalingServer() {
public function getSignalingServers() {
$config = $this->config->getAppValue('spreed', 'signaling_servers');
$signaling = json_decode($config, true);
if (!is_array($signaling)) {
return [];
}
// For now we use a random server from the list
$server = $signaling['servers'][mt_rand(0, count($servers) - 1)];
return explode('\n', $server);
return $signaling['servers'];
}
/**

Просмотреть файл

@ -117,8 +117,9 @@ class PageController extends Controller {
}
}
$signaling = $this->config->getSignalingServer();
if (!empty($signaling)) {
$servers = $this->config->getSignalingServers();
if (!empty($servers)) {
$signaling = $servers[mt_rand(0, count($servers) - 1)];
$signaling = $signaling['server'];
}

Просмотреть файл

@ -90,7 +90,7 @@ class SignalingController extends OCSController {
* @return DataResponse
*/
public function signaling($messages) {
$signaling = $this->config->getSignalingServer();
$signaling = $this->config->getSignalingServers();
if (!empty($signaling)) {
return new DataResponse('Internal signaling disabled.', Http::STATUS_BAD_REQUEST);
}
@ -125,7 +125,7 @@ class SignalingController extends OCSController {
* @return DataResponse
*/
public function pullMessages() {
$signaling = $this->config->getSignalingServer();
$signaling = $this->config->getSignalingServers();
if (!empty($signaling)) {
return new DataResponse('Internal signaling disabled.', Http::STATUS_BAD_REQUEST);
}