From e58f18046328ac288778264daa89b9d5b7baf5c7 Mon Sep 17 00:00:00 2001 From: Joerg Lehmann Date: Thu, 9 Apr 2020 13:46:42 +0200 Subject: [PATCH] new influxdb auth --- metrics.go | 6 +++--- snippets/graph.html | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/metrics.go b/metrics.go index f8069cd..9bc1056 100644 --- a/metrics.go +++ b/metrics.go @@ -108,7 +108,7 @@ func metricsHandler(response http.ResponseWriter, request *http.Request) { } // Set headers - req.Header.Set("Authorization", "Token xXnq8ADcDygAyM_L0B_10c9yuoOv-cYcUfIXkJunRrIDMhB5ZNmza-Whr1ELcbKNzW8GzUMMYD85QohUHQdAmg==") + req.Header.Set("Authorization", "Token OzSltiHLmm3WCaFPI0DrK0VFAVCiqcORNrGsgHO43jb0qodyVGAumJQ3HRtkaze53BVR3AmHqfkmrwrjq-xTyA==") req.Header.Set("accept", "application/csv") req.Header.Set("content-type", "application/vnd.flux") @@ -194,7 +194,7 @@ func lastmetricsHandler(response http.ResponseWriter, request *http.Request) { } // Set headers - req.Header.Set("Authorization", "Token xXnq8ADcDygAyM_L0B_10c9yuoOv-cYcUfIXkJunRrIDMhB5ZNmza-Whr1ELcbKNzW8GzUMMYD85QohUHQdAmg==") + req.Header.Set("Authorization", "Token OzSltiHLmm3WCaFPI0DrK0VFAVCiqcORNrGsgHO43jb0qodyVGAumJQ3HRtkaze53BVR3AmHqfkmrwrjq-xTyA==") req.Header.Set("accept", "application/csv") req.Header.Set("content-type", "application/vnd.flux") @@ -291,7 +291,7 @@ func getLastMetrics(deveui string) OneMetric { } // Set headers - req.Header.Set("Authorization", "Token xXnq8ADcDygAyM_L0B_10c9yuoOv-cYcUfIXkJunRrIDMhB5ZNmza-Whr1ELcbKNzW8GzUMMYD85QohUHQdAmg==") + req.Header.Set("Authorization", "Token OzSltiHLmm3WCaFPI0DrK0VFAVCiqcORNrGsgHO43jb0qodyVGAumJQ3HRtkaze53BVR3AmHqfkmrwrjq-xTyA==") req.Header.Set("accept", "application/csv") req.Header.Set("content-type", "application/vnd.flux") diff --git a/snippets/graph.html b/snippets/graph.html index 92dae7b..2b5f2e0 100644 --- a/snippets/graph.html +++ b/snippets/graph.html @@ -207,11 +207,15 @@ function drawGraph(deveui, alias, property, start, stop, create_graph) { $.getJSON('https://mini-beieli.ch/metrics?deveui=' + deveui + '&alias=' + alias + '&property=' + property + range, function(mydata) { if ("msg" in mydata) { - $('#chart').html(`
+ if (mydata.msg.includes("expired")) { + $('#chart').html(`
- Abo ist abgelaufen! + Abo ist abgelaufen
`); + } else { + location.reload(true); + } return; } var options = {