aboutsummaryrefslogtreecommitdiffstats
path: root/gps-track.rsc
diff options
context:
space:
mode:
Diffstat (limited to 'gps-track.rsc')
-rw-r--r--gps-track.rsc14
1 files changed, 6 insertions, 8 deletions
diff --git a/gps-track.rsc b/gps-track.rsc
index 1aeab84..e2a4e16 100644
--- a/gps-track.rsc
+++ b/gps-track.rsc
@@ -3,7 +3,7 @@
# Copyright (c) 2018-2024 Christian Hesse <mail@eworm.de>
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
#
-# requires RouterOS, version=7.12
+# requires RouterOS, version=7.13
#
# track gps data by sending json data to http server
# https://git.eworm.de/cgit/routeros-scripts/about/doc/gps-track.md
@@ -17,6 +17,7 @@
:global GpsTrackUrl;
:global Identity;
+ :global FetchUserAgentStr;
:global LogPrint;
:global ScriptLock;
:global WaitFullyConnected;
@@ -31,13 +32,10 @@
:if ($Gps->"valid" = true) do={
:do {
- /tool/fetch check-certificate=yes-without-crl $GpsTrackUrl output=none \
- http-method=post http-header-field=({ "Content-Type: application/json" }) \
- http-data=("{" . \
- "\"lat\":\"" . ($Gps->"latitude") . "\"," . \
- "\"lon\":\"" . ($Gps->"longitude") . "\"," . \
- "\"identity\":\"" . $Identity . "\"" . \
- "}") as-value;
+ /tool/fetch check-certificate=yes-without-crl output=none http-method=post \
+ http-header-field=({ [ $FetchUserAgentStr $ScriptName ]; "Content-Type: application/json" }) \
+ http-data=[ :serialize to=json { "identity"=$Identity; \
+ "lat"=($Gps->"latitude"); "lon"=($Gps->"longitude") } ] $GpsTrackUrl as-value;
$LogPrint debug $ScriptName ("Sending GPS data in " . $CoordinateFormat . " format: " . \
"lat: " . ($Gps->"latitude") . " " . \
"lon: " . ($Gps->"longitude"));