Skip to content

Commit

Permalink
🎨 Support for ignoring the prompt to add Microsoft Defender exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Dec 31, 2024
1 parent 5318529 commit 0802c20
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions kernel/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/system/getWorkspaceInfo", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getWorkspaceInfo)
ginServer.Handle("POST", "/api/system/reloadUI", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, reloadUI)
ginServer.Handle("POST", "/api/system/addMicrosoftDefenderExclusion", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, addMicrosoftDefenderExclusion)
ginServer.Handle("POST", "/api/system/ignoreAddMicrosoftDefenderExclusion", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, ignoreAddMicrosoftDefenderExclusion)

ginServer.Handle("POST", "/api/storage/setLocalStorage", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setLocalStorage)
ginServer.Handle("POST", "/api/storage/getLocalStorage", model.CheckAuth, getLocalStorage)
Expand Down
12 changes: 12 additions & 0 deletions kernel/api/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ func addMicrosoftDefenderExclusion(c *gin.Context) {
}
}

func ignoreAddMicrosoftDefenderExclusion(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)

if !gulu.OS.IsWindows() {
return
}

model.Conf.System.MicrosoftDefenderExcluded = true
model.Conf.Save()
}

func reloadUI(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
Expand Down

0 comments on commit 0802c20

Please sign in to comment.