From 71ee2c8cd08fbeae97d7f9cbff6f0b81636ff663 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 24 Jul 2023 20:52:10 +0200 Subject: fix(bots): Use the fixed CLI url Signed-off-by: Joas Schilling --- lib/Model/BotServer.php | 6 +++--- lib/Service/BotService.php | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Model/BotServer.php b/lib/Model/BotServer.php index 9783185a9..7e8983ecd 100644 --- a/lib/Model/BotServer.php +++ b/lib/Model/BotServer.php @@ -32,8 +32,8 @@ use OCP\AppFramework\Db\Entity; * @method string getUrl() * @method void setUrlHash(string $urlHash) * @method string getUrlHash() - * @method void setDescription(string $description) - * @method string getDescription() + * @method void setDescription(?string $description) + * @method null|string getDescription() * @method void setSecret(string $secret) * @method string getSecret() * @method void setErrorCount(int $errorCount) @@ -49,7 +49,7 @@ class BotServer extends Entity implements \JsonSerializable { protected string $name = ''; protected string $url = ''; protected string $urlHash = ''; - protected string $description = ''; + protected ?string $description = null; protected string $secret = ''; protected int $errorCount = 0; protected ?\DateTimeImmutable $lastErrorDate = null; diff --git a/lib/Service/BotService.php b/lib/Service/BotService.php index 562e83f0f..64d047503 100644 --- a/lib/Service/BotService.php +++ b/lib/Service/BotService.php @@ -38,6 +38,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Http\Client\IClientService; use OCP\Http\Client\IResponse; +use OCP\IConfig; use OCP\ISession; use OCP\IURLGenerator; use OCP\IUser; @@ -51,6 +52,7 @@ class BotService { protected BotServerMapper $botServerMapper, protected BotConversationMapper $botConversationMapper, protected IClientService $clientService, + protected IConfig $serverConfig, protected IUserSession $userSession, protected TalkSession $talkSession, protected ISession $session, @@ -159,7 +161,7 @@ class BotService { 'Content-Type' => 'application/json', 'X-Nextcloud-Talk-Random' => $random, 'X-Nextcloud-Talk-Signature' => $hash, - 'X-Nextcloud-Talk-Backend' => $this->urlGenerator->getAbsoluteURL(''), + 'X-Nextcloud-Talk-Backend' => rtrim($this->serverConfig->getSystemValueString('overwrite.cli.url'), '/') . '/', 'OCS-APIRequest' => 'true', // FIXME optional? ]; -- cgit v1.2.3