From 4a89526a020ac8f1e671267d230d4c55c1bacde3 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Fri, 19 Jan 2018 13:00:31 -0500 Subject: [PATCH] hide api key if not required --- js/kiri.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/kiri.js b/js/kiri.js index 413ac80a..581863d9 100644 --- a/js/kiri.js +++ b/js/kiri.js @@ -1045,6 +1045,8 @@ self.kiri.license = exports.LICENSE; apik = grid_apik.value, target = grid_target.value; + if (!apik) $('gpapik').style.display = 'none'; + xhtr.onreadystatechange = function() { if (xhtr.readyState === 4) { if (xhtr.status >= 200 && xhtr.status < 300) { @@ -1069,13 +1071,15 @@ self.kiri.license = exports.LICENSE; ); } grid_target.innerHTML = html.join('\n'); + } else if (xhtr.status === 401) { + $('gpapik').style.display = ''; } else { - alert("invalid grid-host: " + xhtr.responseText); + alert("invalid grid-print host"); } } }; - xhtr.open("GET", host + "/api/targets"); + xhtr.open("GET", host + "/api/targets?key=" + apik); xhtr.send(); }