From ccc4398a5283fcff7eeb98cb67f0569c225dd0fc Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Fri, 28 Oct 2022 00:11:53 +0100 Subject: [PATCH] remove/comment out search code (JS files) which declare 'serverURL'. Because the code now establishes the 'server' variable in the various HTML Djula templates (grabbed from the database). The code which generates the old 'server' variable and it's data has been commented out or deleted. --- static/js/full-search.js | 14 +++++++++----- static/js/quick-search.js | 4 +--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/static/js/full-search.js b/static/js/full-search.js index 94f722b..36234ad 100644 --- a/static/js/full-search.js +++ b/static/js/full-search.js @@ -14,16 +14,20 @@ links the Meilisearch instance you have running to this website (link above for more information). */ -let server = ""; +// 'server' variable defined in /templates/search.html + +// -- constructed via Djula template. URL provided by data in this website's +// database. Value stored in back-end database and varies from localhost to +// prod. Which is why the database is stored in the database and passed to the +// view instead of trying to work it out in JavaScript -- the user can't change +// it here, only the developers can. + let apiKey = ""; if (location.hostname === "localhost" - || location.hostname === "127.0.0.1" - || location.hostname === "beta.nera.com") { - server = "http://localhost:7700"; + || location.hostname === "127.0.0.1") { apiKey= "meilisearch-beta-key"; } else { - server = "https://www.nera.net"; apiKey = "meilisearch-production-key-nera"; } diff --git a/static/js/quick-search.js b/static/js/quick-search.js index 7ca3f09..26fedd9 100644 --- a/static/js/quick-search.js +++ b/static/js/quick-search.js @@ -15,16 +15,14 @@ Meilisearch instance you have running to this website (link above for more information). */ -let server = ""; +// let server = ""; let apiKey = ""; if (location.hostname === "localhost" || location.hostname === "127.0.0.1" || location.hostname === "beta.nera.com") { - server = "http://localhost:7700"; apiKey= "meilisearch-beta-key"; } else { - server = "https://www.nera.com"; apiKey = "meilisearch-production-key-26-07-2022"; }