Compare commits
5 Commits
cd3491c5a8
...
update-chr
Author | SHA1 | Date | |
---|---|---|---|
5a30cdeae5 | |||
db9d65f445 | |||
a1219b92ce | |||
ce13d1b0dd | |||
a80a32eee8 |
5
.gitignore
vendored
5
.gitignore
vendored
@ -21,6 +21,11 @@ yarn-error.log
|
||||
/.nova
|
||||
/.vscode
|
||||
/.zed
|
||||
|
||||
# Python projet
|
||||
venv
|
||||
__pycache__
|
||||
|
||||
# Browser
|
||||
app/Browser/console
|
||||
app/Browser/screenshots
|
||||
|
@ -40,7 +40,7 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
|
||||
$this->jobRun->save();
|
||||
|
||||
$browser->visit('https://hellcase.com');
|
||||
$browser->waitForText("Store", 30, true);
|
||||
$browser->waitForText("CASES", 30, true);
|
||||
$this->removePopups($browser);
|
||||
sleep(5);
|
||||
$this->signin($browser);
|
||||
|
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();
|
||||
}
|
||||
}
|
||||
}
|
@ -75,6 +75,10 @@ return [
|
||||
|
||||
'links' => [
|
||||
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() {
|
||||
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);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Browser\Jobs\Hellcase\HellcaseJob;
|
||||
use App\Models\Job;
|
||||
use App\Jobs\PruneOldJobRuns;
|
||||
use App\Services\BrowserJobsInstances;
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
@ -13,6 +13,11 @@ Artisan::command('inspire', function () {
|
||||
// Telescope
|
||||
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
|
||||
Schedule::job(new HellcaseJob)->daily()->onOneServer()->withoutOverlapping()->name('hellcase')->description('Hellcase job');
|
||||
// Schedule::job(new HellcaseJob)->everyMinute()->onOneServer()->withoutOverlapping()->name('hellcase')->description('Hellcase job');
|
||||
|
5
todo.md
5
todo.md
@ -1,16 +1,17 @@
|
||||
|
||||
# TODO
|
||||
|
||||
- Fix hellcase, fermer lespopups à chaque nouvelle visite
|
||||
- Voir si le scheduler fonctionne au démmarage
|
||||
- Mettre un timeout pour pas overwhelm le pc au démmarage
|
||||
- Image pour le join de giveaway
|
||||
- → Notification
|
||||
- Ou ajouter des images base64 dans les jobRun
|
||||
- Risque de devenir volumineux
|
||||
- Sauf avec le jobqui enlève les vieilles jobRun
|
||||
- Sauf avec le job qui enlève les vieilles jobRun
|
||||
- Notification live websocket
|
||||
- Websocket installé
|
||||
- Serveur php plus propre (nginx, apache, n'importe)
|
||||
- Job qui supprime les vieilles JobRun
|
||||
- Epic games
|
||||
|
||||
## 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/
|
||||
|
||||
ENV TZ=Europe/Brussels
|
||||
|
Reference in New Issue
Block a user