aboutsummaryrefslogtreecommitdiff
path: root/templates/index.tpl
diff options
context:
space:
mode:
Diffstat (limited to 'templates/index.tpl')
-rw-r--r--templates/index.tpl8
1 files changed, 6 insertions, 2 deletions
diff --git a/templates/index.tpl b/templates/index.tpl
index cbc7a72..2a5e853 100644
--- a/templates/index.tpl
+++ b/templates/index.tpl
@@ -174,9 +174,13 @@
174 return document.cookie.match(new RegExp(name + "=\"?([^;\"]*)\"?;?"))[1]; 174 return document.cookie.match(new RegExp(name + "=\"?([^;\"]*)\"?;?"))[1];
175 } 175 }
176 176
177 function parseJWTExpires(token) {
178 return new Date(JSON.parse(atob(token.split(".")[1]))["exp"] * 1000);
179 }
180
177 function populateAPIKey() { 181 function populateAPIKey() {
178 document.querySelector("#api-key textarea").innerText = getCookie("session"); 182 document.querySelector("#api-key textarea").innerText = "Bearer " + getCookie("github-token");
179 document.querySelector("#session-expires").innerText = getCookie("session-expires"); 183 document.querySelector("#session-expires").innerText = parseJWTExpires(getCookie("github-token"));
180 } 184 }
181 185
182 window.addEventListener('load', populateAPIKey); 186 window.addEventListener('load', populateAPIKey);