Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions lib/Service/HostedSignalingServerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ public function registerAccount(RegisterAccountData $registerAccountData): Accou
],
'timeout' => 10,
]);

// this is needed here because the deletion happens in a concurrent request
// and thus the cached value in the config object would trigger an UPDATE
// instead of an INSERT if there is another request to the API server
$this->config->deleteAppValue('spreed', 'hosted-signaling-server-nonce');
} catch (ClientException $e) {
$response = $e->getResponse();

Expand Down Expand Up @@ -182,6 +177,11 @@ public function registerAccount(RegisterAccountData $registerAccountData): Accou
$this->logger->error('Failed to request hosted signaling server trial', ['exception' => $e]);
$message = $this->l10n->t('Failed to request trial because the trial server is unreachable. Please try again later.');
throw new HostedSignalingServerAPIException($message, ($e instanceof ServerException ? $e->getResponse()?->getStatusCode() : null) ?? Http::STATUS_INTERNAL_SERVER_ERROR);
} finally {
// this is needed here because the deletion happens in a concurrent request
// and thus the cached value in the config object would trigger an UPDATE
// instead of an INSERT if there is another request to the API server
$this->config->deleteAppValue('spreed', 'hosted-signaling-server-nonce');
}

$status = $response->getStatusCode();
Expand Down Expand Up @@ -234,11 +234,6 @@ public function fetchAccountInfo(AccountId $accountId) {
],
'timeout' => 10,
]);

// this is needed here because the delete happens in a concurrent request
// and thus the cached value in the config object would trigger an UPDATE
// instead of an INSERT if there is another request to the API server
$this->config->deleteAppValue('spreed', 'hosted-signaling-server-nonce');
} catch (ClientException $e) {
$response = $e->getResponse();

Expand Down Expand Up @@ -317,6 +312,11 @@ public function fetchAccountInfo(AccountId $accountId) {
$this->logger->error('Failed to request hosted signaling server trial', ['exception' => $e]);
$message = $this->l10n->t('Failed to fetch account information because the trial server is unreachable. Please check back later.');
throw new HostedSignalingServerAPIException($message, ($e instanceof ServerException ? $e->getResponse()?->getStatusCode() : null) ?? Http::STATUS_INTERNAL_SERVER_ERROR);
} finally {
// this is needed here because the delete happens in a concurrent request
// and thus the cached value in the config object would trigger an UPDATE
// instead of an INSERT if there is another request to the API server
$this->config->deleteAppValue('spreed', 'hosted-signaling-server-nonce');
}

$status = $response->getStatusCode();
Expand Down Expand Up @@ -388,11 +388,6 @@ public function deleteAccount(AccountId $accountId): void {
],
'timeout' => 10,
]);

// this is needed here because the delete happens in a concurrent request
// and thus the cached value in the config object would trigger an UPDATE
// instead of an INSERT if there is another request to the API server
$this->config->deleteAppValue('spreed', 'hosted-signaling-server-nonce');
} catch (ClientException $e) {
$response = $e->getResponse();

Expand Down Expand Up @@ -471,6 +466,11 @@ public function deleteAccount(AccountId $accountId): void {
$this->logger->error('Deleting the hosted signaling server account failed', ['exception' => $e]);
$message = $this->l10n->t('Failed to delete the account because the trial server is unreachable. Please check back later.');
throw new HostedSignalingServerAPIException($message, ($e instanceof ServerException ? $e->getResponse()?->getStatusCode() : null) ?? Http::STATUS_INTERNAL_SERVER_ERROR);
} finally {
// this is needed here because the delete happens in a concurrent request
// and thus the cached value in the config object would trigger an UPDATE
// instead of an INSERT if there is another request to the API server
$this->config->deleteAppValue('spreed', 'hosted-signaling-server-nonce');
}

$status = $response->getStatusCode();
Expand Down
2 changes: 1 addition & 1 deletion src/components/AdminSettings/HostedSignalingServer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export default {
},

expiryDate() {
return moment(this.trialAccount.expires).format('L')
return this.trialAccount.expires ? moment(this.trialAccount.expires).format('L') : t('spreed', 'Never')
},

createdDate() {
Expand Down
Loading