From a2d7dede737947d7c6afa20a88e1f0c64e0eb96c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 10 Aug 2023 11:18:52 +0200 Subject: Merging upstream version 1.42.0. Signed-off-by: Daniel Baumann --- web/gui/v2/registry-access.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'web/gui/v2/registry-access.html') diff --git a/web/gui/v2/registry-access.html b/web/gui/v2/registry-access.html index a5f265043..ffa008a98 100644 --- a/web/gui/v2/registry-access.html +++ b/web/gui/v2/registry-access.html @@ -9,25 +9,25 @@ .then(function(response) { return response.json() }) : Promise.resolve(parentHelloData) - helloPromise.then(function(data) { + helloPromise.then(function(helloData) { var retries = 3 - var nodes = data.nodes || [] + var nodes = helloData.nodes || [] var doAccess = function(mg, nm, token) { - fetch(data.registry + '/api/v1/registry?action=access&machine=' + (mg || data.machine_guid) + '&name=' + encodeURIComponent(nm || data.hostname) + '&url=' + encodeURIComponent(originUrl) + '&agent=' + (data.agent ? data.agent.machine_guid : ""), { cache: "no-cache", credentials: "include", headers: { Authorization: 'Bearer ' + (token || localStorage.getItem("registry-netdata-token")) } }) + fetch(helloData.registry + '/api/v1/registry?action=access&machine=' + (mg || helloData.machine_guid) + '&name=' + encodeURIComponent(nm || helloData.hostname) + '&url=' + encodeURIComponent(originUrl) + '&agent=' + (helloData.agent ? helloData.agent.machine_guid : ""), { cache: "no-cache", credentials: "include", headers: { Authorization: 'Bearer ' + (token || localStorage.getItem("registry-netdata-token")) } }) .then(function(response) { return response.json() }) .then(function(data) { var token = data.person_guid if (data.status === "redirect" && retries > 0) { retries = retries - 1 - doAccess(data.machine_guid, data.hostname, token) + doAccess(helloData.machine_guid, helloData.hostname, token) } if (data.status === "ok") { localStorage.setItem("registry-netdata-token", token) - node = nodes.pop() + let node = nodes.pop() if (!!node) { setTimeout(function () { @@ -38,7 +38,7 @@ window.parent.postMessage(data, "*"); }) } - doAccess(data.machine_guid, data.hostname) + doAccess(helloData.machine_guid, helloData.hostname) }) } -- cgit v1.2.3