|
23 | 23 | use Appwrite\Utopia\Database\Validator\Queries\Subscribers; |
24 | 24 | use Appwrite\Utopia\Database\Validator\Queries\Targets; |
25 | 25 | use Appwrite\Utopia\Database\Validator\Queries\Topics; |
26 | | -use Appwrite\Utopia\Request; |
27 | 26 | use Appwrite\Utopia\Response; |
28 | 27 | use MaxMind\Db\Reader; |
29 | 28 | use Utopia\App; |
|
3495 | 3494 | ->inject('dbForPlatform') |
3496 | 3495 | ->inject('project') |
3497 | 3496 | ->inject('queueForMessaging') |
3498 | | - ->inject('request') |
3499 | 3497 | ->inject('response') |
3500 | | - ->action(function (string $messageId, string $title, string $body, ?array $topics, ?array $users, ?array $targets, ?array $data, string $action, string $image, string $icon, string $sound, string $color, string $tag, int $badge, bool $draft, ?string $scheduledAt, bool $contentAvailable, bool $critical, string $priority, Event $queueForEvents, Database $dbForProject, Database $dbForPlatform, Document $project, Messaging $queueForMessaging, Request $request, Response $response) { |
| 3498 | + ->inject('platform') |
| 3499 | + ->action(function (string $messageId, string $title, string $body, ?array $topics, ?array $users, ?array $targets, ?array $data, string $action, string $image, string $icon, string $sound, string $color, string $tag, int $badge, bool $draft, ?string $scheduledAt, bool $contentAvailable, bool $critical, string $priority, Event $queueForEvents, Database $dbForProject, Database $dbForPlatform, Document $project, Messaging $queueForMessaging, Response $response, array $platform) { |
3501 | 3500 | $messageId = $messageId == 'unique()' |
3502 | 3501 | ? ID::unique() |
3503 | 3502 | : $messageId; |
|
3573 | 3572 | $image = [ |
3574 | 3573 | 'bucketId' => $bucket->getId(), |
3575 | 3574 | 'fileId' => $file->getId(), |
3576 | | - 'url' => "{$protocol}://{$request->getHostname()}/v1/storage/buckets/{$bucket->getId()}/files/{$file->getId()}/push?project={$project->getId()}&jwt={$jwt}", |
| 3575 | + 'url' => "{$platform['endpoint']}/storage/buckets/{$bucket->getId()}/files/{$file->getId()}/push?project={$project->getId()}&jwt={$jwt}", |
3577 | 3576 | ]; |
3578 | 3577 | } |
3579 | 3578 |
|
|
4378 | 4377 | ->inject('dbForPlatform') |
4379 | 4378 | ->inject('project') |
4380 | 4379 | ->inject('queueForMessaging') |
4381 | | - ->inject('request') |
4382 | 4380 | ->inject('response') |
4383 | | - ->action(function (string $messageId, ?array $topics, ?array $users, ?array $targets, ?string $title, ?string $body, ?array $data, ?string $action, ?string $image, ?string $icon, ?string $sound, ?string $color, ?string $tag, ?int $badge, ?bool $draft, ?string $scheduledAt, ?bool $contentAvailable, ?bool $critical, ?string $priority, Event $queueForEvents, Database $dbForProject, Database $dbForPlatform, Document $project, Messaging $queueForMessaging, Request $request, Response $response) { |
| 4381 | + ->inject('platform') |
| 4382 | + ->action(function (string $messageId, ?array $topics, ?array $users, ?array $targets, ?string $title, ?string $body, ?array $data, ?string $action, ?string $image, ?string $icon, ?string $sound, ?string $color, ?string $tag, ?int $badge, ?bool $draft, ?string $scheduledAt, ?bool $contentAvailable, ?bool $critical, ?string $priority, Event $queueForEvents, Database $dbForProject, Database $dbForPlatform, Document $project, Messaging $queueForMessaging, Response $response, array $platform) { |
4384 | 4383 | $message = $dbForProject->getDocument('messages', $messageId); |
4385 | 4384 |
|
4386 | 4385 | if ($message->isEmpty()) { |
|
4548 | 4547 | throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED); |
4549 | 4548 | } |
4550 | 4549 |
|
4551 | | - $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; |
4552 | | - |
4553 | 4550 | $scheduleTime = $currentScheduledAt ?? $scheduledAt; |
4554 | 4551 | if (!\is_null($scheduleTime)) { |
4555 | 4552 | $expiry = (new \DateTime($scheduleTime))->add(new \DateInterval('P15D'))->format('U'); |
|
4568 | 4565 | $pushData['image'] = [ |
4569 | 4566 | 'bucketId' => $bucket->getId(), |
4570 | 4567 | 'fileId' => $file->getId(), |
4571 | | - 'url' => "{$protocol}://{$request->getHost()}/v1/storage/buckets/{$bucket->getId()}/files/{$file->getId()}/push?project={$project->getId()}&jwt={$jwt}" |
| 4568 | + 'url' => "{$platform['endpoint']}/storage/buckets/{$bucket->getId()}/files/{$file->getId()}/push?project={$project->getId()}&jwt={$jwt}", |
4572 | 4569 | ]; |
4573 | 4570 | } |
4574 | 4571 |
|
|
0 commit comments