new influxdb auth

This commit is contained in:
Joerg Lehmann 2020-04-09 13:46:42 +02:00
parent 2ef9508fee
commit e58f180463
2 changed files with 9 additions and 5 deletions

View File

@ -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")

View File

@ -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(`<article class="message is-danger">
if (mydata.msg.includes("expired")) {
$('#chart').html(`<article class="message is-danger">
<div class="message-body">
Abo ist abgelaufen!
Abo ist abgelaufen
</div>
</article>`);
} else {
location.reload(true);
}
return;
}
var options = {