Trigger route sync from Device
CompletedHi,
I manage my routes on Komoot and love the sync feature in the dashboard .... but I would like to start the sync also from the routes app on the Karoo ... as I many times forget after adding a new route to Komoot to sync it afterwards and I just notice once I'm launching the K2 and the route is not there.
Ideally it would check the sync when the K2 syncs with the dashboard :) automatically
Ciao
-
I made a simple bash-script to refresh the routes. You can call it from cron, or something.
```#!/bin/bash
function jwt_decode(){jq-R'split(".") | .[1] | @base64d | fromjson'<<<"$1"}
# get the token from the Dahsboard Loginpagetoken=$(curl 'https://dashboard.hammerhead.io/v1/auth/token' \-H 'Accept: application/json; charset=UTF-8 ' \-H 'Content-Type: application/json' \--data-raw '{"grant_type": "password", "username": "<YOUR_USERNAME>", "password": "<YOUR_PASSWORD>"}' | jq '.access_token')
# get the userid from the jwt tokenuserid=$(jwt_decode $token | jq '.sub')
#to remove the double quotes from the token stringtoken=`sed -e 's/^"//' -e 's/"$//' <<<"$token"`
#to remove the double quotes from the userid stringuserid=`sed -e 's/^"//' -e 's/"$//' <<<"$userid"`
#Refresh the routes-H'Accept: */*'\-H'Accept-Language: en-US,en;q=0.9,nl;q=0.8'\-H"Authorization: Bearer $token"\-H'Connection: keep-alive'\-H'Content-Type: application/json'\-H'Origin: https://dashboard.hammerhead.io'\-H'Referer: https://dashboard.hammerhead.io/routes'\--data-raw'null'\--compressed```Or something -
Just as we figured out a workaround, Hammerhead finally implements a solution as well. Interesting timing, but well done all the same!
(I still have Martijns script running in my crontab, not planning to remove it but I guess I could change the frequency to just 3 times per day...)
Please sign in to leave a comment.


Comments
42 comments