mirror of
https://github.com/zeropingheroes/lancache-autofill
synced 2025-02-16 13:48:27 +00:00
Abort if a Steam password prompt is detected #26
This commit is contained in:
parent
c30cffdc79
commit
7b4e67dc3a
1 changed files with 41 additions and 12 deletions
|
@ -66,9 +66,16 @@ class StartDownloading extends Command
|
||||||
->run();
|
->run();
|
||||||
|
|
||||||
// Show SteamCMD output line by line
|
// Show SteamCMD output line by line
|
||||||
$steamCmd->run(function ($type, $buffer) {
|
$steamCmd->run(
|
||||||
$this->line(str_replace(["\r", "\n"], '', $buffer));
|
function ($type, $buffer) use (&$account) {
|
||||||
});
|
$this->line(str_replace(["\r", "\n"], '', $buffer));
|
||||||
|
|
||||||
|
if (str_contains(strtolower($buffer), 'password:')) {
|
||||||
|
$this->displayAccountNotAuthorisedError($account);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (!$steamCmd->isSuccessful()) {
|
if (!$steamCmd->isSuccessful()) {
|
||||||
throw new ProcessFailedException($steamCmd);
|
throw new ProcessFailedException($steamCmd);
|
||||||
|
@ -194,20 +201,42 @@ class StartDownloading extends Command
|
||||||
->run();
|
->run();
|
||||||
|
|
||||||
// Show SteamCMD output line by line
|
// Show SteamCMD output line by line
|
||||||
$steamCmd->run(function ($type, $buffer) {
|
$steamCmd->run(
|
||||||
$this->line(str_replace(["\r", "\n"], '', $buffer));
|
function ($type, $buffer) use (&$account) {
|
||||||
});
|
$this->line(str_replace(["\r", "\n"], '', $buffer));
|
||||||
|
|
||||||
|
// Abort if prompted for a password
|
||||||
|
if (str_contains(strtolower($buffer), 'password:')) {
|
||||||
|
$this->displayAccountNotAuthorisedError($account);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (!$steamCmd->isSuccessful()) {
|
if (!$steamCmd->isSuccessful()) {
|
||||||
$this->error('Steam account ' . $account . ' is not authorised');
|
$this->displayAccountNotAuthorisedError($account);
|
||||||
$this->comment('');
|
|
||||||
$this->comment('Please re-run:');
|
|
||||||
$this->comment(' ./lancache-autofill steam:authorise-account ' . $account . '"');
|
|
||||||
$this->info('');
|
|
||||||
|
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
$this->info('Steam account ' . $account . ' is authorised and will be used to download apps');
|
$this->info('Steam account ' . $account . ' is authorised and will be used to download apps');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display account not authorised error message
|
||||||
|
*
|
||||||
|
* @param string $account
|
||||||
|
*/
|
||||||
|
private function displayAccountNotAuthorisedError(string $account)
|
||||||
|
{
|
||||||
|
|
||||||
|
$steamUserdataDirectory = pathinfo(getenv('STEAMCMD_PATH'))['dirname'] . '/userdata';
|
||||||
|
|
||||||
|
$this->error('Steam account ' . $account . ' is not authorised');
|
||||||
|
$this->comment('');
|
||||||
|
$this->comment('Please re-run:');
|
||||||
|
$this->comment(' ./lancache-autofill steam:authorise-account ' . $account);
|
||||||
|
$this->comment('');
|
||||||
|
$this->comment('If this error persists, empty the ' . $steamUserdataDirectory . ' directory');
|
||||||
|
$this->info('');
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue