-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ui: generate JWT on every (re-)route #32480
Conversation
Thanks for contributing to openpilot! In order for us to review your PR as quickly as possible, check the following:
|
since the solution is to generate JWT for every request, I've added the JWT generation when we |
selfdrive/ui/qt/maps/map.cc
Outdated
@@ -362,6 +364,7 @@ void MapWindow::offroadTransition(bool offroad) { | |||
} | |||
|
|||
void MapWindow::updateDestinationMarker() { | |||
m_settings.setApiKey(get_mapbox_token()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you sure this updates the settings for the underlying MapLibre widget?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, The MapWindow
class has both m_settings
and m_map
as private and since we're updating the setting within the class it would be updating the setting of the MapLibre widget
class MapWindow : public QOpenGLWidget {
Q_OBJECT
public:
MapWindow(const QMapLibre::Settings &);
~MapWindow();
private:
void initializeGL() final;
void paintGL() final;
void resizeGL(int w, int h) override;
QMapLibre::Settings m_settings;
QScopedPointer<QMapLibre::Map> m_map;
An example of this can be seen with m_map
where we make updates to the QMapLibre::map
itself such as setting the zoom and coordinates:
if (interaction_counter == 0) {
if (last_position) m_map->setCoordinate(*last_position);
if (last_bearing) m_map->setBearing(*last_bearing);
m_map->setZoom(util::map_val<float>(velocity_filter.x(), 0, 30, MAX_ZOOM, MIN_ZOOM));
} else {
interaction_counter--;
}
I finally was able to test this personally (car had been in repair for little over a week) and didn't see any issues. Route w/ GPS: anything else needed? @adeebshihadeh |
Same as every PR - we just need to find some time to validate it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's only update the token when getting a new navRoute from navd (when it gets its own new token, as you found)
This also doesn't work because the internal map object only gets the token from the settings on init: https://github.com/maplibre/maplibre-native-qt/blob/3a83b8ecfd961983cf3670a145ef6176333dd443/src/core/map.cpp#L1617 This is seen when testing as well, you can open the map with an invalid date, then fix it and send a new nav route; it never loads. |
Closing in favor of #32571 |
After a better understanding of the problem, it made sense to match when JWT is generated in navd which is where the route is calculated.
For ui, this would be when a new route is received.
i left the other places where JWT is generated as is (initial boot and onroadTransition) and just added an update to the m_settings within where the new route is received. I also updated the expiry time to match navd.
Resolves #32398