From ec5c15ff6455821947cb5157acdd355c06c07e7e Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Tue, 10 Dec 2019 15:34:51 +0000 Subject: [PATCH] importing of certificates --- webui/src/main/js/search.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/webui/src/main/js/search.js b/webui/src/main/js/search.js index 5ef8a596..6e1ecd53 100644 --- a/webui/src/main/js/search.js +++ b/webui/src/main/js/search.js @@ -186,6 +186,12 @@ class Certificate { this.imported = xmlNode.getElementsByTagName("Imported")[0].childNodes[0].nodeValue } + getImportLink() { + var linkText = _t("Import") + var link = "" + linkText + "" + return link + } + renderRow() { var commentPresent = "false" if (this.comment != null) @@ -200,7 +206,7 @@ class Certificate { if (this.imported == "true") html += "" + _t("Imported") + "" else - html += "" + _t("Import") + "" + html += "" + this.getImportLink() + "" html += "" return html @@ -681,6 +687,18 @@ function hideCertificatesBySender(fileInfoHash, count) { linkSpan.innerHTML = showLink } +function importCertificate(b64) { + var xmlhttp = new XMLHttpRequest() + xmlhttp.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + refreshCertificates() + } + } + xmlhttp.open("POST", "/MuWire/Certificate", true) + xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + xmlhttp.send("action=import&base64=" + b64) +} + function refreshStatus() { var xmlhttp = new XMLHttpRequest() xmlhttp.onreadystatechange = function() {