Skip to content

Commit

Permalink
Show a warning when the HPB does not support dialout
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Oct 30, 2023
1 parent 7c3d9f3 commit 76ebcb2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
9 changes: 9 additions & 0 deletions lib/Controller/SignalingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,15 @@ public function getWelcomeMessage(int $serverId): DataResponse {
], Http::STATUS_INTERNAL_SERVER_ERROR);
}

$missingFeatures = $this->signalingManager->getSignalingServerMissingFeatures($response);
if (!empty($missingFeatures)) {
return new DataResponse([
'warning' => 'UPDATE_OPTIONAL',
'features' => $missingFeatures,
'version' => $data['version'] ?? '',
]);
}

return new DataResponse($data);
} catch (ConnectException $e) {
return new DataResponse(['error' => 'CAN_NOT_CONNECT'], Http::STATUS_INTERNAL_SERVER_ERROR);
Expand Down
10 changes: 10 additions & 0 deletions lib/Signaling/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ public function isCompatibleSignalingServer(IResponse $response): bool {
&& in_array('switchto', $features, true);
}

public function getSignalingServerMissingFeatures(IResponse $response): array {
$featureHeader = $response->getHeader(self::FEATURE_HEADER);
$features = explode(',', $featureHeader);
$features = array_map('trim', $features);

return array_values(array_diff([
'dialout',
], $features));
}

public function getSignalingServerLinkForConversation(?Room $room): string {
if ($this->talkConfig->getSignalingMode() === Config::SIGNALING_INTERNAL) {
return '';
Expand Down
21 changes: 18 additions & 3 deletions src/components/AdminSettings/SignalingServer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,17 @@

<span v-if="server" class="test-connection">
<NcLoadingIcon v-if="!checked" :size="20" />
<AlertCircle v-else-if="errorMessage" :size="20" :fill-color="'#E9322D'" />
<Check v-else :size="20" :fill-color="'#46BA61'" />
<AlertCircle v-else-if="errorMessage" :size="20" :fill-color="'#D91812'" />
<AlertCircleOutline v-else-if="warningMessage" :size="20" :fill-color="'#C28900'" />
<Check v-else :size="20" :fill-color="'#2D7B41'" />
{{ connectionState }}
</span>
</li>
</template>

<script>
import AlertCircle from 'vue-material-design-icons/AlertCircle.vue'
import AlertCircleOutline from 'vue-material-design-icons/AlertCircleOutline.vue'
import Check from 'vue-material-design-icons/Check.vue'
import Delete from 'vue-material-design-icons/Delete.vue'
Expand All @@ -72,6 +74,7 @@ export default {
components: {
AlertCircle,
AlertCircleOutline,
Check,
Delete,
NcButton,
Expand Down Expand Up @@ -108,6 +111,7 @@ export default {
return {
checked: false,
errorMessage: '',
warningMessage: '',
versionFound: '',
}
},
Expand All @@ -120,6 +124,9 @@ export default {
if (this.errorMessage) {
return this.errorMessage
}
if (this.warningMessage) {
return this.warningMessage
}
return t('spreed', 'OK: Running version: {version}', {
version: this.versionFound,
})
Expand Down Expand Up @@ -155,12 +162,20 @@ export default {
this.checked = false
this.errorMessage = ''
this.warningMessage = ''
this.versionFound = ''
try {
const response = await getWelcomeMessage(this.index)
this.checked = true
this.versionFound = response.data.ocs.data.version
const data = response.data.ocs.data
this.versionFound = data.version
if (data.warning === 'UPDATE_OPTIONAL') {
this.warningMessage = t('spreed', 'Warning: Running version: {version}; Server does not support all features of this Talk version, missing features: {features}', {
version: this.versionFound,
features: data.features.join(', '),
})
}
} catch (exception) {
this.checked = true
const data = exception.response.data.ocs.data
Expand Down

0 comments on commit 76ebcb2

Please sign in to comment.