DNSBlock
This commit is contained in:
7
public/.htaccess
Normal file
7
public/.htaccess
Normal file
@@ -0,0 +1,7 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
||||
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()]);
|
||||
}
|
||||
21
public/index.php
Normal file
21
public/index.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
session_start();
|
||||
|
||||
use App\Core\Router;
|
||||
use Dotenv\Dotenv;
|
||||
|
||||
// Load Env
|
||||
$dotenv = Dotenv::createImmutable(__DIR__ . '/../');
|
||||
$dotenv->safeLoad();
|
||||
|
||||
// Init Router
|
||||
$router = new Router();
|
||||
|
||||
// Load Routes
|
||||
require_once __DIR__ . '/../app/routes.php';
|
||||
|
||||
// Dispatch
|
||||
$router->dispatch($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);
|
||||
Reference in New Issue
Block a user