This commit is contained in:
root
2025-11-13 19:52:28 +03:00
parent 8aeeb05b7d
commit 807dec3b6c
4646 changed files with 163445 additions and 626017 deletions

View File

@@ -1,15 +0,0 @@
<?php
namespace Bitrix\Location\Source\Google\Requesters;
/**
* Interface RequesterBase
* @package Bitrix\Location\Source\Google\Requesters
*/
final class AutocompleteRequester extends BaseRequester
{
protected $url = 'https://maps.googleapis.com/maps/api/place/autocomplete/json';
protected $requiredFields = ['input', 'language', 'key'];
protected $fieldsToEncode = ['input'];
}

View File

@@ -6,10 +6,9 @@ use Bitrix\Location\Entity\Source;
use Bitrix\Location\Repository\Location\IRepository;
use Bitrix\Location\Source\Osm\Api\Api;
use Bitrix\Location\StaticMap\ISourceStaticMapService;
use Bitrix\Main\Application;
use Bitrix\Main\ModuleManager;
use Bitrix\Main\Context;
use Bitrix\Main\License\UrlProvider;
use Bitrix\Main\Config\Option;
/**
* Class OsmSource
@@ -20,12 +19,10 @@ final class OsmSource extends Source
{
public const API_PATH = '/api';
private UrlProvider $urlProvider;
private TokenRequester $tokenRequester;
public function __construct()
{
$this->urlProvider = new UrlProvider();
$this->tokenRequester = (new TokenRequester())->setSource($this);
}
@@ -67,7 +64,7 @@ final class OsmSource extends Source
return [
'serviceUrl' => $this->getOsmApiUrl(),
'mapServiceUrl' => $this->getOsmMapServiceUrl(),
'token' => $token ? $token->getToken() : null,
'token' => $token?->getToken(),
'useGeocodingService' => true,
'hostName' => $this->getOsmHostName()
];
@@ -125,22 +122,12 @@ final class OsmSource extends Source
public function getOsmServiceUrl(): ?string
{
if (defined('LOCATION_OSM_SERVICE_URL') && LOCATION_OSM_SERVICE_URL)
{
return (string)LOCATION_OSM_SERVICE_URL;
}
return 'https://osm-' . $this->getSubDomainSuffix() . '-002.' . $this->urlProvider->getTechDomain();
return Option::get('location', 'osm_service_url');
}
public function getOsmMapServiceUrl(): ?string
{
if (defined('LOCATION_OSM_MAP_SERVICE_URL') && LOCATION_OSM_MAP_SERVICE_URL)
{
return (string)LOCATION_OSM_MAP_SERVICE_URL;
}
return 'https://osm-' . $this->getSubDomainSuffix() . '-001.' . $this->urlProvider->getTechDomain();
return Option::get('location', 'osm_map_service_url');
}
public function getOsmToken(): ?Token
@@ -158,11 +145,4 @@ final class OsmSource extends Source
return !$this->tokenRequester->hasLicenseIssues();
}
private function getSubDomainSuffix(): string
{
$region = Application::getInstance()->getLicense()->getRegion();
return in_array($region, ['ru', 'by', 'kz', 'uz'], true) ? 'ru' : 'de';
}
}