mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-26 18:22:07 +08:00
ui: re-generate JWT on valid system time (#32571)
* revert me
* Revert "revert me"
This reverts commit 17d815ddfc9a18f7fb9f39f89ec8b4481389b339.
* duh we have timed!
* clean up
* use clocks
* re-initialize map on SSL handshake failure (time)
* this is fine, takes some time to init
* fix
* log errors like map renderer
* more clean up
full message is "loading style failed: SSL handshake failed"
* MOAR
* we still can't swap the token live
* mbgl has its own retries that never work, don't reinit multiple times at once
* simpler
* more
* whoops
* this works
* fix from merge
* rm
* fix cmt
* only an issue calling the function inside itself
old-commit-hash: 57d64279bd
This commit is contained in:
@@ -119,6 +119,14 @@ void MapWindow::updateState(const UIState &s) {
|
||||
const SubMaster &sm = *(s.sm);
|
||||
update();
|
||||
|
||||
// on rising edge of a valid system time, reinitialize the map to set a new token
|
||||
if (sm.valid("clocks") && !prev_time_valid) {
|
||||
LOGW("Time is now valid, reinitializing map");
|
||||
m_settings.setApiKey(get_mapbox_token());
|
||||
initializeGL();
|
||||
}
|
||||
prev_time_valid = sm.valid("clocks");
|
||||
|
||||
if (sm.updated("liveLocationKalman")) {
|
||||
auto locationd_location = sm["liveLocationKalman"].getLiveLocationKalman();
|
||||
auto locationd_pos = locationd_location.getPositionGeodetic();
|
||||
|
||||
@@ -51,6 +51,7 @@ private:
|
||||
void setError(const QString &err_str);
|
||||
|
||||
bool loaded_once = false;
|
||||
bool prev_time_valid = true;
|
||||
|
||||
// Panning
|
||||
QPointF m_lastPos;
|
||||
|
||||
+1
-1
@@ -249,7 +249,7 @@ UIState::UIState(QObject *parent) : QObject(parent) {
|
||||
sm = std::make_unique<SubMaster, const std::initializer_list<const char *>>({
|
||||
"modelV2", "controlsState", "liveCalibration", "radarState", "deviceState",
|
||||
"pandaStates", "carParams", "driverMonitoringState", "carState", "liveLocationKalman", "driverStateV2",
|
||||
"wideRoadCameraState", "managerState", "navInstruction", "navRoute", "uiPlan",
|
||||
"wideRoadCameraState", "managerState", "navInstruction", "navRoute", "uiPlan", "clocks",
|
||||
});
|
||||
|
||||
Params params;
|
||||
|
||||
Reference in New Issue
Block a user