Merge pull request #317 from Moonlight-Panel/AddManualMalwareScan

Added manual malware scan
This commit is contained in:
Marcel Baumgartner 2023-09-12 10:50:29 +02:00 committed by GitHub
commit 73a07761f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,20 +1,26 @@
@using Moonlight.App.Database.Entities
@using Moonlight.App.Services
@using Moonlight.App.Services.Interop
@inject ServerService ServerService
@inject SmartTranslateService SmartTranslateService
@inject MalwareScanService MalwareScanService
@inject AlertService AlertService
<div class="card">
<div class="card-header">
<span class="card-title">
<TL>Reinstall</TL>
<TL>Actions</TL>
</span>
</div>
<div class="card-footer">
<WButton Text="@(SmartTranslateService.Translate("Reinstall"))"
WorkingText="@(SmartTranslateService.Translate("Reinstalling"))"
CssClasses="btn-warning"
OnClick="Reinstall">
WorkingText="@(SmartTranslateService.Translate("Reinstalling"))" CssClasses="btn-warning"
OnClick="Reinstall">
</WButton>
<WButton Text="@(SmartTranslateService.Translate("Scan for malware"))"
WorkingText="@(SmartTranslateService.Translate("Scanning"))" CssClasses="btn-primary ms-3"
OnClick="Scan">
</WButton>
</div>
</div>
@ -28,4 +34,14 @@
{
await ServerService.Reinstall(Server!);
}
private async Task Scan()
{
var result = await MalwareScanService.Perform(Server);
if (result == null)
await AlertService.Success(SmartTranslateService.Translate("No malware found on this server"));
else
await AlertService.Warning(result.Title, result.Description);
}
}