Smail/server/hooks/spam_block/static/index.html

56 lines
1.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html>
<header>
<script>
function saveSettings() {
const form = document.getElementById("form");
window.parent.postMessage({
type: "smail-plugin-settings-save",
plugin: "SpamBlock",
payload: {
url: form.url.value,
timeout: form.timeout.value,
threshold: form.threshold.value
}
}, "*");
}
window.addEventListener("message", function (event) {
if (event.source === window.parent && event.data && event.data.type === "smail-plugin-settings-result" && event.data.plugin === "SpamBlock") {
alert(event.data.ok ? "保存成功" : "保存失败");
}
});
</script>
</header>
<body>
<div>
<form id="form" action="#" method="post">
<div>
<label for="url"> 模型API接口地址: </label>
<input id="url" style="width: 600px;" name="url" value="%s"
placeholder="https://model.example.com/v1/predict">
</div>
<div>
<label for="timeout"> 超时时间: </label>
<input id="timeout" style="width: 600px;" name="timeout" value="%d" placeholder="单位毫秒">
</div>
<div>
<label for="threshold"> 识别阈值: </label>
<input id="threshold" name="threshold" type="number" value="%f" style="width: 600px;"
step=".01" max="100" min="0" placeholder="识别阈值,值越低过滤越严格,越容易误判">
</div>
<input id="submit" type="button" value="保存" onclick="saveSettings()"/>
</form>
</div>
</body>
</html>