summaryrefslogtreecommitdiffstats
path: root/lib/Federation/BackendNotifier.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-10-27 12:48:38 +0200
committerJoas Schilling <coding@schilljs.com>2023-10-30 17:39:09 +0100
commite252d929c0fb6f9fa55781b09064c78a8f8017b4 (patch)
tree0a1e52fbc72205380c60b99e55b336fe4a81cdfe /lib/Federation/BackendNotifier.php
parentfc8734a59350e58d840b112b9948bb44c6afdacc (diff)
fix(federation): Send the server URL as well to avoid ambigious remoteAttendeeId issues
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Federation/BackendNotifier.php')
-rw-r--r--lib/Federation/BackendNotifier.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Federation/BackendNotifier.php b/lib/Federation/BackendNotifier.php
index 9964b9bc0..2ca4fb9e3 100644
--- a/lib/Federation/BackendNotifier.php
+++ b/lib/Federation/BackendNotifier.php
@@ -37,6 +37,7 @@ use OCP\Federation\ICloudFederationFactory;
use OCP\Federation\ICloudFederationNotification;
use OCP\Federation\ICloudFederationProviderManager;
use OCP\HintException;
+use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserManager;
use Psr\Log\LoggerInterface;
@@ -51,6 +52,7 @@ class BackendNotifier {
private ICloudFederationProviderManager $federationProviderManager,
private IJobList $jobList,
private IUserManager $userManager,
+ private IURLGenerator $url,
) {
}
@@ -139,6 +141,7 @@ class BackendNotifier {
FederationManager::TALK_ROOM_RESOURCE,
(string) $remoteAttendeeId,
[
+ 'remoteServerUrl' => $this->getServerRemoteUrl(),
'sharedSecret' => $accessToken,
'message' => 'Recipient accepted the share',
]);
@@ -166,6 +169,7 @@ class BackendNotifier {
FederationManager::TALK_ROOM_RESOURCE,
(string) $remoteAttendeeId,
[
+ 'remoteServerUrl' => $this->getServerRemoteUrl(),
'sharedSecret' => $accessToken,
'message' => 'Recipient declined the share',
]
@@ -190,6 +194,7 @@ class BackendNotifier {
FederationManager::TALK_ROOM_RESOURCE,
(string) $localAttendeeId,
[
+ 'remoteServerUrl' => $this->getServerRemoteUrl(),
'sharedSecret' => $accessToken,
'message' => 'This room has been unshared',
]
@@ -220,6 +225,7 @@ class BackendNotifier {
FederationManager::TALK_ROOM_RESOURCE,
(string) $localAttendeeId,
[
+ 'remoteServerUrl' => $this->getServerRemoteUrl(),
'sharedSecret' => $accessToken,
'remoteToken' => $localToken,
'changedProperty' => $changedProperty,
@@ -268,4 +274,17 @@ class BackendNotifier {
}
return $remote;
}
+
+ protected function getServerRemoteUrl(): string {
+ $server = rtrim($this->url->getAbsoluteURL('/'), '/');
+ if (str_ends_with($server, '/index.php')) {
+ $server = substr($server, 0, -10);
+ }
+
+ if (str_starts_with($server, 'https://')) {
+ return substr($server, strlen('https://'));
+ }
+
+ return $server;
+ }
}