From 43d9296d9332ab5d60f5322e2b21d563cb9ff891 Mon Sep 17 00:00:00 2001 From: Ced Date: Wed, 8 Jan 2025 14:03:08 +0100 Subject: [PATCH] We have change the method used for the fetch api call. Previously we used the get method and now we use the post method. --- Chromium/lib/api.js | 8 +++++++- Chromium/lib/certificatesManager.js | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Chromium/lib/api.js b/Chromium/lib/api.js index 38d72f6..41ab2c9 100644 --- a/Chromium/lib/api.js +++ b/Chromium/lib/api.js @@ -14,7 +14,13 @@ CMH.api = {} CMH.api.requestFromUrl = async (urlTested) => { const { host, port } = CMH.common.parseURL(urlTested) - const { data:response_data, response } = await CMH.certificatesManager.getCertUrl(CMH.options.settings.checkServerUrl+'api.php?host='+encodeURIComponent(host)+'&port='+port) + let arguments = { + host: encodeURIComponent(host), + port: port, + sign: true + } + + const { data:response_data, response } = await CMH.certificatesManager.getCertUrl(CMH.options.settings.checkServerUrl+"api.php", false, arguments); if ( response === null ) { return { error: 'SERVER_UNREACHABLE' } } diff --git a/Chromium/lib/certificatesManager.js b/Chromium/lib/certificatesManager.js index 86a4fe6..5f42bf2 100644 --- a/Chromium/lib/certificatesManager.js +++ b/Chromium/lib/certificatesManager.js @@ -13,7 +13,7 @@ CMH.certificatesManager = {} * @param {boolean} [httpHeadMethod=false] - Use HTTP HEAD method * Get the certificate of an URL. */ -CMH.certificatesManager.getCertUrl = async (urlTested, httpHeadMethod=false) => { +CMH.certificatesManager.getCertUrl = async (urlTested, httpHeadMethod=false, arguments={}) => { let response = null let response_data = null @@ -21,7 +21,7 @@ CMH.certificatesManager.getCertUrl = async (urlTested, httpHeadMethod=false) => if (httpHeadMethod) { fetchInit = { method: 'HEAD' } } else { - fetchInit = {} + fetchInit = { method: 'POST', headers: {"Content-Type": "application/json"}, cache: 'no-cache', body: JSON.stringify(arguments)} } response = await fetch(urlTested, fetchInit)