🎨 Support one-click addition of Microsoft Defender exclusions https://github.com/siyuan-note/siyuan/issues/13650

This commit is contained in:
Daniel 2024-12-29 11:03:09 +08:00
parent 203dbfa35a
commit 324e6ae8da
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
14 changed files with 16 additions and 16 deletions

View file

@ -8,10 +8,11 @@ import {fetchPost} from "./fetch";
export const processMessage = (response: IWebSocketData) => {
if ("msg" === response.cmd) {
showMessage(response.msg, response.data.closeTimeout, response.code === 0 ? "info" : "error", response.data.id);
const id = showMessage(response.msg, response.data.closeTimeout, response.code === 0 ? "info" : "error", response.data.id);
document.querySelector("#message #addMicrosoftDefenderExclusion")?.addEventListener("click", (event) => {
fetchPost("/api/system/addMicrosoftDefenderExclusion", {}, (response) => {
(event.target as HTMLElement).innerHTML = '<svg class="fn__rotate" style="margin-right: 0;"><use xlink:href="#iconRefresh"></use></svg>';
(event.target as HTMLElement).innerHTML = '<svg class="fn__rotate" style="margin-right: 0;"><use xlink:href="#iconRefresh"></use></svg>';
fetchPost("/api/system/addMicrosoftDefenderExclusion", {}, () => {
hideMessage(id);
});
}, {once: true});
return false;