Skip to content

Commit

Permalink
Hardware
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPlusGH committed Jun 27, 2020
1 parent 8c02ee3 commit 032f713
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Includes/Server.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,44 @@ Function Start-Server {
$StatusCode = [System.Net.HttpStatusCode]::OK
Break
}
"/Hardware" {
$Title = "$($Config.WorkerName) - Hardware"
$ContentType = $MIMETypes[".html"]

$Content = $Header
If (Test-Path ".\Utils\OpenHardwareMonitorLib.dll"){
$Path = (Resolve-Path ".\utils\").path
Unblock-File -Path "$Path/OpenHardwareMonitorLib.dll"
$HardwareDLL = [System.IO.File]::ReadAllBytes("$($Path)/OpenHardwareMonitorLib.dll")
[System.Reflection.Assembly]::Load($HardwareDLL) | Out-Null
$Hardware = New-Object OpenHardwareMonitor.Hardware.Computer
$Hardware.CPUEnabled = $true
$Hardware.MainboardEnabled = $true
$Hardware.GPUEnabled = $true
$Hardware.Open()
}

$Content += "<hr>"

ForEach ($Device in ($Hardware.Hardware | ? {$_.HardwareType -like "gpu*" -or $_.HardwareType -eq "cpu"})) {
$Content +=
@"
<hr>
<div id="$($Device.Identifier)"></div>
<SectionTitle>
<span class="left">$($Device.Identifier) - $($Device.Name)</span><br>
</SectionTitle>
<br>
"@

$Content += $Device.Sensors | select SensorType,Name,Value | ConvertTo-Html -CssUri "./Includes/Web.css" -Title $Title
}

$Content += $Footer

$StatusCode = [System.Net.HttpStatusCode]::OK
Break
}
"/Cmd-CleanIconCache" {
$ContentType = "text/html"
$Variables.CoinIcons = @()
Expand Down
Binary file added Utils/OpenHardwareMonitorLib.dll
Binary file not shown.

0 comments on commit 032f713

Please sign in to comment.