Skip to content

Commit

Permalink
more strong check
Browse files Browse the repository at this point in the history
  • Loading branch information
Quake4 committed Jun 21, 2018
1 parent 674c261 commit a06ee02
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Code/Config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Config : BaseConfig {
static [int] $Processors = 0
static [int] $Cores = 0
static [int] $Threads = 0
static [string] $Version = "v2.38"
static [string] $Version = "v2.39"
static [string] $BinLocation = "Bin"
static [string] $MinersLocation = "Miners"
static [string] $PoolsLocation = "Pools"
Expand All @@ -67,6 +67,7 @@ class Config : BaseConfig {
static [decimal] $MaxTrustGrow = 1.5
static [int] $SmallTimeout = 100
static [int] $ApiPort = 5555
static [string] $Placeholder = "%%"
static [string] $WorkerNamePlaceholder = "%%WorkerName%%"
static [string] $WalletPlaceholder = "%%Wallet.{0}%%"
static [string] $LoginPlaceholder = "%%Login%%"
Expand Down
12 changes: 7 additions & 5 deletions Code/Get-PoolInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ function Get-PoolInfo([Parameter(Mandatory)][string] $folder) {
}

$global:API.Pools = $pools
$wallets = $Config.Wallet | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name | ForEach-Object {
[Config]::WalletPlaceholder -f "$_"
}
$wallets = $Config.Wallet | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name
$pools.Values | ForEach-Object {
$userpass = "$($_.User)$($_.Password)"
if ((![string]::IsNullOrWhiteSpace($Config.Login) -and $userpass.Contains([Config]::LoginPlaceholder)) -or
($wallets -and $wallets.Where({ $userpass.Contains($_) }, 'First').Count -gt 0)) {
$userpass = $userpass.Replace([Config]::WorkerNamePlaceholder, [string]::Empty)
if (![string]::IsNullOrEmpty($Config.Login)) {
$userpass = $userpass.Replace([Config]::LoginPlaceholder + ".", [string]::Empty + ".")
}
$wallets | ForEach-Object { $userpass = $userpass.Replace((([Config]::WalletPlaceholder -f "$_")), [string]::Empty) }
if (!$userpass.Contains([Config]::Placeholder)) {
$_
}
}
Expand Down

0 comments on commit a06ee02

Please sign in to comment.