Remove WireGuard integration from production deployment to simplify infrastructure: - Remove docker-compose-direct-access.yml (VPN-bound services) - Remove VPN-only middlewares from Grafana, Prometheus, Portainer - Remove WireGuard middleware definitions from Traefik - Remove WireGuard IPs (10.8.0.0/24) from Traefik forwarded headers All monitoring services now publicly accessible via subdomains: - grafana.michaelschiemer.de (with Grafana native auth) - prometheus.michaelschiemer.de (with Basic Auth) - portainer.michaelschiemer.de (with Portainer native auth) All services use Let's Encrypt SSL certificates via Traefik.
134 lines
3.8 KiB
PHP
134 lines
3.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
use App\Framework\QrCode\QrCodeGenerator;
|
|
use App\Framework\QrCode\QrCodeRenderer;
|
|
use App\Framework\QrCode\ValueObjects\ErrorCorrectionLevel;
|
|
use App\Framework\QrCode\ValueObjects\QrCodeConfig;
|
|
use App\Framework\QrCode\ValueObjects\QrCodeVersion;
|
|
use App\Framework\QrCode\ValueObjects\EncodingMode;
|
|
|
|
echo "=== SVG Rendering Comparison ===\n\n";
|
|
|
|
$config = new QrCodeConfig(
|
|
version: QrCodeVersion::fromNumber(1),
|
|
errorCorrectionLevel: ErrorCorrectionLevel::M,
|
|
encodingMode: EncodingMode::BYTE
|
|
);
|
|
|
|
$matrix = QrCodeGenerator::generate('HELLO WORLD', $config);
|
|
$renderer = new QrCodeRenderer();
|
|
$svg = $renderer->renderSvg($matrix);
|
|
|
|
echo "Generated SVG:\n";
|
|
echo " Length: " . strlen($svg) . " bytes\n";
|
|
|
|
// Check SVG structure
|
|
if (preg_match('/width="(\d+)" height="(\d+)"/', $svg, $sizeMatches)) {
|
|
echo " Canvas size: {$sizeMatches[1]}x{$sizeMatches[2]}\n";
|
|
}
|
|
|
|
// Check module size
|
|
if (preg_match('/width="(\d+\.?\d*)" height="(\d+\.?\d*)" fill="black"/', $svg, $moduleMatches)) {
|
|
echo " Module size: {$moduleMatches[1]}x{$moduleMatches[2]}\n";
|
|
}
|
|
|
|
// Count rectangles
|
|
$rectCount = substr_count($svg, '<rect');
|
|
echo " Rectangles: {$rectCount}\n\n";
|
|
|
|
// Check first few rectangles to see coordinates
|
|
echo "First 10 rectangles:\n";
|
|
preg_match_all('/<rect x="(\d+\.?\d*)" y="(\d+\.?\d*)" width="(\d+\.?\d*)" height="(\d+\.?\d*)" fill="(black|white)"/', $svg, $matches, PREG_SET_ORDER);
|
|
|
|
for ($i = 0; $i < min(10, count($matches)); $i++) {
|
|
$m = $matches[$i];
|
|
echo " Rect {$i}: x={$m[1]}, y={$m[2]}, w={$m[3]}, h={$m[4]}, color={$m[5]}\n";
|
|
}
|
|
|
|
echo "\n";
|
|
|
|
// Check if coordinates match expected pattern
|
|
// For Version 1, module size should be consistent
|
|
// Quiet zone should be present
|
|
|
|
// Find quiet zone (first white rectangle)
|
|
$firstWhite = null;
|
|
foreach ($matches as $m) {
|
|
if ($m[5] === 'white') {
|
|
$firstWhite = $m;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if ($firstWhite) {
|
|
echo "Quiet zone (first white rect):\n";
|
|
echo " Position: ({$firstWhite[1]}, {$firstWhite[2]})\n";
|
|
echo " Size: {$firstWhite[3]}x{$firstWhite[4]}\n";
|
|
|
|
if ($firstWhite[1] == 0 && $firstWhite[2] == 0) {
|
|
echo " ✅ Quiet zone starts at (0,0)\n";
|
|
} else {
|
|
echo " ⚠️ Quiet zone doesn't start at (0,0)\n";
|
|
}
|
|
}
|
|
|
|
// Check top-left finder pattern in SVG
|
|
// Top-left finder should be at module position (0,0) which should be at SVG coordinates
|
|
// depending on quiet zone and module size
|
|
echo "\n=== Top-Left Finder Pattern in SVG ===\n";
|
|
$finderRects = [];
|
|
foreach ($matches as $m) {
|
|
if ($m[5] === 'black') {
|
|
// Check if this might be part of top-left finder (first few modules)
|
|
$x = (float)$m[1];
|
|
$y = (float)$m[2];
|
|
if ($x < 200 && $y < 200) { // Rough estimate
|
|
$finderRects[] = $m;
|
|
}
|
|
}
|
|
}
|
|
|
|
echo "Found " . count($finderRects) . " black rectangles in top-left area\n";
|
|
|
|
// Sort by y then x
|
|
usort($finderRects, function($a, $b) {
|
|
$y1 = (float)$a[2];
|
|
$y2 = (float)$b[2];
|
|
if (abs($y1 - $y2) < 0.01) {
|
|
return (float)$a[1] <=> (float)$b[1];
|
|
}
|
|
return $y1 <=> $y2;
|
|
});
|
|
|
|
echo "First 7 rectangles (first row of finder pattern):\n";
|
|
for ($i = 0; $i < min(7, count($finderRects)); $i++) {
|
|
$m = $finderRects[$i];
|
|
echo " x={$m[1]}, y={$m[2]}\n";
|
|
}
|
|
|
|
// Check if module size is consistent
|
|
$moduleSizes = [];
|
|
foreach ($matches as $m) {
|
|
$w = (float)$m[3];
|
|
$h = (float)$m[4];
|
|
$key = "{$w}x{$h}";
|
|
$moduleSizes[$key] = ($moduleSizes[$key] ?? 0) + 1;
|
|
}
|
|
|
|
echo "\nModule size distribution:\n";
|
|
foreach ($moduleSizes as $size => $count) {
|
|
echo " {$size}: {$count} rectangles\n";
|
|
}
|
|
|
|
if (count($moduleSizes) === 1) {
|
|
echo "✅ All modules have same size\n";
|
|
} else {
|
|
echo "❌ Modules have different sizes!\n";
|
|
}
|
|
|
|
|