-
Notifications
You must be signed in to change notification settings - Fork 13
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
add IP change listener to getVerifiedLocationToken() #193
base: master
Are you sure you want to change the base?
Conversation
@@ -109,31 +108,9 @@ class TrackAPI { | |||
}, | |||
}); | |||
|
|||
let sclVal = -1; |
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.
Remove old ping call
src/api/verify.ts
Outdated
|
||
class VerifyAPI { | ||
static async ipChanged() { |
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.
Calls GET /v1/ping
, returns true
if IP changed
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.
nit: would call this function checkIPChange
Also, should this function only fire if lastIp
is set? otherwise it will always trigger a change
let { interval } = params; | ||
if (!interval) { | ||
interval = 60; | ||
Logger.info(`interval not provided, using 60 seconds`); |
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.
Adds default interval of 60 seconds, avoids bug if interval undefined
src/api/verify.ts
Outdated
ipChanged = await this.ipChanged(); | ||
} | ||
|
||
if (lastToken && lastToken.passed && !ipChanged) { |
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.
Requests new token if IP changed
@@ -96,7 +96,7 @@ class RadarMap extends maplibregl.Map { | |||
radarMapOptions, | |||
{ style }, | |||
); | |||
Logger.debug('map initailized with options', mapOptions); | |||
Logger.debug('map initialized with options', mapOptions); |
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.
Fix typo
@@ -104,6 +121,11 @@ class VerifyAPI { | |||
} | |||
} | |||
|
|||
if (params.ipChanges && trackRes?.user?.ip) { |
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.
Also picks up IP changes in trackVerified() responses
No description provided.