DNSBlock
This commit is contained in:
39
public/debug_domains.php
Normal file
39
public/debug_domains.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use App\Models\Domain;
|
||||
use App\Config\Database;
|
||||
|
||||
// Simple security check: only allow from localhost or private IPs if desired.
|
||||
// For dev environment convenience, we'll allow it but add a warning header.
|
||||
|
||||
header('Content-Type: application/json');
|
||||
header('X-Debug-Mode: True');
|
||||
|
||||
try {
|
||||
$domainModel = new Domain();
|
||||
|
||||
// Use findAll and filter manually to be safe
|
||||
$all = $domainModel->findAll();
|
||||
$domains = array_filter($all, function ($d) {
|
||||
return isset($d['status']) && $d['status'] === 'blocked';
|
||||
});
|
||||
$domains = array_values($domains); // Reindex
|
||||
|
||||
$domainNames = array_column($domains, 'name');
|
||||
|
||||
// Calculate checksum
|
||||
$checksum = md5(json_encode($domainNames));
|
||||
|
||||
echo json_encode([
|
||||
'count' => count($domainNames),
|
||||
'checksum' => $checksum,
|
||||
'timestamp' => time(),
|
||||
'domains' => $domainNames
|
||||
], JSON_PRETTY_PRINT);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => $e->getMessage()]);
|
||||
}
|
||||
Reference in New Issue
Block a user