mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Added blocklist last updated
This commit is contained in:
parent
8fd1677974
commit
3fa5215449
@ -376,3 +376,44 @@ function optionsForSelect($options)
|
|||||||
}
|
}
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function blocklistUpdated($file)
|
||||||
|
{
|
||||||
|
$blocklist = RASPI_CONFIG.'/adblock/'.$file;
|
||||||
|
if (file_exists($blocklist)) {
|
||||||
|
$lastModified = date ("F d Y H:i:s.", filemtime($blocklist));
|
||||||
|
$lastModified = formatDateAgo($lastModified);
|
||||||
|
return $lastModified;
|
||||||
|
} else {
|
||||||
|
return 'Never';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDateAgo($datetime, $full = false)
|
||||||
|
{
|
||||||
|
$now = new DateTime;
|
||||||
|
$ago = new DateTime($datetime);
|
||||||
|
$diff = $now->diff($ago);
|
||||||
|
|
||||||
|
$diff->w = floor($diff->d / 7);
|
||||||
|
$diff->d -= $diff->w * 7;
|
||||||
|
|
||||||
|
$string = array(
|
||||||
|
'y' => 'year',
|
||||||
|
'm' => 'month',
|
||||||
|
'w' => 'week',
|
||||||
|
'd' => 'day',
|
||||||
|
'h' => 'hour',
|
||||||
|
'i' => 'minute',
|
||||||
|
's' => 'second',
|
||||||
|
);
|
||||||
|
foreach ($string as $k => &$v) {
|
||||||
|
if ($diff->$k) {
|
||||||
|
$v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : '');
|
||||||
|
} else {
|
||||||
|
unset($string[$k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$full) $string = array_slice($string, 0, 1);
|
||||||
|
return $string ? implode(', ', $string) . ' ago' : 'just now';
|
||||||
|
}
|
||||||
|
@ -11,12 +11,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<p id="adblock-description">
|
<p id="adblock-description">
|
||||||
<small><?php echo _("Enable this option if you want RaspAP to <b>block DNS requests for ads, tracking and other virtual garbage</b>. Blocklists are gathered from multiple, actively maintained sources and automatically updated, cleaned, optimized and moderated on a daily basis.") ?></small>
|
<small><?php echo _("Enable this option if you want RaspAP to <b>block DNS requests for ads, tracking and other virtual garbage</b>. Blocklists are gathered from multiple, actively maintained sources and automatically updated, cleaned, optimized and moderated on a daily basis.") ?></small>
|
||||||
<div class="mb-3">
|
<div>
|
||||||
<small class="text-muted"><?php echo _("This option adds <code>conf-file</code> and <code>addn-hosts</code> to the dnsmasq configuration.") ?></small>
|
<small class="text-muted"><?php echo _("This option adds <code>conf-file</code> and <code>addn-hosts</code> to the dnsmasq configuration.") ?></small>
|
||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<p id="blocklist-updated">
|
||||||
|
<div><small>Hostnames blocklist last updated: <b><?php echo blocklistUpdated('hostnames.txt') ?></b></small></div>
|
||||||
|
<div><small>Domains blocklist last updated: <b><?php echo blocklistUpdated('domains.txt') ?></b></small></div>
|
||||||
|
</p>
|
||||||
<div class="input-group col-md-12 mb-4">
|
<div class="input-group col-md-12 mb-4">
|
||||||
<select class="custom-select custom-select-sm" id="cbxblocklist" onchange="clearBlocklistStatus()">
|
<select class="custom-select custom-select-sm" id="cbxblocklist" onchange="clearBlocklistStatus()">
|
||||||
<option value=""><?php echo _("Choose a blocklist provider") ?></option>
|
<option value=""><?php echo _("Choose a blocklist provider") ?></option>
|
||||||
@ -30,6 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div><!-- /.row -->
|
</div><!-- /.row -->
|
||||||
</div><!-- /.tab-pane | advanded tab -->
|
</div><!-- /.tab-pane | advanded tab -->
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user