refactor(deployment): Remove WireGuard VPN dependency and restore public service access
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.
This commit is contained in:
140
tests/debug/compare-svg-with-matrix.php
Normal file
140
tests/debug/compare-svg-with-matrix.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<?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;
|
||||
use App\Framework\QrCode\ValueObjects\QrCodeStyle;
|
||||
|
||||
echo "=== Compare SVG with Matrix ===\n\n";
|
||||
|
||||
$testData = 'HELLO WORLD';
|
||||
$config = new QrCodeConfig(
|
||||
version: QrCodeVersion::fromNumber(1),
|
||||
errorCorrectionLevel: ErrorCorrectionLevel::M,
|
||||
encodingMode: EncodingMode::BYTE
|
||||
);
|
||||
|
||||
$matrix = QrCodeGenerator::generate($testData, $config);
|
||||
|
||||
// Generate SVG with same parameters as the user's SVG
|
||||
// User's SVG: 580x580px, 20px modules, 4 module quiet zone
|
||||
$style = new QrCodeStyle(
|
||||
moduleSize: 20,
|
||||
quietZoneSize: 4,
|
||||
includeQuietZone: true
|
||||
);
|
||||
|
||||
$renderer = new QrCodeRenderer();
|
||||
$svg = $renderer->renderSvg($matrix, $style);
|
||||
|
||||
echo "Generated SVG:\n";
|
||||
echo " Size: " . strlen($svg) . " bytes\n";
|
||||
|
||||
// Extract dimensions
|
||||
preg_match('/width="([0-9.]+)"\s+height="([0-9.]+)"/', $svg, $dimMatches);
|
||||
if (!empty($dimMatches)) {
|
||||
echo " Dimensions: {$dimMatches[1]}x{$dimMatches[2]}px\n";
|
||||
}
|
||||
|
||||
// Extract all rectangles
|
||||
preg_match_all('/x="([0-9.]+)"\s+y="([0-9.]+)"\s+width="([0-9.]+)"\s+height="([0-9.]+)"\s+fill="([^"]+)"/', $svg, $rectMatches);
|
||||
|
||||
if (!empty($rectMatches[1])) {
|
||||
$rectCount = count($rectMatches[1]);
|
||||
echo " Rectangles: {$rectCount}\n";
|
||||
|
||||
// Check first rectangle
|
||||
$firstX = (float)$rectMatches[1][0];
|
||||
$firstY = (float)$rectMatches[2][0];
|
||||
$firstW = (float)$rectMatches[3][0];
|
||||
$firstH = (float)$rectMatches[4][0];
|
||||
$firstFill = $rectMatches[5][0];
|
||||
|
||||
echo " First rectangle: x={$firstX}, y={$firstY}, w={$firstW}, h={$firstH}, fill={$firstFill}\n";
|
||||
|
||||
// Expected first position (quiet zone offset)
|
||||
$expectedOffset = 4 * 20; // 4 modules * 20px
|
||||
echo " Expected offset: {$expectedOffset}px\n";
|
||||
|
||||
if (abs($firstX - $expectedOffset) < 1 && abs($firstY - $expectedOffset) < 1) {
|
||||
echo " ✅ Position correct\n";
|
||||
} else {
|
||||
echo " ❌ Position incorrect!\n";
|
||||
}
|
||||
|
||||
if (abs($firstW - 20) < 1 && abs($firstH - 20) < 1) {
|
||||
echo " ✅ Size correct (20px)\n";
|
||||
} else {
|
||||
echo " ❌ Size incorrect!\n";
|
||||
}
|
||||
|
||||
// Count unique positions
|
||||
$positions = [];
|
||||
for ($i = 0; $i < $rectCount; $i++) {
|
||||
$x = (float)$rectMatches[1][$i];
|
||||
$y = (float)$rectMatches[2][$i];
|
||||
$positions[] = "{$x},{$y}";
|
||||
}
|
||||
|
||||
$uniquePositions = count(array_unique($positions));
|
||||
echo " Unique positions: {$uniquePositions}\n";
|
||||
|
||||
if ($uniquePositions === $rectCount) {
|
||||
echo " ✅ No overlapping rectangles\n";
|
||||
} else {
|
||||
echo " ❌ Overlapping rectangles detected!\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Check colors
|
||||
$blackCount = substr_count($svg, 'fill="black"') + substr_count($svg, 'fill="#000000"') + substr_count($svg, 'fill="#000"');
|
||||
$whiteCount = substr_count($svg, 'fill="white"') + substr_count($svg, 'fill="#FFFFFF"') + substr_count($svg, 'fill="#ffffff"');
|
||||
|
||||
echo "\nColors:\n";
|
||||
echo " Black fills: {$blackCount}\n";
|
||||
echo " White fills: {$whiteCount}\n";
|
||||
|
||||
// Verify matrix -> SVG mapping
|
||||
echo "\n=== Matrix to SVG Verification ===\n";
|
||||
$matrixSize = $matrix->getSize();
|
||||
$darkInMatrix = 0;
|
||||
|
||||
for ($row = 0; $row < $matrixSize; $row++) {
|
||||
for ($col = 0; $col < $matrixSize; $col++) {
|
||||
if ($matrix->getModuleAt($row, $col)->isDark()) {
|
||||
$darkInMatrix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "Dark modules in matrix: {$darkInMatrix}\n";
|
||||
echo "Black rectangles in SVG: {$blackCount}\n";
|
||||
|
||||
if ($darkInMatrix === $blackCount) {
|
||||
echo "✅ Count matches!\n";
|
||||
} else {
|
||||
echo "❌ Count mismatch!\n";
|
||||
echo "This indicates a rendering problem.\n";
|
||||
}
|
||||
|
||||
// Save for comparison
|
||||
$outputPath = __DIR__ . '/test-qrcodes/comparison.svg';
|
||||
file_put_contents($outputPath, $svg);
|
||||
echo "\n✅ Saved comparison SVG: {$outputPath}\n";
|
||||
|
||||
// Generate a simple test to verify SVG rendering
|
||||
echo "\n=== SVG Rendering Test ===\n";
|
||||
echo "Open the SVG in a browser and check:\n";
|
||||
echo "1. All modules are square\n";
|
||||
echo "2. No gaps between modules\n";
|
||||
echo "3. Quiet zone is white\n";
|
||||
echo "4. QR code is clearly visible\n";
|
||||
echo "5. Try scanning with phone camera\n";
|
||||
|
||||
Reference in New Issue
Block a user