Notifications format

Zenon Panoussis3 years ago

I just configured notifications.

I'm getting SMSes like "Zenon online at 2021-08-04 22:59:34". That's ambiguous and it is not my local time (the server runs on UTC), so I found and checked templates/short/deviceOnline.vm. It says

$device.name online at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.eventTime, $locale, $timezone)

No timezone is configured for the device, nor for the account. I can't even find where to configure a per-user or per-device timezone. Per-device time zones don't make sense anyway, because devices can and do cross time zones. How can I make the template just report the timezone, like "Zenon online at 2021-08-04 22:59:34 UTC"?

The same notifications also arrive by mail. The mails say things like

Device: Zenon
Online
Time: 2021-08-04 22:59:34
Link: http://192.168.2.31:8082?eventId=95411

Just picking up the IP-address of the first interface and putting it in a link is not a good way to go. First, it could be a private address, which indeed is the case here. Second, it creates a certain security exposure. Third, traccar could be running as a NameVirtualHost on the same webserver as other stuff, and need to be reached by name and not by IP-address. Fourth, traccar could be only reachable through some other interface, not the first one, which is also the case here. Fifth, even the protocol is uncertain, because traccar could be (and ideally should be) https to the outside world.

In this case the link comes from templates/full/deviceOnline.vm, but 'href="$webUrl' is also used in many other templates. It seems to come from context web.url, but I can't figure where that in turn comes frm. There is no such configurable setting in Keys.java and, even if there was, it would be unclear what it would control: the bind address of the server, or its published links?

All in all, I think that this qualifies as a bug.

Anton Tananaev3 years ago

What exactly qualifies as a bug? If you want to configure your external URL, just set "web.url" in the config.