diff --git a/.env b/.env index 8a7a53e6f4..f36a8e69eb 100644 --- a/.env +++ b/.env @@ -58,6 +58,7 @@ _APP_SMTP_USERNAME= _APP_SMTP_PASSWORD= _APP_SMS_PROVIDER=sms://username:password@mock _APP_SMS_FROM=+123456789 +_APP_SMS_DENY_LIST= _APP_STORAGE_LIMIT=30000000 _APP_STORAGE_PREVIEW_LIMIT=20000000 _APP_FUNCTIONS_SIZE_LIMIT=30000000 diff --git a/docker-compose.yml b/docker-compose.yml index 5c645e3bcd..b6f654bd6a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -571,6 +571,7 @@ services: - _APP_REDIS_PASS - _APP_SMS_PROVIDER - _APP_SMS_FROM + - _APP_SMS_DENY_LIST - _APP_LOGGING_PROVIDER - _APP_LOGGING_CONFIG diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index 09e77c01ca..4fd6c26afc 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -53,10 +53,21 @@ class Messaging extends Action */ public function action(Message $message): void { - var_dump($message); - $payload = $message->getPayload() ?? []; + if (empty($payload['project'])) { + Console::error('Project not found'); + return; + } + + Console::log($payload['project']['$id']); + $denyList = App::getEnv('_APP_SMS_DENY_LIST', ''); + $denyList = explode(',', $denyList); + if (in_array($payload['project']['$id'], $denyList)) { + Console::error("Project is in the deny list. Skipping ..."); + return; + } + if (empty($payload)) { Console::error('Payload arg not found'); return;