Update
This commit is contained in:
@@ -9,12 +9,11 @@ use Bitrix\Main\Service\MicroService\BaseSender;
|
||||
class ApiClient extends BaseSender
|
||||
{
|
||||
protected const SERVICE_ENDPOINT_OPTION = 'service_endpoint';
|
||||
protected const DEFAULT_ENDPOINT = 'https://unc.bitrix24.tech';
|
||||
protected const ENDPOINTS = [
|
||||
'ru' => 'https://unc.bitrix24.tech',
|
||||
'en' => 'https://unc-eu.bitrix.info',
|
||||
];
|
||||
protected const RU_REGIONS = ['ru', 'by', 'kz', 'uz'];
|
||||
protected const RU_REGIONS = ['ru', 'kz', 'by', 'uz', 'am', 'az', 'ge', 'kg'];
|
||||
|
||||
protected $customEndpoint;
|
||||
|
||||
@@ -69,4 +68,14 @@ class ApiClient extends BaseSender
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function getFileProxyUrl(string $url): Result
|
||||
{
|
||||
return $this->performRequest(
|
||||
'notificationservice.File.create',
|
||||
[
|
||||
'url' => $url,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ use Bitrix\MessageService\Providers\Constants\InternalOption;
|
||||
|
||||
class Sender extends Providers\Edna\Sender
|
||||
{
|
||||
protected const RU_REGIONS = ['ru'];
|
||||
|
||||
public const AVAILABLE_CONTENT_TYPES = [
|
||||
'image/jpeg' => 5 * 1024 * 1024,
|
||||
'image/png' => 5 * 1024 * 1024,
|
||||
@@ -183,9 +185,9 @@ class Sender extends Providers\Edna\Sender
|
||||
private function getSimpleMessageContent(array $messageFields): array
|
||||
{
|
||||
$contentType = Constants::CONTENT_TYPE_TEXT;
|
||||
$messageBody = $messageFields['MESSAGE_BODY'];
|
||||
$messageBody = trim($messageFields['MESSAGE_BODY']);
|
||||
|
||||
if (Loader::includeModule('disk') && preg_match('/^http.+~.+$/', trim($messageBody)))
|
||||
if (!$this->isRuRegion() && Loader::includeModule('disk') && preg_match('/^http.+~.+$/', $messageBody))
|
||||
{
|
||||
$fileUri = \CBXShortUri::GetUri($messageBody);
|
||||
if ($fileUri)
|
||||
@@ -350,4 +352,11 @@ class Sender extends Providers\Edna\Sender
|
||||
$this->optionManager->getStreamTimeout()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function isRuRegion(): bool
|
||||
{
|
||||
$region = \Bitrix\Main\Application::getInstance()->getLicense()->getRegion() ?? 'en';
|
||||
|
||||
return in_array($region, static::RU_REGIONS, true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user