[core] Treat custom map download URL as CDN base, not meta server

- Update `MapFilesDownloader::LoadMetaConfig()` to skip the metaserver when a
  custom base URL is set and build MetaConfig with that URL as the only server.
- Keep the existing metaserver-based behavior when no custom base URL is set.

Signed-off-by: NoelClick <dev@noel.click>
This commit is contained in:
NoelClick
2025-11-20 17:38:07 -08:00
committed by jeanbaptisteC
parent 08e8ebd434
commit 6ded75de9c
4 changed files with 36 additions and 10 deletions

View File

@@ -156,6 +156,26 @@ std::string GetAcceptLanguage()
MetaConfig MapFilesDownloader::LoadMetaConfig()
{
Platform & pl = GetPlatform();
std::optional<MetaConfig> metaConfig;
std::string const customServer = pl.CustomMapServerUrl();
if (!customServer.empty())
{
LOG(LINFO, ("Using custom map server URL:", customServer));
// Reuse default meta settings (timeouts, other endpoints) and override servers
metaConfig = downloader::ParseMetaConfig(pl.DefaultUrlsJSON());
CHECK(metaConfig, ());
metaConfig->m_serversList.clear();
metaConfig->m_serversList.push_back(customServer);
LOG(LINFO, ("Got servers list (custom server):", metaConfig->m_serversList));
CHECK(!metaConfig->m_serversList.empty(), ());
return *metaConfig;
}
std::string const metaServerUrl = pl.MetaServerUrl();
std::string httpResult;
@@ -170,7 +190,7 @@ MetaConfig MapFilesDownloader::LoadMetaConfig()
request.RunHttpRequest(httpResult);
}
std::optional<MetaConfig> metaConfig = downloader::ParseMetaConfig(httpResult);
metaConfig = downloader::ParseMetaConfig(httpResult);
if (!metaConfig)
{
metaConfig = downloader::ParseMetaConfig(pl.DefaultUrlsJSON());