OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
firebase
/
vendor
/
kreait
/
firebase-php
/
src
/
Firebase
/
Messaging
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/12/2024 10:35:39 AM
rwxr-xr-x
📄
AndroidConfig.php
3.1 KB
08/12/2024 10:35:38 AM
rw-r--r--
📄
ApiClient.php
1.57 KB
08/12/2024 10:35:38 AM
rw-r--r--
📄
ApnsConfig.php
3.43 KB
08/12/2024 10:35:38 AM
rw-r--r--
📄
AppInstance.php
2.36 KB
08/12/2024 10:35:38 AM
rw-r--r--
📄
AppInstanceApiClient.php
5.45 KB
08/12/2024 10:35:38 AM
rw-r--r--
📄
CloudMessage.php
9.41 KB
08/12/2024 10:35:38 AM
rw-r--r--
📄
Condition.php
1.09 KB
08/12/2024 10:35:38 AM
rw-r--r--
📄
FcmOptions.php
1.15 KB
08/12/2024 10:35:38 AM
rw-r--r--
📁
Http
-
08/12/2024 10:36:41 AM
rwxr-xr-x
📄
Message.php
128 bytes
08/12/2024 10:35:38 AM
rw-r--r--
📄
MessageData.php
2.75 KB
08/12/2024 10:35:38 AM
rw-r--r--
📄
MessageTarget.php
1.78 KB
08/12/2024 10:35:39 AM
rw-r--r--
📄
Messages.php
717 bytes
08/12/2024 10:35:38 AM
rw-r--r--
📄
MulticastSendReport.php
5.25 KB
08/12/2024 10:35:39 AM
rw-r--r--
📄
Notification.php
2.55 KB
08/12/2024 10:35:39 AM
rw-r--r--
📄
RawMessageFromArray.php
471 bytes
08/12/2024 10:35:39 AM
rw-r--r--
📄
RegistrationToken.php
639 bytes
08/12/2024 10:35:39 AM
rw-r--r--
📄
RegistrationTokens.php
2.58 KB
08/12/2024 10:35:39 AM
rw-r--r--
📄
SendReport.php
2.2 KB
08/12/2024 10:35:39 AM
rw-r--r--
📄
Topic.php
929 bytes
08/12/2024 10:35:39 AM
rw-r--r--
📄
TopicSubscription.php
1.2 KB
08/12/2024 10:35:39 AM
rw-r--r--
📄
TopicSubscriptions.php
950 bytes
08/12/2024 10:35:39 AM
rw-r--r--
📄
WebPushConfig.php
2.63 KB
08/12/2024 10:35:39 AM
rw-r--r--
Editing: AppInstanceApiClient.php
Close
<?php declare(strict_types=1); namespace Kreait\Firebase\Messaging; use GuzzleHttp\ClientInterface; use GuzzleHttp\Promise; use Kreait\Firebase\Exception\MessagingApiExceptionConverter; use Kreait\Firebase\Util\JSON; use Psr\Http\Message\ResponseInterface; use Throwable; /** * @internal */ class AppInstanceApiClient { private ClientInterface $client; private MessagingApiExceptionConverter $errorHandler; /** * @internal */ public function __construct(ClientInterface $client, MessagingApiExceptionConverter $errorHandler) { $this->client = $client; $this->errorHandler = $errorHandler; } /** * @see https://developers.google.com/instance-id/reference/server#manage_relationship_maps_for_multiple_app_instances * * @param array<Topic> $topics * * @return array<string, array<string, string>> */ public function subscribeToTopics(array $topics, RegistrationTokens $tokens): array { $promises = []; $tokenStrings = $tokens->asStrings(); foreach ($topics as $topic) { $topicName = $topic->value(); $promises[$topicName] = $this->client ->requestAsync('POST', '/iid/v1:batchAdd', [ 'json' => [ 'to' => '/topics/'.$topicName, 'registration_tokens' => $tokenStrings, ], ]) ->then(static fn (ResponseInterface $response) => JSON::decode((string) $response->getBody(), true)) ; } $responses = Promise\Utils::settle($promises)->wait(); $result = []; foreach ($responses as $topicName => $response) { $topicName = (string) $topicName; switch ($response['state']) { case 'fulfilled': $topicResults = []; foreach ($response['value']['results'] as $index => $tokenResult) { $token = $tokenStrings[$index]; if (empty($tokenResult)) { $topicResults[$token] = 'OK'; continue; } if (isset($tokenResult['error'])) { $topicResults[$token] = $tokenResult['error']; continue; } $topicResults[$token] = 'UNKNOWN'; } $result[$topicName] = $topicResults; break; case 'rejected': $result[$topicName] = $response['reason']->getMessage(); break; } } return $result; } /** * @param array<Topic> $topics * * @return array<string, array<string, string>> */ public function unsubscribeFromTopics(array $topics, RegistrationTokens $tokens): array { $promises = []; $tokenStrings = $tokens->asStrings(); foreach ($topics as $topic) { $topicName = $topic->value(); $promises[$topicName] = $this->client ->requestAsync('POST', '/iid/v1:batchRemove', [ 'json' => [ 'to' => '/topics/'.$topicName, 'registration_tokens' => $tokenStrings, ], ]) ->then(static fn (ResponseInterface $response) => JSON::decode((string) $response->getBody(), true)) ; } $responses = Promise\Utils::settle($promises)->wait(); $result = []; foreach ($responses as $topicName => $response) { $topicName = (string) $topicName; switch ($response['state']) { case 'fulfilled': $topicResults = []; foreach ($response['value']['results'] as $index => $tokenResult) { $token = $tokenStrings[$index]; if (empty($tokenResult)) { $topicResults[$token] = 'OK'; continue; } if (isset($tokenResult['error'])) { $topicResults[$token] = (string) $tokenResult['error']; continue; } $topicResults[$token] = 'UNKNOWN'; } $result[$topicName] = $topicResults; break; case 'rejected': $result[$topicName] = $response['reason']->getMessage(); break; } } return $result; } public function getAppInstanceAsync(RegistrationToken $registrationToken): Promise\PromiseInterface { return $this->client ->requestAsync('GET', '/iid/'.$registrationToken->value().'?details=true') ->then(static function (ResponseInterface $response) use ($registrationToken) { $data = JSON::decode((string) $response->getBody(), true); return AppInstance::fromRawData($registrationToken, $data); }) ->otherwise(fn (Throwable $e) => Promise\Create::rejectionFor($this->errorHandler->convertException($e))) ; } }