Skip to content
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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

nickpatrick
Copy link
Contributor

No description provided.

@@ -109,31 +108,9 @@ class TrackAPI {
},
});

let sclVal = -1;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove old ping call


class VerifyAPI {
static async ipChanged() {
Copy link
Contributor Author

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

Copy link
Collaborator

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`);
Copy link
Contributor Author

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

ipChanged = await this.ipChanged();
}

if (lastToken && lastToken.passed && !ipChanged) {
Copy link
Contributor Author

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);
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants