mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-09-13 03:44:27 +08:00
31 lines
975 B
HTML
31 lines
975 B
HTML
<script type="text/javascript">
|
|
//<![CDATA[
|
|
function fetchCertSha256(el) {
|
|
if (el.getAttribute("data-loading") === "1") return;
|
|
el.setAttribute("data-loading", "1");
|
|
el.style.pointerEvents = "none";
|
|
el.style.color = "red";
|
|
XHR.get('<%=self.api.url("fetch_certsha256")%>', { id: "<%=self.section%>" }, function(x, res) {
|
|
el.setAttribute("data-loading", "0");
|
|
el.style.pointerEvents = "";
|
|
el.style.color = "";
|
|
if (!x || x.status !== 200) {
|
|
alert("<%:Error%>");
|
|
return;
|
|
}
|
|
if (!res || res.code !== 1 || !res.data) {
|
|
alert(res && res.msg ? res.msg : "<%:Fetch Failed!%>\n" +
|
|
"<%:Requires OpenSSL to retrieve the TLS certificate chain fingerprint.%>\n" +
|
|
"<%:QUIC protocols such as HY2 also require curl with http3 support.%>"
|
|
);
|
|
return;
|
|
}
|
|
const inputs = document.querySelectorAll('input[id$=".xray_tls_pinSHA256"]');
|
|
inputs.forEach(function(input) {
|
|
input.value = res.data;
|
|
});
|
|
});
|
|
}
|
|
//]]>
|
|
</script>
|