Compare commits
13 Commits
basic-broa
...
17af60471b
Author | SHA1 | Date | |
---|---|---|---|
17af60471b | |||
0014045d52 | |||
fec63ff249 | |||
cdcdcd9e8b | |||
599ef77d64 | |||
edb07dd960 | |||
6a95653c52 | |||
025711e09d | |||
5a30cdeae5 | |||
db9d65f445 | |||
a1219b92ce | |||
ce13d1b0dd | |||
a80a32eee8 |
@@ -14,6 +14,7 @@ database/database.sqlite
|
|||||||
**/.dockerignore
|
**/.dockerignore
|
||||||
**/.env
|
**/.env
|
||||||
**/.git
|
**/.git
|
||||||
|
.gitea/
|
||||||
**/.gitignore
|
**/.gitignore
|
||||||
**/.project
|
**/.project
|
||||||
**/.settings
|
**/.settings
|
||||||
@@ -67,3 +68,5 @@ yarn-error.log
|
|||||||
app/Browser/console/**
|
app/Browser/console/**
|
||||||
app/Browser/screenshots/**
|
app/Browser/screenshots/**
|
||||||
app/Browser/source/**
|
app/Browser/source/**
|
||||||
|
|
||||||
|
undetectedChromedriver
|
||||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@@ -21,6 +21,11 @@ yarn-error.log
|
|||||||
/.nova
|
/.nova
|
||||||
/.vscode
|
/.vscode
|
||||||
/.zed
|
/.zed
|
||||||
|
|
||||||
|
# Python projet
|
||||||
|
venv
|
||||||
|
__pycache__
|
||||||
|
|
||||||
# Browser
|
# Browser
|
||||||
app/Browser/console
|
app/Browser/console
|
||||||
app/Browser/screenshots
|
app/Browser/screenshots
|
||||||
|
@@ -5,6 +5,8 @@ namespace App\Browser;
|
|||||||
use App\Models\Job;
|
use App\Models\Job;
|
||||||
use App\Models\JobArtifact;
|
use App\Models\JobArtifact;
|
||||||
use App\Models\JobRun;
|
use App\Models\JobRun;
|
||||||
|
use App\Notification\Notifications\JobErrorNotification;
|
||||||
|
use App\Notification\Providers\AllNotification;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Facebook\WebDriver\Chrome\ChromeOptions;
|
use Facebook\WebDriver\Chrome\ChromeOptions;
|
||||||
@@ -56,7 +58,8 @@ abstract class BrowserJob implements ShouldQueue
|
|||||||
// throw $e;
|
// throw $e;
|
||||||
}
|
}
|
||||||
catch (Throwable $e) {
|
catch (Throwable $e) {
|
||||||
$browser->screenshot("failure-{$this->jobId}");
|
$browser->screenshot(JobErrorScreenshot::getFileName($this->jobId));
|
||||||
|
AllNotification::send(new JobErrorNotification($this->jobId, $e->getMessage()));
|
||||||
dump($e);
|
dump($e);
|
||||||
throw $e;
|
throw $e;
|
||||||
} finally {
|
} finally {
|
||||||
|
27
app/Browser/JobDebugScreenshot.php
Normal file
27
app/Browser/JobDebugScreenshot.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Browser;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use function rtrim;
|
||||||
|
|
||||||
|
|
||||||
|
class JobDebugScreenshot {
|
||||||
|
public const IMG_FILE_NAME = "debug-";
|
||||||
|
|
||||||
|
public static function getFileName(int $jobId): string {
|
||||||
|
return static::IMG_FILE_NAME . $jobId . ".png";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getImgFileAbsolutePath(int $jobId): string {
|
||||||
|
return rtrim(Browser::$storeScreenshotsAt, '/') . "/" . static::getFileName($jobId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getImgFileProjectPath(int $jobId): string {
|
||||||
|
return app_path("Browser/screenshots/" . static::getFileName($jobId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getImgFileExternalPath(int $jobId): string {
|
||||||
|
return "screenshots/" . static::getFileName($jobId);
|
||||||
|
}
|
||||||
|
}
|
27
app/Browser/JobErrorScreenshot.php
Normal file
27
app/Browser/JobErrorScreenshot.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Browser;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use function rtrim;
|
||||||
|
|
||||||
|
|
||||||
|
class JobErrorScreenshot {
|
||||||
|
public const IMG_FILE_NAME = "failure-";
|
||||||
|
|
||||||
|
public static function getFileName(int $jobId): string {
|
||||||
|
return static::IMG_FILE_NAME . $jobId . ".png";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getImgFileAbsolutePath(int $jobId): string {
|
||||||
|
return rtrim(Browser::$storeScreenshotsAt, '/') . "/" . static::getFileName($jobId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getImgFileProjectPath(int $jobId): string {
|
||||||
|
return app_path("Browser/screenshots/" . static::getFileName($jobId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getImgFileExternalPath(int $jobId): string {
|
||||||
|
return "screenshots/" . static::getFileName($jobId);
|
||||||
|
}
|
||||||
|
}
|
@@ -4,6 +4,7 @@ namespace App\Browser\Jobs\Hellcase;
|
|||||||
|
|
||||||
use App\Browser\BrowserJob;
|
use App\Browser\BrowserJob;
|
||||||
use App\Browser\Components\Hellcase\MainNav;
|
use App\Browser\Components\Hellcase\MainNav;
|
||||||
|
use App\Browser\JobDebugScreenshot;
|
||||||
use App\Browser\Jobs\Hellcase\HellcaseLoginQrCode;
|
use App\Browser\Jobs\Hellcase\HellcaseLoginQrCode;
|
||||||
use App\Models\JobArtifact;
|
use App\Models\JobArtifact;
|
||||||
use App\Models\JobRun;
|
use App\Models\JobRun;
|
||||||
@@ -11,6 +12,8 @@ use App\Notification\NotificationBody\Hellcase\HellcaseNotificationDailyFreeBody
|
|||||||
use App\Notification\NotificationBody\Hellcase\HellcaseNotificationLoginBody;
|
use App\Notification\NotificationBody\Hellcase\HellcaseNotificationLoginBody;
|
||||||
use App\Notification\Notifications\Hellcase\HellcaseNotificationDailyFree;
|
use App\Notification\Notifications\Hellcase\HellcaseNotificationDailyFree;
|
||||||
use App\Notification\Notifications\Hellcase\HellcaseNotificationLogin;
|
use App\Notification\Notifications\Hellcase\HellcaseNotificationLogin;
|
||||||
|
use App\Notification\Notifications\JobDebugNotification;
|
||||||
|
use App\Notification\Notifications\JobErrorNotification;
|
||||||
use App\Notification\Providers\AllNotification;
|
use App\Notification\Providers\AllNotification;
|
||||||
use Facebook\WebDriver\WebDriverBy;
|
use Facebook\WebDriver\WebDriverBy;
|
||||||
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
|
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
|
||||||
@@ -40,7 +43,7 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
|
|||||||
$this->jobRun->save();
|
$this->jobRun->save();
|
||||||
|
|
||||||
$browser->visit('https://hellcase.com');
|
$browser->visit('https://hellcase.com');
|
||||||
$browser->waitForText("Store", 30, true);
|
$browser->waitForText("CASES", 30, true);
|
||||||
$this->removePopups($browser);
|
$this->removePopups($browser);
|
||||||
sleep(5);
|
sleep(5);
|
||||||
$this->signin($browser);
|
$this->signin($browser);
|
||||||
@@ -97,7 +100,14 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
|
|||||||
// QR CODE SCANNING
|
// QR CODE SCANNING
|
||||||
try {
|
try {
|
||||||
$browser->waitForTextIn("div", "Or sign in with QR", 30, true);
|
$browser->waitForTextIn("div", "Or sign in with QR", 30, true);
|
||||||
|
sleep(10);
|
||||||
|
try {
|
||||||
$qrCode = $browser->driver->findElement(WebDriverBy::xpath('//div[./*[contains(text(), "Or sign in with QR")]]'));
|
$qrCode = $browser->driver->findElement(WebDriverBy::xpath('//div[./*[contains(text(), "Or sign in with QR")]]'));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
// Wait to be redirected to the Steam login page, while waiting take a new screenshot every 30 seconds
|
// Wait to be redirected to the Steam login page, while waiting take a new screenshot every 30 seconds
|
||||||
$isBackOnHellcase = false;
|
$isBackOnHellcase = false;
|
||||||
@@ -122,9 +132,11 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
|
|||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// If the QR code is not found, we are not on the QR code page
|
// If the QR code is not found, we are not on the QR code page
|
||||||
|
Log::debug("Exception because qrcode not found : " . $e);
|
||||||
$isBackOnHellcase = true;
|
$isBackOnHellcase = true;
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
// If the QR code is not found, we are not on the QR code page
|
// If the QR code is not found, we are not on the QR code page
|
||||||
|
Log::debug("Exception because qrcode not found : " . $e);
|
||||||
$isBackOnHellcase = true;
|
$isBackOnHellcase = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,9 +208,12 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
|
|||||||
if ($availibleInButton->getAttribute("disabled") == "true") {
|
if ($availibleInButton->getAttribute("disabled") == "true") {
|
||||||
$hours = $availibleInButton->getText();
|
$hours = $availibleInButton->getText();
|
||||||
// If the text is like "in 26 sec." we need to put one minute
|
// If the text is like "in 26 sec." we need to put one minute
|
||||||
if (str_contains($hours, "sec")) {
|
if (str_contains(strtolower($hours), "seconds")) {
|
||||||
$this->reschedule(1);
|
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
|
||||||
return;
|
AllNotification::send(new JobDebugNotification($this->jobId, "I hate niggers"));
|
||||||
|
// $this->reschedule(1);
|
||||||
|
sleep(60);
|
||||||
|
return $this->getDailyFree($browser);
|
||||||
}
|
}
|
||||||
$hours = explode(" ", $hours);
|
$hours = explode(" ", $hours);
|
||||||
$minutes = $hours[4];
|
$minutes = $hours[4];
|
||||||
|
35
app/Jobs/PruneOldJobRuns.php
Normal file
35
app/Jobs/PruneOldJobRuns.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs;
|
||||||
|
|
||||||
|
use App\Models\Job;
|
||||||
|
use App\Models\JobRun;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Foundation\Queue\Queueable;
|
||||||
|
|
||||||
|
class PruneOldJobRuns implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new job instance.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the job.
|
||||||
|
*/
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
// For each job, keep only the last N runs
|
||||||
|
foreach (Job::all() as $job) {
|
||||||
|
$job->jobRuns()
|
||||||
|
->orderByDesc('id')
|
||||||
|
->skip(config('jobs.pruneOldJobRuns.max_runs_per_job'))
|
||||||
|
->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -4,6 +4,7 @@ namespace App\Notification;
|
|||||||
|
|
||||||
use App\Models\Job;
|
use App\Models\Job;
|
||||||
use App\Notification\Stringifiable\StringifiableSimpleText;
|
use App\Notification\Stringifiable\StringifiableSimpleText;
|
||||||
|
use function PHPUnit\Framework\isNull;
|
||||||
|
|
||||||
abstract class Notification {
|
abstract class Notification {
|
||||||
|
|
||||||
@@ -12,12 +13,18 @@ abstract class Notification {
|
|||||||
|
|
||||||
public bool $isError;
|
public bool $isError;
|
||||||
|
|
||||||
public function __construct(int $jobId, NotificationBody $body, bool $isError = false) {
|
public function __construct(int $jobId, NotificationBody $body = null, bool $isError = false) {
|
||||||
$this->job = Job::find($jobId);
|
$this->job = Job::find($jobId);
|
||||||
|
if ($body !== null) {
|
||||||
$this->body = $body;
|
$this->body = $body;
|
||||||
|
}
|
||||||
$this->isError = $isError;
|
$this->isError = $isError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setBody(NotificationBody $body) {
|
||||||
|
$this->body = $body;
|
||||||
|
}
|
||||||
|
|
||||||
public function getTitle(): Stringifiable {
|
public function getTitle(): Stringifiable {
|
||||||
return new StringifiableSimpleText($this->job->name);
|
return new StringifiableSimpleText($this->job->name);
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notification\NotificationBody;
|
||||||
|
|
||||||
|
use App\Models\Job;
|
||||||
|
use App\Notification\NotificationBody;
|
||||||
|
use App\Notification\Stringifiable;
|
||||||
|
|
||||||
|
class JobDebugNotificationBody extends NotificationBody {
|
||||||
|
|
||||||
|
private Job $job;
|
||||||
|
private string $body;
|
||||||
|
private ?string $error;
|
||||||
|
private bool $hasScreenshot;
|
||||||
|
|
||||||
|
public function __construct(Job $job, string $body, string $error = null, bool $hasScreenshot = false) {
|
||||||
|
$this->job = $job;
|
||||||
|
$this->body = $body;
|
||||||
|
$this->error = $error;
|
||||||
|
$this->hasScreenshot = $hasScreenshot;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function constructString(bool $inMarkdown = false) {
|
||||||
|
$mdBody = "";
|
||||||
|
if ($this->body !== null) {
|
||||||
|
$mdBody .= $this->body;
|
||||||
|
}
|
||||||
|
if ($this->error !== null) {
|
||||||
|
$errorWrapper = $inMarkdown ? "```" : "";
|
||||||
|
$mdBody .= " :\n" . $errorWrapper . $this->error . $errorWrapper;
|
||||||
|
}
|
||||||
|
if ($inMarkdown && $this->hasScreenshot) {
|
||||||
|
$mdBody .= "\nScreenshot : ";
|
||||||
|
}
|
||||||
|
return $mdBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function toMarkdownString(): string {
|
||||||
|
return $this->constructString(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function toString(): string {
|
||||||
|
return $this->constructString();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notification\NotificationBody;
|
||||||
|
|
||||||
|
use App\Models\Job;
|
||||||
|
use App\Notification\NotificationBody;
|
||||||
|
use App\Notification\Stringifiable;
|
||||||
|
|
||||||
|
class JobErrorNotificationBody extends NotificationBody {
|
||||||
|
|
||||||
|
private Job $job;
|
||||||
|
private string $error;
|
||||||
|
|
||||||
|
public function __construct(Job $job, $error) {
|
||||||
|
$this->job = $job;
|
||||||
|
$this->error = $error;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function toMarkdownString(): string {
|
||||||
|
return "Le job \"{$this->job->name}\" a échoué avec l'erreur :\n ```" . $this->error . "``` \nScreenshot : ";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function toString(): string {
|
||||||
|
return "Le job \"{$this->job->name}\" a échoué avec l'erreur :\n " . $this->error;
|
||||||
|
}
|
||||||
|
}
|
@@ -3,12 +3,9 @@
|
|||||||
namespace App\Notification\Notifications\Hellcase;
|
namespace App\Notification\Notifications\Hellcase;
|
||||||
|
|
||||||
use App\Browser\Jobs\Hellcase\HellcaseDailyFreeScreenshot;
|
use App\Browser\Jobs\Hellcase\HellcaseDailyFreeScreenshot;
|
||||||
use App\Browser\Jobs\Hellcase\HellcaseLoginQrCode;
|
|
||||||
use App\Notification\Notification;
|
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) {
|
public function __construct(int $jobId, \App\Notification\NotificationBody $body) {
|
||||||
parent::__construct($jobId, $body);
|
parent::__construct($jobId, $body);
|
||||||
|
44
app/Notification/Notifications/JobDebugNotification.php
Normal file
44
app/Notification/Notifications/JobDebugNotification.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notification\Notifications;
|
||||||
|
|
||||||
|
use App\Browser\JobDebugScreenshot;
|
||||||
|
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 = "", 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, $body, $error, $this->screenShotProjectPath != null));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle(): Stringifiable {
|
||||||
|
return new StringifiableSimpleText($this->title ?? "DEBUG Job {$this->job->name}");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getImageProjectPath(): string|null {
|
||||||
|
return $this->screenShotProjectPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getLinkURL(): string|null {
|
||||||
|
return route('jobs.show', ['job' => $this->job->id]);
|
||||||
|
}
|
||||||
|
}
|
37
app/Notification/Notifications/JobErrorNotification.php
Normal file
37
app/Notification/Notifications/JobErrorNotification.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notification\Notifications;
|
||||||
|
|
||||||
|
use App\Browser\JobErrorScreenshot;
|
||||||
|
use App\Models\Job;
|
||||||
|
use App\Notification\Notification;
|
||||||
|
use App\Notification\NotificationBody\JobErrorNotificationBody;
|
||||||
|
use App\Notification\Stringifiable;
|
||||||
|
use App\Notification\Stringifiable\StringifiableSimpleText;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class JobErrorNotification extends Notification {
|
||||||
|
|
||||||
|
public function __construct(int $jobId, string $error) {
|
||||||
|
parent::__construct($jobId, isError:true);
|
||||||
|
$this->setBody(new JobErrorNotificationBody($this->job, $error));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle(): Stringifiable {
|
||||||
|
return new StringifiableSimpleText("Le job {$this->job->name} a échoué");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getImageProjectPath(): string|null {
|
||||||
|
return JobErrorScreenshot::getImgFileProjectPath($this->job->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getLinkURL(): string|null {
|
||||||
|
return route('jobs.show', ['job' => $this->job->id]);
|
||||||
|
}
|
||||||
|
}
|
@@ -3,9 +3,6 @@
|
|||||||
namespace App\Notification\Providers;
|
namespace App\Notification\Providers;
|
||||||
|
|
||||||
use App\Notification\NotificationProvider;
|
use App\Notification\NotificationProvider;
|
||||||
use App\Notification\INotificationProvider;
|
|
||||||
use App\Models\JobInfo;
|
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
|
|
||||||
class AllNotification extends NotificationProvider {
|
class AllNotification extends NotificationProvider {
|
||||||
private const NOTIFICATIONS_PROVIDERS = [
|
private const NOTIFICATIONS_PROVIDERS = [
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Notification\Providers;
|
namespace App\Notification\Providers;
|
||||||
|
|
||||||
use App\Notification\NotificationProvider;
|
use App\Notification\NotificationProvider;
|
||||||
use App\Notification\INotificationProvider;
|
|
||||||
use App\Models\JobInfo;
|
use App\Models\JobInfo;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
"erusev/parsedown": "^1.7",
|
"erusev/parsedown": "^1.7",
|
||||||
"inertiajs/inertia-laravel": "^2.0",
|
"inertiajs/inertia-laravel": "^2.0",
|
||||||
"laravel/dusk": "^8.2",
|
"laravel/dusk": "^8.2",
|
||||||
"laravel/framework": "^11.31",
|
"laravel/framework": "^12.0",
|
||||||
"laravel/reverb": "^1.0",
|
"laravel/reverb": "^1.0",
|
||||||
"laravel/sanctum": "^4.0",
|
"laravel/sanctum": "^4.0",
|
||||||
"laravel/telescope": "^5.5",
|
"laravel/telescope": "^5.5",
|
||||||
|
@@ -75,6 +75,10 @@ return [
|
|||||||
|
|
||||||
'links' => [
|
'links' => [
|
||||||
public_path('storage') => storage_path('app/public'),
|
public_path('storage') => storage_path('app/public'),
|
||||||
|
public_path('console') => base_path('app/Browser/console'),
|
||||||
|
public_path('downloads') => base_path('app/Browser/downloads'),
|
||||||
|
public_path('screenshots') => base_path('app/Browser/screenshots'),
|
||||||
|
public_path('source') => base_path('app/Browser/source'),
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
20
config/jobs.php
Normal file
20
config/jobs.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Laravel\Telescope\Http\Middleware\Authorize;
|
||||||
|
use Laravel\Telescope\Watchers;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove old job runs from the database.
|
||||||
|
*/
|
||||||
|
'pruneOldJobRuns' => [
|
||||||
|
'enabled' => true,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How many job runs a job can keep before we start pruning old ones.
|
||||||
|
*/
|
||||||
|
'max_runs_per_job' => 50,
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
1
public/console
Symbolic link
1
public/console
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/home/ninluc/Documents/codage/DatBrowser/app/Browser/console
|
1
public/downloads
Symbolic link
1
public/downloads
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/home/ninluc/Documents/codage/DatBrowser/app/Browser/downloads
|
1
public/screenshots
Symbolic link
1
public/screenshots
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/home/ninluc/Documents/codage/DatBrowser/app/Browser/screenshots
|
1
public/source
Symbolic link
1
public/source
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/home/ninluc/Documents/codage/DatBrowser/app/Browser/source
|
@@ -11,7 +11,7 @@ const jobs = ref<Job[]>([]);
|
|||||||
|
|
||||||
async function fetchJobs() {
|
async function fetchJobs() {
|
||||||
let jobsRaw = await httpApi<Job[]>("/jobs");
|
let jobsRaw = await httpApi<Job[]>("/jobs");
|
||||||
jobs.value = jobsRaw.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
|
jobs.value = jobsRaw.sort((a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(fetchJobs);
|
onMounted(fetchJobs);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Browser\Jobs\Hellcase\HellcaseJob;
|
use App\Browser\Jobs\Hellcase\HellcaseJob;
|
||||||
use App\Models\Job;
|
use App\Jobs\PruneOldJobRuns;
|
||||||
use App\Services\BrowserJobsInstances;
|
use App\Services\BrowserJobsInstances;
|
||||||
use Illuminate\Foundation\Inspiring;
|
use Illuminate\Foundation\Inspiring;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
@@ -13,6 +13,11 @@ Artisan::command('inspire', function () {
|
|||||||
// Telescope
|
// Telescope
|
||||||
Schedule::command('telescope:prune')->monthly();
|
Schedule::command('telescope:prune')->monthly();
|
||||||
|
|
||||||
|
// Prune old job runs
|
||||||
|
Schedule::job(new PruneOldJobRuns)->monthly()->onOneServer()->withoutOverlapping()->name('prune-old-job-runs')->description('Prune old job runs')->skip(function () {
|
||||||
|
return !config('jobs.pruneOldJobRuns.enabled');
|
||||||
|
});
|
||||||
|
|
||||||
// Jobs
|
// Jobs
|
||||||
Schedule::job(new HellcaseJob)->daily()->onOneServer()->withoutOverlapping()->name('hellcase')->description('Hellcase job');
|
Schedule::job(new HellcaseJob)->daily()->onOneServer()->withoutOverlapping()->name('hellcase')->description('Hellcase job');
|
||||||
// Schedule::job(new HellcaseJob)->everyMinute()->onOneServer()->withoutOverlapping()->name('hellcase')->description('Hellcase job');
|
// Schedule::job(new HellcaseJob)->everyMinute()->onOneServer()->withoutOverlapping()->name('hellcase')->description('Hellcase job');
|
||||||
|
3
todo.md
3
todo.md
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
- Fix hellcase, fermer lespopups à chaque nouvelle visite
|
||||||
- Voir si le scheduler fonctionne au démmarage
|
- Voir si le scheduler fonctionne au démmarage
|
||||||
- Mettre un timeout pour pas overwhelm le pc au démmarage
|
- Mettre un timeout pour pas overwhelm le pc au démmarage
|
||||||
- Image pour le join de giveaway
|
- Image pour le join de giveaway
|
||||||
@@ -9,8 +10,8 @@
|
|||||||
- Risque de devenir volumineux
|
- Risque de devenir volumineux
|
||||||
- Sauf avec le job qui enlève les vieilles jobRun
|
- Sauf avec le job qui enlève les vieilles jobRun
|
||||||
- Notification live websocket
|
- Notification live websocket
|
||||||
|
- Websocket installé
|
||||||
- Serveur php plus propre (nginx, apache, n'importe)
|
- Serveur php plus propre (nginx, apache, n'importe)
|
||||||
- Job qui supprime les vieilles JobRun
|
|
||||||
- Epic games
|
- Epic games
|
||||||
|
|
||||||
## Pour deploy Lama
|
## Pour deploy Lama
|
||||||
|
BIN
undetectedChromedriver/chromedriver
Executable file
BIN
undetectedChromedriver/chromedriver
Executable file
Binary file not shown.
@@ -1 +1,20 @@
|
|||||||
sudo docker run --rm -it -p 3389:3389 -v ./undetectedChromedriver:/root/.local/share/undetected_chromedriver/ ultrafunk/undetected-chromedriver:latest
|
#!/bin/bash
|
||||||
|
|
||||||
|
# From undetected chromedriver docker
|
||||||
|
#sudo docker run --rm -it -p 3389:3389 -v ./undetectedChromedriver:/root/.local/share/undetected_chromedriver/ ultrafunk/undetected-chromedriver:latest
|
||||||
|
|
||||||
|
# With undetected chromedriver patcher
|
||||||
|
# Run the selenium/standalone-chrome:latest with a specific container name in the background
|
||||||
|
sudo docker run -d --name standalone-chrome selenium/standalone-chrome:latest
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
# Copy the chromedriver binary from the container to the host
|
||||||
|
sudo docker cp -L standalone-chrome:/bin/chromedriver ./chromedriver
|
||||||
|
# Stop the container
|
||||||
|
sudo docker stop standalone-chrome
|
||||||
|
|
||||||
|
sudo chmod 777 ./chromedriver
|
||||||
|
|
||||||
|
# Patch the chromedriver binary
|
||||||
|
python3 ./patchChromedriver.py
|
||||||
|
8
undetectedChromedriver/patchChromedriver.py
Normal file
8
undetectedChromedriver/patchChromedriver.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/python3
|
||||||
|
|
||||||
|
import undetected_chromedriver as uc
|
||||||
|
|
||||||
|
options = uc.ChromeOptions()
|
||||||
|
# Chromedriver is in current directory
|
||||||
|
driver = uc.Chrome(options = options, browser_executable_path="/usr/bin/google-chrome", driver_executable_path="/home/ninluc/Documents/codage/DatBrowser/undetectedChromedriver/chromedriver")
|
||||||
|
driver.get('https://nowsecure.nl')
|
@@ -1,6 +1,7 @@
|
|||||||
FROM selenium/standalone-chrome:108.0 AS final
|
# FROM selenium/standalone-chrome:108.0 AS final
|
||||||
|
FROM selenium/standalone-chrome:latest AS final
|
||||||
|
|
||||||
COPY undetectedChromedriver/chromedriver-linux /bin/chromedriver
|
COPY undetectedChromedriver/chromedriver /bin/chromedriver
|
||||||
RUN mkdir -p /home/seluser/profile/
|
RUN mkdir -p /home/seluser/profile/
|
||||||
|
|
||||||
ENV TZ=Europe/Brussels
|
ENV TZ=Europe/Brussels
|
||||||
|
Reference in New Issue
Block a user