diff --git a/selfdrive/ui/qt/maps/map.h b/selfdrive/ui/qt/maps/map.h index 917b4d8c10..63f25a625b 100644 --- a/selfdrive/ui/qt/maps/map.h +++ b/selfdrive/ui/qt/maps/map.h @@ -27,7 +27,8 @@ #include "selfdrive/common/util.h" #include "cereal/messaging/messaging.h" -const QString MAPS_HOST = util::getenv("MAPS_HOST", "https://maps.comma.ai").c_str(); +const QString MAPBOX_TOKEN = util::getenv("MAPBOX_TOKEN").c_str(); +const QString MAPS_HOST = util::getenv("MAPS_HOST", MAPBOX_TOKEN.isEmpty() ? "https://maps.comma.ai" : "https://api.mapbox.com").c_str(); class MapInstructions : public QWidget { Q_OBJECT diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 01ace08b37..8279035fa0 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -79,11 +79,11 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) { void OnroadWindow::offroadTransition(bool offroad) { #ifdef ENABLE_MAPS if (!offroad) { - if (map == nullptr && QUIState::ui_state.has_prime) { + if (map == nullptr && (QUIState::ui_state.has_prime || !MAPBOX_TOKEN.isEmpty())) { QMapboxGLSettings settings; // Valid for 4 weeks since we can't swap tokens on the fly - QString token = CommaApi::create_jwt({}, 4 * 7 * 24 * 3600); + QString token = MAPBOX_TOKEN.isEmpty() ? CommaApi::create_jwt({}, 4 * 7 * 24 * 3600) : MAPBOX_TOKEN; if (!Hardware::PC()) { settings.setCacheDatabasePath("/data/mbgl-cache.db");