Skip to content

Commit

Permalink
Web GUI / Pool stat mgmt: 'Remove pool stat data' removed ALL stats
Browse files Browse the repository at this point in the history
  • Loading branch information
UselessGuru committed May 14, 2021
1 parent d5b9c88 commit bace040
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
27 changes: 26 additions & 1 deletion Includes/API.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Function Start-APIServer {
}
}

$APIVersion = "0.3.9.1"
$APIVersion = "0.3.9.2"

If ($Config.APILogFile) { "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss"): API ($APIVersion) started." | Out-File $Config.APILogFile -Encoding UTF8 -Force }

Expand Down Expand Up @@ -371,6 +371,31 @@ Function Start-APIServer {
Break
}
"/functions/stat/remove" {
If ($Parameters.Pools) {
$Pools = Compare-Object -PassThru -IncludeEqual -ExcludeDifferent @($Variables.Pools | Select-Object) @(($Parameters.Pools | ConvertFrom-Json -ErrorAction SilentlyContinue) | Select-Object) -Property Name, Algorithm
$Pools | Sort-Object Name | ForEach-Object {
If ($_.Name -like "*Coins") {
$StatName = "$($_.Name)_$($_.Algorithm)-$($_.Currency)"
}
Else {
$StatName = "$($_.Name)_$($_.Algorithm)"
}
$Data += "`n$($StatName)"
Remove-Stat -Name "$($StatName)_Profit"
$_.Reason = [String[]]@()
$_.Price = $_.Price_Bias = $_.StablePrice = $_.MarginOfError = $_.EstimateFactor = [Double]::Nan
}
If ($Pools.Count -gt 0) {
$Message = "Pool data reset for $($Pools.Count) $(If ($Pools.Count -eq 1) { "pool" } Else { "pools" })."
Write-Message -Level Verbose "Web GUI: $Message" -Console
$Data += "`n`n$Message"
}
Else {
$Data = "`nNo matching stats found."
}
$Data = "<pre>$Data</pre>"
Break
}
If ($Parameters.Miners -and $Parameters.Type -eq "HashRate") {
$Miners = Compare-Object -PassThru -IncludeEqual -ExcludeDifferent @($Variables.Miners | Select-Object) @(($Parameters.Miners | ConvertFrom-Json -ErrorAction SilentlyContinue) | Select-Object) -Property Name, Algorithm
$Miners | Sort-Object Name, Algorithm | ForEach-Object {
Expand Down
2 changes: 1 addition & 1 deletion Web/APIdocs.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<html>

<body>
<h1>NemosMiner API (version 0.3.9.1)</h1>
<h1>NemosMiner API (version 0.3.9.2)</h1>

API data is available at http://localhost:[API port]/&lt;resource&gt.
(The default API port is 3999)
Expand Down

0 comments on commit bace040

Please sign in to comment.