recorder icon indicating copy to clipboard operation
recorder copied to clipboard

no geolocation in Recorder's last/ URL

Open eBug opened this issue 5 months ago • 21 comments

ocat correctly returns address associated with coordinates (I'm using opencage) but the address doesn't appears in maps:

ocat --last|jq
[
 {
   "_type": "location",
   "_id": "9e0013c1",
   "acc": 100,
   "alt": 146,
   "batt": 93,
   "bs": 1,
   "cog": 0,
   "conn": "m",
   "created_at": 1751797501,
   "m": 1,
   "t": "c",
   "tid": "p5",
   "tst": 1751797499,
   "vac": 3,
   "vel": 0,
   "topic": "owntracks/eric/pixel5",
   "username": "eric",
   "device": "pixel5",
   "ghash": "u150urd",
   "isotst": "2025-07-06T10:24:59Z",
   "disptst": "2025-07-06 10:24:59",
   "tzname": "Europe/Brussels",
   "isolocal": "2025-07-06T12:24:59+0200",
   "cc": "BE",
   "addr": "[REDACTED]"
 }
]


image redacted

eBug avatar Jul 06 '25 10:07 eBug

Is that really a screenshot from our Frontend program or rather from the Recorder's own builtin simple Web interface? (I think the latter.)

jpmens avatar Jul 06 '25 11:07 jpmens

Is that really a screenshot from our Frontend program or rather from the Recorder's own builtin simple Web interface? (I think the latter.)

this is from owntracks/last URL.

eBug avatar Jul 06 '25 18:07 eBug

Thanks for clarifying.

Indeed that looks strange, as the coordinates you are showing match.

Can you show the result of a Recorder API access for that timeframe? Something along the lines of

curl -sSf "http://hostnameIPaddress:8083/api/0/locations?user=eric&device= pixel5&from=2025-07-06T10:24:00&to=2025-07-06T10:26"

you might have to juggle a bit with the timestamps to get the correct records

jpmens avatar Jul 07 '25 07:07 jpmens

I can reach the API locally when ssh'ed to the server but not remotely:

[REDACTED]

eBug avatar Jul 07 '25 08:07 eBug

I can reach the API locally when ssh'ed to the server but not remotely:

that is expected (and we sure hope it's the case) because you hopefully have your system on a TLS port (probably 443). If you installed via our Quicksetup, which you seem to have done, that will be the case.

Thanks for the output.

jpmens avatar Jul 07 '25 09:07 jpmens

Could you please re-run the query with last?

curl -sSf "http://127.0.0.1:8083/api/0/last?user=eric&device=pixel5&from=2025-07-06T10:24:00&to=2025-07-06T10:26" | jq

jpmens avatar Jul 07 '25 09:07 jpmens

I can reach the API locally when ssh'ed to the server but not remotely:

that is expected (and we sure hope it's the case) because you hopefully have your system on a TLS port (probably 443). If you installed via our Quicksetup, which you seem to have done, that will be the case.

Thanks for the output.

I installed running Quicksetup but instead of nginx I'm with Apache so I had to build a custom vhost directive (a bit painful indeed, the proxy directives documented didn't work for me).

eBug avatar Jul 07 '25 10:07 eBug

[REDACTED]

eBug avatar Jul 07 '25 10:07 eBug

Strange enough, if I report my position the /last map gets updated with address:

[image REDACTED]

but if I refresh the same page (F5) the address vanishes:

[image REDACTED]

eBug avatar Jul 07 '25 10:07 eBug

The example curl output you posted above has different coordinates from your original post, because your smartphone has since updated the location.

Can you please perform curl query on the /api/0/last and /api/0/locations URLs both of which return the same object?

I cannot reproduce the behavior you're seeing, also not the Web page REFRESH behavior, hence the need for more data.

jpmens avatar Jul 07 '25 10:07 jpmens

eric@hel:~$ curl -sSf "http://127.0.0.1:8083/api/0/last?user=eric&device=pixel5&from=2025-07-07T07:15:00&to=2025-07-07T07:26" | jq
[
  {
    "_type": "location",
    "_id": "0c11aaaa",
    "acc": 348,
    "alt": 110,
    "batt": 81,
    "bs": 1,
    "cog": 0,
    "conn": "w",
    "created_at": 1751884061,
    "m": 1,
    "tid": "p5",
    "tst": 1751884052,
    "vac": 1,
    "vel": 0,
    "topic": "owntracks/eric/pixel5",
    "username": "eric",
    "device": "pixel5",
    "ghash": "u151784",
    "isotst": "2025-07-07T10:27:32Z",
    "disptst": "2025-07-07 10:27:32",
    "tzname": "Europe/Brussels",
    "isolocal": "2025-07-07T12:27:32+0200"
  }
]

eric@hel:~$ curl -sSf "http://127.0.0.1:8083/api/0/locations?user=eric&device=pixel5&from=2025-07-07T10:15:00&to=2025-07-07T10:30" | jq
{
  "count": 1,
  "data": [
    {
      "_type": "location",
      "_id": "0c11aaaa",
      "acc": 348,
      "alt": 110,
      "batt": 81,
      "bs": 1,
      "cog": 0,
      "conn": "w",
      "created_at": 1751884061,
      "m": 1,
      "tid": "p5",
      "tst": 1751884052,
      "vac": 1,
      "vel": 0,
      "ghash": "u151784",
      "isorcv": "2025-07-07T10:27:32Z",
      "isotst": "2025-07-07T10:27:32Z",
      "disptst": "2025-07-07 10:27:32",
      "tzname": "Europe/Brussels",
      "isolocal": "2025-07-07T12:27:32+0200"
    }
  ],
  "status": 200,
  "version": "1.0.0"
}

partially redacted

eBug avatar Jul 07 '25 10:07 eBug

So both records have comparable content, and that is good. Now let's please verify whether that particular location was actually reverse-coded.

On the server, please run:

$ ocat --dump | grep u151784

(That's the geohash reported from that particular location.)

If you get no output, please check whether the location is missing in the database:

$ grep u151784 /var/spool/owntracks/recorder/store/ghash/missing

jpmens avatar Jul 07 '25 11:07 jpmens

Info: I have edited all your comments to remove privacy-related geo information.

jpmens avatar Jul 07 '25 11:07 jpmens

eric@hel:~$ ocat --dump | grep u151784
u151784 {"cc":"BE","addr":"[REDACTED]","tst":1751884062,"locality":"Brussels","tzname":"Europe/Brussels"}
eric@hel:~$ 

eBug avatar Jul 07 '25 12:07 eBug

Please redact your own location information from now on!

jpmens avatar Jul 07 '25 12:07 jpmens

Please redact your own location information from now on!

sure, but don't you need this piece of info to debug?

eBug avatar Jul 07 '25 12:07 eBug

We don't need the exact address, nor do we need lat / lon as we assume that you will do the actual checking to see whether the data is accurate. If we do need the actual data we would ask you to email it so that it doesn't show up here.

jpmens avatar Jul 07 '25 13:07 jpmens

We cannot reproduce this behavior here. Needs research and/or further evidence.

jpmens avatar Jul 08 '25 11:07 jpmens

Is there anything I can do to figure this out?

eBug avatar Jul 08 '25 13:07 eBug

There is one difference between the installs I have tested and yours: you mentioned you have the Recorder running behind an Apache configuration. Can you please post the pertinent reverse proxy config here (remember to redact secrets) so I can take a look?

At the same time, you could install an nginx in parallel to your Apache (ensuring distinct ports if necessary) and test whether you can reproduce the issue with that.

jpmens avatar Jul 08 '25 14:07 jpmens

There is one difference between the installs I have tested and yours: you mentioned you have the Recorder running behind an Apache configuration. Can you please post the pertinent reverse proxy config here (remember to redact secrets) so I can take a look?

Sorry for the delay, I was travelling.


# === Proxy all dynamic routes to backend ===
    ProxyPass /owntracks/api/       http://127.0.0.1:8083/api/
    ProxyPass /owntracks/last/      http://127.0.0.1:8083/last/
    ProxyPass /owntracks/pub        http://127.0.0.1:8083/pub
    ProxyPass "/owntracks/map/"     "http://127.0.0.1:8083/map/"
    ProxyPass /owntracks/table/     http://127.0.0.1:8083/table/
    ProxyPass /owntracks/view/      http://127.0.0.1:8083/view/
    ProxyPass /owntracks/static/      http://127.0.0.1:8083/static/
    ProxyPass /owntracks/utils/     http://127.0.0.1:8083/utils/
    ProxyPassReverse /owntracks/ http://127.0.0.1:8083/
 
    # === WebSocket support ===
#    RewriteEngine On
#    RewriteCond %{HTTP:Upgrade} =websocket [NC]
#    RewriteRule ^/owntracks/ws/?(.*)$  ws://127.0.0.1:8083/ws/$1  [P,L]
ProxyPass        /owntracks/ws        ws://127.0.0.1:8083/ws keepalive=on retry=60
ProxyPassReverse /owntracks/ws        ws://127.0.0.1:8083/ws keepalive=on
 
    # === Authentication for OwnTracks views ===
    <LocationMatch "^/owntracks/$">
        Options Indexes
        AuthType Basic
        AuthName "OwnTracks"
        AuthUserFile /usr/local/owntracks/userdata/htpasswd
        Require valid-user
 
        Header always set Set-Cookie "otrauth=1mN.5W6ellxv,_HsnDCG; Max-Age=86400; Path=/; Secure; SameSite=None"
    </LocationMatch>
 
    <LocationMatch "^/owntracks/(api|last|map|table)/">
        AuthType Basic
        AuthName "OwnTracks"
        AuthUserFile /usr/local/owntracks/userdata/htpasswd
        Require valid-user
 
        Header always set Set-Cookie "otrauth=1mN.5W6ellxv,_HsnDCG; Max-Age=86400; Path=/; Secure; SameSite=None"
    </LocationMatch>
 
    <LocationMatch "^/owntracks/(view|static|utils)/">
    RequestHeader set Host %{HTTP_HOST}e
    RequestHeader set X-Forwarded-For %{REMOTE_ADDR}e
    RequestHeader set X-Real-IP %{REMOTE_ADDR}e
    </LocationMatch>
 
    # === Special for /owntracks/pub to set X-Limit-U ===
<Location /owntracks/pub>
    AuthType Basic
    AuthName "My OwnTracks"
    AuthUserFile /usr/local/owntracks/userdata/htpasswd
    Require valid-user
 
    # Proxy settings
    #ProxyPass http://127.0.0.1:8083/pub
    #ProxyPassReverse http://127.0.0.1:8083/pub
 
    # HTTP headers equivalent
    RequestHeader set Host %{HTTP_HOST}e
    RequestHeader set X-Forwarded-For %{REMOTE_ADDR}e
    RequestHeader set X-Real-IP %{REMOTE_ADDR}e
    RequestHeader set X-Limit-U %{REMOTE_USER}e
</Location>

eBug avatar Sep 25 '25 10:09 eBug