Compare commits
2 Commits
fec63ff249
...
17af60471b
Author | SHA1 | Date | |
---|---|---|---|
17af60471b | |||
0014045d52 |
@ -104,7 +104,7 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
|
||||
try {
|
||||
$qrCode = $browser->driver->findElement(WebDriverBy::xpath('//div[./*[contains(text(), "Or sign in with QR")]]'));
|
||||
} catch (\Exception $e) {
|
||||
$browser->takeScreenshot(JobDebugScreenshot::getFileName($this->jobId));
|
||||
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
|
||||
AllNotification::send(new JobDebugNotification($this->jobId, "Le QR code de la page de connexion de Steam n'a pas été trouvé"));
|
||||
throw $e;
|
||||
}
|
||||
@ -208,8 +208,8 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
|
||||
if ($availibleInButton->getAttribute("disabled") == "true") {
|
||||
$hours = $availibleInButton->getText();
|
||||
// If the text is like "in 26 sec." we need to put one minute
|
||||
if (!str_contains($hours, "hr")) {
|
||||
$browser->takeScreenshot(JobDebugScreenshot::getFileName($this->jobId));
|
||||
if (str_contains(strtolower($hours), "seconds")) {
|
||||
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
|
||||
AllNotification::send(new JobDebugNotification($this->jobId, "I hate niggers"));
|
||||
// $this->reschedule(1);
|
||||
sleep(60);
|
||||
|
@ -15,7 +15,7 @@ abstract class Notification {
|
||||
|
||||
public function __construct(int $jobId, NotificationBody $body = null, bool $isError = false) {
|
||||
$this->job = Job::find($jobId);
|
||||
if (!isNull($body)) {
|
||||
if ($body !== null) {
|
||||
$this->body = $body;
|
||||
}
|
||||
$this->isError = $isError;
|
||||
|
@ -9,14 +9,12 @@ use App\Notification\Stringifiable;
|
||||
class JobDebugNotificationBody extends NotificationBody {
|
||||
|
||||
private Job $job;
|
||||
private string $title;
|
||||
private string $body;
|
||||
private string $error;
|
||||
private ?string $error;
|
||||
private bool $hasScreenshot;
|
||||
|
||||
public function __construct(Job $job, string $title, string $body, string $error, bool $hasScreenshot = false) {
|
||||
public function __construct(Job $job, string $body, string $error = null, bool $hasScreenshot = false) {
|
||||
$this->job = $job;
|
||||
$this->title = $title;
|
||||
$this->body = $body;
|
||||
$this->error = $error;
|
||||
$this->hasScreenshot = $hasScreenshot;
|
||||
|
@ -3,12 +3,9 @@
|
||||
namespace App\Notification\Notifications\Hellcase;
|
||||
|
||||
use App\Browser\Jobs\Hellcase\HellcaseDailyFreeScreenshot;
|
||||
use App\Browser\Jobs\Hellcase\HellcaseLoginQrCode;
|
||||
use App\Notification\Notification;
|
||||
use App\Notification\Notifications\NotificationLogin;
|
||||
use Laravel\Dusk\Browser;
|
||||
|
||||
class HellcaseNotificationDailyFree extends NotificationLogin {
|
||||
class HellcaseNotificationDailyFree extends Notification {
|
||||
|
||||
public function __construct(int $jobId, \App\Notification\NotificationBody $body) {
|
||||
parent::__construct($jobId, $body);
|
||||
|
@ -7,17 +7,21 @@ use App\Notification\Notification;
|
||||
use App\Notification\NotificationBody\JobDebugNotificationBody;
|
||||
use App\Notification\Stringifiable;
|
||||
use App\Notification\Stringifiable\StringifiableSimpleText;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class JobDebugNotification extends Notification {
|
||||
|
||||
private string|null $title;
|
||||
private string|null $screenShotProjectPath;
|
||||
|
||||
public function __construct(int $jobId, string $body, string $title = null, string $error = null, string $screenshotProjectPath = JobDebugScreenshot::getImgFileProjectPath($jobId), bool $isError = false) {
|
||||
public function __construct(int $jobId, string $body, string $title = null, string $error = null, ?string $screenshotProjectPath = "", bool $isError = false) {
|
||||
parent::__construct($jobId, isError:$isError);
|
||||
$this->title = $title;
|
||||
if ($screenshotProjectPath === "") {
|
||||
$screenshotProjectPath = JobDebugScreenshot::getImgFileProjectPath($jobId);
|
||||
}
|
||||
$this->screenShotProjectPath = $screenshotProjectPath;
|
||||
$this->setBody(new JobDebugNotificationBody($this->job, $this->title, $body, $error, $this->screenShotProjectPath != null));
|
||||
$this->setBody(new JobDebugNotificationBody($this->job, $body, $error, $this->screenShotProjectPath != null));
|
||||
}
|
||||
|
||||
public function getTitle(): Stringifiable {
|
||||
|
Reference in New Issue
Block a user