From 962ebf5b98d496099ab6277d5e82f38e55f5e151 Mon Sep 17 00:00:00 2001 From: Daniel Bulant Date: Tue, 14 Apr 2020 10:54:28 +0200 Subject: [PATCH] Show comments and privileges --- index.js | 2 +- static/index.html | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 8a79575..afccad9 100644 --- a/index.js +++ b/index.js @@ -52,7 +52,7 @@ app.get("/tables", (req, res) => { var obj = {}; for(var r of result) { try { - obj[r] = await query(pool, "DESCRIBE " + r); + obj[r] = await query(pool, "SHOW FULL COLUMNS FROM " + r); } catch(e){ console.error(e); } diff --git a/static/index.html b/static/index.html index f6bd21e..484b1ad 100644 --- a/static/index.html +++ b/static/index.html @@ -21,6 +21,11 @@ } (async () => { + if(window.location.hostname !== "localhost") { + console.log("Fetching info supported only from localhost!"); + return; + } + var res = await fetch("/tables"); var tables = await res.json(); app.innerText = ""; @@ -41,6 +46,8 @@ Key? Default Extra? + Privileges + Comment `); @@ -54,6 +61,8 @@ ${field.Key} ${field.Default} ${field.Extra} + ${field.Privileges} + ${field.Comment} `)) }