bilde2910 / Hauk

Open-source realtime location sharing
Apache License 2.0
583 stars 58 forks source link

Client errors out when accuracy is not provided #165

Closed krystiancha closed 1 month ago

krystiancha commented 3 years ago

I was playing with the API and I stumbled upon an issue where if you don't include the acc field in a request the web client errors out. Comments in post.php seem to suggest that including acc should be optional.

    // Not all devices report speed and accuracy, but if available, report them
    // too.

Steps to reproduce:

curl -X POST -d "pwd=demo&dur=60&int=1" "https://apps.varden.info/demo/hauk/api/create.php"

open share link in browser, copy session ID and paste in place of sessionid below

curl -X POST -d "sid=sessionid&lat=50&lon=20&time=$(date +%s)" "https://apps.varden.info/demo/hauk/api/post.php"

web client shows

Share expired
This location share has expired.
[Dismiss]

browser console:

TypeError: Cannot read property 'setStyle' of null
    at processUpdate (main.js:71)
    at main.js:31
    at XMLHttpRequest.xhr.onreadystatechange (main.js:14)
bilde2910 commented 3 years ago

Thanks for the report, and sorry for the delay in getting back to you. This appears to be an error on the frontend wherein the map script at one point assumes that all users will have an accuracy value associated with them, even though, as you noted, the accuracy is supposed to be optional. Will make sure this gets fixed ASAP.