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.
85 lines
2.7 KiB
PHP
85 lines
2.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
use App\Framework\QrCode\Structure\FinderPattern;
|
|
use App\Framework\QrCode\ValueObjects\QrCodeMatrix;
|
|
use App\Framework\QrCode\ValueObjects\QrCodeVersion;
|
|
|
|
echo "=== Finder Pattern Logic Test ===\n\n";
|
|
|
|
// Expected finder pattern (7x7)
|
|
$expectedPattern = [
|
|
[1,1,1,1,1,1,1], // Row 0: all dark
|
|
[1,0,0,0,0,0,1], // Row 1: dark, light, light, light, light, light, dark
|
|
[1,0,1,1,1,0,1], // Row 2: dark, light, dark, dark, dark, light, dark
|
|
[1,0,1,1,1,0,1], // Row 3: dark, light, dark, dark, dark, light, dark
|
|
[1,0,1,1,1,0,1], // Row 4: dark, light, dark, dark, dark, light, dark
|
|
[1,0,0,0,0,0,1], // Row 5: dark, light, light, light, light, light, dark
|
|
[1,1,1,1,1,1,1], // Row 6: all dark
|
|
];
|
|
|
|
echo "Expected Finder Pattern:\n";
|
|
foreach ($expectedPattern as $r => $row) {
|
|
echo " Row {$r}: " . implode('', $row) . "\n";
|
|
}
|
|
echo "\n";
|
|
|
|
// Create matrix and apply finder pattern
|
|
$matrix = QrCodeMatrix::create(QrCodeVersion::fromNumber(1));
|
|
$matrix = FinderPattern::apply($matrix);
|
|
|
|
// Test top-left finder pattern
|
|
echo "Actual Top-Left Finder Pattern:\n";
|
|
$errors = 0;
|
|
for ($r = 0; $r < 7; $r++) {
|
|
$bits = '';
|
|
for ($c = 0; $c < 7; $c++) {
|
|
$isDark = $matrix->getModuleAt($r, $c)->isDark();
|
|
$bit = $isDark ? '1' : '0';
|
|
$bits .= $bit;
|
|
|
|
if ($bit !== (string)$expectedPattern[$r][$c]) {
|
|
$errors++;
|
|
}
|
|
}
|
|
echo " Row {$r}: {$bits}";
|
|
|
|
if ($bits === implode('', $expectedPattern[$r])) {
|
|
echo " ✅\n";
|
|
} else {
|
|
echo " ❌ (expected: " . implode('', $expectedPattern[$r]) . ")\n";
|
|
|
|
// Show differences
|
|
for ($c = 0; $c < 7; $c++) {
|
|
$actual = $bits[$c];
|
|
$expected = (string)$expectedPattern[$r][$c];
|
|
if ($actual !== $expected) {
|
|
echo " Column {$c}: got {$actual}, expected {$expected}\n";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
echo "\nTotal errors: {$errors}\n\n";
|
|
|
|
// Test the logic manually
|
|
echo "=== Manual Logic Test ===\n";
|
|
echo "For position (r=2, c=3):\n";
|
|
$r = 2;
|
|
$c = 3;
|
|
echo " r = {$r}, c = {$c}\n";
|
|
echo " Outer ring? (r==0 || r==6 || c==0 || c==6): " . (($r === 0 || $r === 6 || $c === 0 || $c === 6) ? "YES" : "NO") . "\n";
|
|
echo " White ring? (r==1 || r==5 || c==1 || c==5): " . (($r === 1 || $r === 5 || $c === 1 || $c === 5) ? "YES" : "NO") . "\n";
|
|
echo " Expected: DARK (inner 3x3)\n";
|
|
echo " Actual: " . ($matrix->getModuleAt($r, $c)->isDark() ? "DARK" : "LIGHT") . "\n";
|
|
|
|
if (!$matrix->getModuleAt($r, $c)->isDark()) {
|
|
echo "\n❌ PROBLEM FOUND: Position (2,3) should be DARK but is LIGHT!\n";
|
|
echo "This means the white ring condition is matching incorrectly.\n";
|
|
}
|
|
|
|
|