mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Add possibility to blacklist/whitelist entries on the Queries page.
This commit is contained in:
+32
-5
@@ -16,12 +16,39 @@ $(document).ready(function() {
|
||||
{ "width" : "20%", "type": "date" },
|
||||
{ "width" : "10%" },
|
||||
{ "width" : "40%" },
|
||||
{ "width" : "15%" },
|
||||
{ "width" : "15%" }
|
||||
]
|
||||
})
|
||||
{ "width" : "12.5%" },
|
||||
{ "width" : "12.5%" },
|
||||
{ "width" : "5%" },
|
||||
],
|
||||
"columnDefs": [ {
|
||||
"targets": -1,
|
||||
"data": null,
|
||||
"defaultContent": "<button>Do it!</button>"
|
||||
} ]
|
||||
});
|
||||
$('#all-queries tbody').on( 'click', 'button', function () {
|
||||
var data = tableApi.row( $(this).parents('tr') ).data();
|
||||
if (data[4] == "Pi-holed")
|
||||
{
|
||||
add(data[2],"white");
|
||||
}
|
||||
else
|
||||
{
|
||||
add(data[2],"black");
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
function refreshData() {
|
||||
tableApi.ajax.url("api.php?getAllQueries").load();
|
||||
}
|
||||
}
|
||||
|
||||
function add(domain,list) {
|
||||
var token = $("#token").html();
|
||||
$.ajax({
|
||||
url: "php/add.php",
|
||||
method: "post",
|
||||
data: {"domain":domain, "list":list, "token":token}
|
||||
// success: function(response) { alert(response); }
|
||||
});
|
||||
}
|
||||
|
||||
+11
@@ -1,6 +1,15 @@
|
||||
<?php
|
||||
require "header.php";
|
||||
|
||||
session_start();
|
||||
// Generate CSRF token
|
||||
if(empty($_SESSION['token'])) {
|
||||
$_SESSION['token'] = base64_encode(openssl_random_pseudo_bytes(32));
|
||||
}
|
||||
$token = $_SESSION['token'];
|
||||
?>
|
||||
<!-- Send PHP info to JS -->
|
||||
<div id="token" hidden><?php echo $token ?></div>
|
||||
|
||||
<!--
|
||||
<div class="row">
|
||||
@@ -26,6 +35,7 @@
|
||||
<th>Domain</th>
|
||||
<th>Client</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
@@ -35,6 +45,7 @@
|
||||
<th>Domain</th>
|
||||
<th>Client</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user