From d1cda0ba2f2d84b94848b9e825c9651d7cdfe9e9 Mon Sep 17 00:00:00 2001 From: Jonas Leder Date: Tue, 8 Mar 2022 10:05:28 +0100 Subject: [PATCH] load sitekey from graphql --- js/customElements/newComment.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/customElements/newComment.js b/js/customElements/newComment.js index 1523128..817628d 100644 --- a/js/customElements/newComment.js +++ b/js/customElements/newComment.js @@ -8,7 +8,15 @@ class newComment extends HTMLElement { } async setupForm() { - let sitekey = await (await fetch("/API/config.php?name=sitekey")).text(); + var graphql = JSON.stringify({ + query: "query {\r\n sitekey\r\n}" + }) + var requestOptions = { + method: 'POST', + body: graphql, + }; + + let sitekey = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.sitekey; let script = document.createElement('script'); script.src = "https://hCaptcha.com/1/api.js";