DNSBlock
This commit is contained in:
28
app/Controllers/ApiController.php
Normal file
28
app/Controllers/ApiController.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\Domain;
|
||||
use App\Utils\View;
|
||||
|
||||
class ApiController
|
||||
{
|
||||
public function domains()
|
||||
{
|
||||
$domainModel = new Domain();
|
||||
// Get only blocked domains
|
||||
$domains = $domainModel->where('status', 'blocked');
|
||||
|
||||
$list = array_column($domains, 'name');
|
||||
|
||||
// Calculate Checksum (MD5 of sorted list)
|
||||
sort($list);
|
||||
$checksum = md5(json_encode($list));
|
||||
|
||||
View::json([
|
||||
'domains' => $list,
|
||||
'checksum' => $checksum,
|
||||
'timestamp' => time()
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user