mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-09-11 10:54:46 +08:00
33 lines
865 B
HTML
33 lines
865 B
HTML
<%
|
|
local map = self.map
|
|
local api = map.api
|
|
local sid = self.section
|
|
-%>
|
|
<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('<%=api.url("fetch_certsha256")%>', { id: "<%=sid%>" }, 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%> !");
|
|
return;
|
|
}
|
|
const inputs = document.querySelectorAll('input[id$=".xray_tls_pinSHA256"]');
|
|
inputs.forEach(function(input) {
|
|
input.value = res.data;
|
|
});
|
|
});
|
|
}
|
|
//]]>
|
|
</script>
|