summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-07-24 20:52:10 +0200
committerJoas Schilling <coding@schilljs.com>2023-08-08 10:46:53 +0200
commit71ee2c8cd08fbeae97d7f9cbff6f0b81636ff663 (patch)
treeadb0706a0c2b400afea911ee52f146302a1b22cc
parent6b6090eef9eac4e438e9a4025522328d71e7c549 (diff)
fix(bots): Use the fixed CLI url
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--lib/Model/BotServer.php6
-rw-r--r--lib/Service/BotService.php4
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?
];