5 Commits

Author SHA1 Message Date
faea2b0899 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
2026-02-15 19:58:43 +01:00
427fa24565 clarify 2026-02-15 19:29:55 +01:00
086e7c7a77 full path 2025-06-10 12:00:35 +02:00
181bed4449 config corrections 2025-06-10 11:57:16 +02:00
6e0795bbdf url 2025-06-10 11:55:13 +02:00
7 changed files with 20 additions and 8 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

@@ -20,6 +20,6 @@ _buildConfig() {
echo ""
}
_buildConfig > src/inc/config.inc.php
_buildConfig > /srv/src/config.inc.php
caddy run --config /etc/caddy/Caddyfile

1
src/.gitignore vendored
View File

@@ -1 +1,2 @@
vendor/
config.inc.php

3
src/config.inc.php.php Executable file
View File

@@ -0,0 +1,3 @@
<?php
define('URL','http://localhost:8080'); //no trailing slash

View File

@@ -30,7 +30,12 @@ switch ($url[0]) {
}
$ip = getUserIP();
$viewport = $_REQUEST['viewport'];
$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)';
exit;
}
$js = $_REQUEST['js'] == 'false' ? false : true;
$serverUrl = 'http://localhost:4444';
@@ -58,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());