Compare commits
17 Commits
ea22c19d2b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d20702f248 | |||
| 5b5f35e9ce | |||
| fb2a346804 | |||
| 2611701d53 | |||
| c61750285a | |||
| 12280c6d54 | |||
| 6853fbef46 | |||
| 29077ed6d6 | |||
| a162bb2c1f | |||
| 7d26440d0c | |||
| 45a40ae999 | |||
| 266d444922 | |||
| 24360d86b3 | |||
| 5ce8fbd444 | |||
| 82460aa727 | |||
| 4422e7564b | |||
| bcef42b58e |
@@ -1,12 +1,34 @@
|
|||||||
name: Push image to registry
|
name: Test, build and push image to registry
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
phpunit-tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
RUNNER_TOOL_CACHE: /toolcache
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '8.3.0'
|
||||||
|
- name: Cache Composer
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.composer/cache
|
||||||
|
key: composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
composer-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction
|
||||||
|
- name: Run PHPUnit tests
|
||||||
|
run: vendor/bin/phpunit --configuration phpunit.xml
|
||||||
build-image:
|
build-image:
|
||||||
|
needs: phpunit-tests
|
||||||
|
if: success() && github.ref == 'refs/heads/main'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
@@ -17,6 +39,13 @@ jobs:
|
|||||||
registry: git.matthiasg.dev
|
registry: git.matthiasg.dev
|
||||||
username: ninluc
|
username: ninluc
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
- name: Cache Docker layers (registry-backed)
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: buildx-cache-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
buildx-cache-
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
run: |
|
run: |
|
||||||
docker build -t git.matthiasg.dev/ninluc/datbrowser:latest .
|
docker build -t git.matthiasg.dev/ninluc/datbrowser:latest .
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Browser\Jobs\EldoradoRobuxPriceSentry;
|
namespace App\Browser\Jobs\EldoradoRobuxPriceSentry;
|
||||||
|
|
||||||
use App\Browser\Jobs\HellcaseBattles\EldoradoRobuxPriceNotificationBody;
|
|
||||||
use App\Models\Job;
|
use App\Models\Job;
|
||||||
use App\Notification\Notification;
|
use App\Notification\Notification;
|
||||||
use App\Notification\Stringifiable;
|
use App\Notification\Stringifiable;
|
||||||
@@ -18,7 +17,7 @@ class EldoradoRobuxPriceNotification extends Notification {
|
|||||||
parent::__construct($jobId);
|
parent::__construct($jobId);
|
||||||
|
|
||||||
$this->price = $price;
|
$this->price = $price;
|
||||||
$this->threshold = Job::find($jobId)->jobInfosTable()->get('eldorado_robux_price_threshold');
|
$this->threshold = floatval(Job::find($jobId)->jobInfosTable()->get('eldorado_robux_price_threshold'));
|
||||||
$this->link = $link;
|
$this->link = $link;
|
||||||
|
|
||||||
$this->setBody($this->generateBody());
|
$this->setBody($this->generateBody());
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Browser\Jobs\HellcaseBattles;
|
namespace App\Browser\Jobs\EldoradoRobuxPriceSentry;
|
||||||
|
|
||||||
use App\Notification\NotificationBody;
|
use App\Notification\NotificationBody;
|
||||||
|
|
||||||
|
|||||||
@@ -93,12 +93,11 @@ class EldoradoRobuxPriceSentryJob extends BrowserJob implements ShouldBeUniqueUn
|
|||||||
{
|
{
|
||||||
$lowestPriceElement = $browser->driver->findElement(WebDriverBy::xpath('(//eld-offer-price)[2]/strong'));
|
$lowestPriceElement = $browser->driver->findElement(WebDriverBy::xpath('(//eld-offer-price)[2]/strong'));
|
||||||
$lowestPriceText = $lowestPriceElement->getText(); // Ex: " 0,00478 € "
|
$lowestPriceText = $lowestPriceElement->getText(); // Ex: " 0,00478 € "
|
||||||
$lowestPrice = (float)str_replace(["€", ","], ["", "."], trim($lowestPriceText));
|
$lowestPrice = $this->textToFloat($lowestPriceText);
|
||||||
$lowestPrice = $lowestPrice / 1000; // Price per Robux
|
//$lowestPrice = $lowestPrice / 1000; // Price per Robux
|
||||||
// TODO : Look at the entire text to try to understand if it is per 1k or per single Robux
|
// TODO : Look at the entire text to try to understand if it is per 1k or per single Robux
|
||||||
|
|
||||||
$threshold = floatval(str_replace(",", ".", $this->jobInfos->get("eldorado_robux_price_threshold")));
|
$threshold = $this->textToFloat($this->jobInfos->get("eldorado_robux_price_threshold"));
|
||||||
dump($threshold);
|
|
||||||
|
|
||||||
Log::info("EldoradoRobuxPriceSentryJob: lowest price = $lowestPrice €, threshold = $threshold €");
|
Log::info("EldoradoRobuxPriceSentryJob: lowest price = $lowestPrice €, threshold = $threshold €");
|
||||||
$this->jobRun->addArtifact(new JobArtifact([
|
$this->jobRun->addArtifact(new JobArtifact([
|
||||||
@@ -131,4 +130,9 @@ class EldoradoRobuxPriceSentryJob extends BrowserJob implements ShouldBeUniqueUn
|
|||||||
Log::info("EldoradoRobuxPriceSentryJob: no alert sent");
|
Log::info("EldoradoRobuxPriceSentryJob: no alert sent");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function textToFloat(string $text): float
|
||||||
|
{
|
||||||
|
return floatval(str_replace(["€", ","], ["", "."], trim($text)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
|
|||||||
|
|
||||||
// JobRun
|
// JobRun
|
||||||
// Get the elements text containing class starting with giveaway-entity-prize__
|
// Get the elements text containing class starting with giveaway-entity-prize__
|
||||||
$prizeElement = $browser->driver->findElements(WebDriverBy::xpath('//div[starts-with(@class, "giveaway-entity-prize__")]'));
|
$prizeElement = $browser->driver->findElements(WebDriverBy::xpath('//div[starts-with(@class, "_giveaway_")]//div[contains(@class, "_main_dv7x6_48")]'));
|
||||||
// Join their text
|
// Join their text
|
||||||
$prize = "";
|
$prize = "";
|
||||||
foreach ($prizeElement as $element) {
|
foreach ($prizeElement as $element) {
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ abstract class InstagramAbstractJob extends BrowserJob implements ShouldBeUnique
|
|||||||
$popupsTypes = [
|
$popupsTypes = [
|
||||||
['//button[contains(text(), "Allow all cookies")]'], // Allow all cookies
|
['//button[contains(text(), "Allow all cookies")]'], // Allow all cookies
|
||||||
['//button[contains(text(), "Not Now")]', ["Popup Not Now clicked"]], // Not now
|
['//button[contains(text(), "Not Now")]', ["Popup Not Now clicked"]], // Not now
|
||||||
['//button|//div[contains(text(), "OK")]', ["Popup Ok clicked"]], // OK
|
['(//button|//div)[contains(text(), "OK")]', ["Popup Ok clicked"]], // OK
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($popupsTypes as $popup) {
|
foreach ($popupsTypes as $popup) {
|
||||||
|
|||||||
@@ -451,6 +451,7 @@ Captions must:
|
|||||||
4. Encourage engagement relevant to the platform's algorithm (e.g., asking a question related to the joke/scene).
|
4. Encourage engagement relevant to the platform's algorithm (e.g., asking a question related to the joke/scene).
|
||||||
5. Optionally include relevant hashtags at the end (#hashtagsOnly), chosen appropriately for the reel's content or vibe. Use common tags if no specific ones are provided, but avoid overly generic ones unless fitting.
|
5. Optionally include relevant hashtags at the end (#hashtagsOnly), chosen appropriately for the reel's content or vibe. Use common tags if no specific ones are provided, but avoid overly generic ones unless fitting.
|
||||||
6. If credit information is provided in the input (e.g., `credit: twitteruser`), acknowledge it minimally within the caption text *using only that source*. Do not invent any account handles (`@`) or platform prefixes (`tt/`). Use phrases like \"Credited to...\" or simply insert the credited name if appropriate, but don't force it unless the core concept naturally includes attribution. If no credit is provided, do not mention a specific creator.
|
6. If credit information is provided in the input (e.g., `credit: twitteruser`), acknowledge it minimally within the caption text *using only that source*. Do not invent any account handles (`@`) or platform prefixes (`tt/`). Use phrases like \"Credited to...\" or simply insert the credited name if appropriate, but don't force it unless the core concept naturally includes attribution. If no credit is provided, do not mention a specific creator.
|
||||||
|
7. Be in english.
|
||||||
|
|
||||||
**Do Not:**
|
**Do Not:**
|
||||||
* Start captions with 'This reel...' or similar intros.
|
* Start captions with 'This reel...' or similar intros.
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
|
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
|
||||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||||
<env name="CACHE_STORE" value="array"/>
|
<env name="CACHE_STORE" value="array"/>
|
||||||
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
|
<env name="DB_CONNECTION" value="sqlite"/>
|
||||||
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
|
<env name="DB_DATABASE" value=":memory:"/>
|
||||||
<env name="MAIL_MAILER" value="array"/>
|
<env name="MAIL_MAILER" value="array"/>
|
||||||
<env name="PULSE_ENABLED" value="false"/>
|
<env name="PULSE_ENABLED" value="false"/>
|
||||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature\EldoradoRobuxPriceSentryJob;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Illuminate\Foundation\Testing\WithFaker;
|
||||||
|
use App\Browser\Jobs\EldoradoRobuxPriceSentry\EldoradoRobuxPriceSentryJob;
|
||||||
|
use ReflectionMethod;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class textToFLoatTest extends TestCase
|
||||||
|
{
|
||||||
|
private EldoradoRobuxPriceSentryJob $job;
|
||||||
|
|
||||||
|
protected function setUp(): void {
|
||||||
|
parent::setUp();
|
||||||
|
$this->job = new EldoradoRobuxPriceSentryJob();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function assertTextToFloat($input, $expected) {
|
||||||
|
$reflection = new ReflectionMethod(EldoradoRobuxPriceSentryJob::class, 'textToFloat');
|
||||||
|
$reflection->setAccessible(true);
|
||||||
|
$result = $reflection->invoke($this->job, $input);
|
||||||
|
$this->assertEquals($expected, $result, "Failed asserting that textToFloat('$input') equals $expected. Got $result instead.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function test_simple_int(): void
|
||||||
|
{
|
||||||
|
$this->assertTextToFloat("10", 10.0);
|
||||||
|
$this->assertTextToFloat(" 42", 42.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_decimal_numbers(): void
|
||||||
|
{
|
||||||
|
$this->assertTextToFloat("3,14", 3.14);
|
||||||
|
$this->assertTextToFloat(" 0,0015 ", 0.0015);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_money_symbols_int(): void
|
||||||
|
{
|
||||||
|
$this->assertTextToFloat("5 €", 5.0);
|
||||||
|
$this->assertTextToFloat(" € 123 ", 123.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_money_symbols_decimal(): void
|
||||||
|
{
|
||||||
|
$this->assertTextToFloat("7,89 €", 7.89);
|
||||||
|
$this->assertTextToFloat(" € 0,75 ", 0.75);
|
||||||
|
$this->assertTextToFloat(" €0.00402 ", 0.00402);
|
||||||
|
$this->assertTextToFloat(" 0,00429 € ", 0.00429);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
0
tests/Unit/.gitkeep
Normal file
0
tests/Unit/.gitkeep
Normal file
13
undetectedChromedriver/README.md
Normal file
13
undetectedChromedriver/README.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Selenium Undetected Standalone-Chromedriver
|
||||||
|
|
||||||
|
Selenium Standalone-Chromedriver with Undected-Chromedriver applied
|
||||||
|
|
||||||
|
## Bug
|
||||||
|
|
||||||
|
```txt
|
||||||
|
Could not start a new session. Response code 500. Message: session not created: probably user data directory is already in use,
|
||||||
|
```
|
||||||
|
|
||||||
|
Go into the `/home/seluser` director in the container and run `rm -rf ~/.config/google-chrome/Singleton*`
|
||||||
|
|
||||||
|
If it doesn't work, the log can be found in the set profile folder in the file `chrome_debug.log`
|
||||||
Reference in New Issue
Block a user