fix: correct URL format in docker-compose files and improve viewport handling in index.php
All checks were successful
Build Container / docker (push) Successful in 28s

This commit is contained in:
2026-02-15 19:58:43 +01:00
parent 427fa24565
commit faea2b0899
3 changed files with 9 additions and 6 deletions

View File

@@ -13,6 +13,6 @@ services:
- ./logs:/srv/logs
environment:
- URL=http://localhost:8080
- URL=http://localhostxxx:8080
ports:
- 8080:80

View File

@@ -1,9 +1,10 @@
version: '3.3'
services:
http2pic:
image: gitea.haschek.at/haschek-solutions/http2pic:2
restart: unless-stopped
volumes:
- ./cache:/srv/cache
- ./logs:/srv/logs
environment:
- URL=http://localhost:8080
ports:

View File

@@ -30,7 +30,7 @@ switch ($url[0]) {
}
$ip = getUserIP();
$viewport = $_REQUEST['viewport'] ?? '1024x768';
$viewport = $_REQUEST['viewport'] ?: '1024x768';
if (!preg_match('/^\d+x\d+$/', $viewport)) {
header('HTTP/1.0 400 Bad Request');
echo 'Invalid viewport format. Use WIDTHxHEIGHT (e.g., 1024x768)';
@@ -63,9 +63,11 @@ switch ($url[0]) {
$viewport = explode('x', $viewport);
$driver->manage()->window()->setSize(new \Facebook\WebDriver\WebDriverDimension($viewport[0], $viewport[1]));
} else {
$driver->manage()->window()->setSize(new \Facebook\WebDriver\WebDriverDimension(1024, 768));
$viewport = [1024, 768];
$driver->manage()->window()->setSize(new \Facebook\WebDriver\WebDriverDimension($viewport[0], $viewport[1]));
}
addToLog("$ip\tRequested $target with viewport " . implode('x', $viewport) . " and js " . ($js ? 'enabled' : 'disabled'));
$viewportLabel = is_array($viewport) ? implode('x', $viewport) : (string) $viewport;
addToLog("$ip\tRequested $target with viewport " . $viewportLabel . " and js " . ($js ? 'enabled' : 'disabled'));
} catch (Exception $e) {
header('HTTP/1.0 500 Internal Server Error');
addToLog("$ip\tRequested $target but resulted in error:\t" . $e->getMessage());