Merge branch 'loginpage' of https://github.com/pi-hole/AdminLTE into loginpage

Conflicts:
	php/loginpage.php
This commit is contained in:
DL6ER
2016-12-13 11:59:26 +01:00
4 changed files with 118 additions and 22 deletions
+18 -2
View File
@@ -5,8 +5,24 @@
<footer class="main-footer">
<div class="pull-right hidden-xs">
<?php
$piholeVersion = exec("cd /etc/.pihole/ && git describe --tags --abbrev=0");
$webVersion = exec("git describe --tags --abbrev=0");
// Check if on a dev branch
$piholeVersion = exec("cd /etc/.pihole/ && git rev-parse --abbrev-ref HEAD");
$webVersion = exec("git rev-parse --abbrev-ref HEAD");
// Use vDev if not on master
if($piholeVersion !== "master") {
$piholeVersion = "vDev";
}
else {
$piholeVersion = exec("cd /etc/.pihole/ && git describe --tags --abbrev=0");
}
if($webVersion !== "master") {
$webVersion = "vDev";
}
else {
$webVersion = exec("git describe --tags --abbrev=0");
}
?>
<b>Pi-hole Version </b> <span id="piholeVersion"><?php echo $piholeVersion; ?></span>
<b>Web Interface Version </b> <span id="webVersion"><?php echo $webVersion; ?></span>
+5 -4
View File
@@ -54,7 +54,7 @@
<p>On the main page, you can see various Pi-hole statistics:</p>
<ul>
<li>Summary: A summary of statistics showing how many total DNS queries have been blocked today, what percentage of DNS queries have been blocked, and how many domains are in the compiled ad list. This summary is updated every 10 seconds.</li>
<li>Queries over time: Graph showing DNS queries (total and blocked) over 10 minute time intervals. More information can be acquired by hovering over the lines.</li>
<li>Queries over time: Graph showing DNS queries (total and blocked) over 10 minute time intervals. More information can be acquired by hovering over the lines. This graph is updated every 10 minutes.</li>
<li>Query Types: Identifies the types of processed queries:
<ul>
<li>A: address lookup (most commonly used to map hostnames to an IPv4 address of the host)</li>
@@ -89,13 +89,13 @@
<div class="row">
<div class="col-md-12">
<h2>Update Lists</h2>
<p>Runs the command <pre>sudo pihole -g</pre> and prints the result transparently to the web UI. The gravity.sh script will update the list of ad-serving domains</p>
<p>Will download any updates from the third-party ad-serving domain lists that we source. By default, this command runs once a week via cron.</p>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h2>Query adlists</h2>
<p>Runs the command <pre>sudo pihole -q <i>searchstring</i></pre> and prints the result transparently to the web UI. This command can be used to scan for strings in the list of blocked domains, e.g., &quot;analytics&quot; will deliver all domains which contain *analytics*, where the asterisk (*) represents a number of characters or an empty string</p>
This function is useful to find out what list a domain appears on. Since we don't control what the third-parties put on the block lists, you may find that a domain you normally visit stops working. If this is the case, you could run this command to scan for strings in the list of blocked domains and it will return the list the domain is found on. This proved useful a while back when the Mahakala list was adding apple.com and microsoft.com to their block list.</p>
</div>
</div>
<div class="row">
@@ -139,7 +139,8 @@
<div class="row">
<div class="col-md-12">
<h2>Emergency help</h2>
In case the web UI does not work properly anymore (i.e. timeout errors or diagrams not showing up) you can try to flush the Pi-hole config file by clicking <a href="#" id="flush">FLUSH</a>. Note that your statistics will be reset and you lose the statistics up to this point.
Depending on your system and how heavily your Pi-hole is used, you may want to flush the log throughout the day by clicking on <a href="#" id="flush">FLUSH</a>. By default, the log if flushed at the end of the day via cron, but a very large log file can slow down the Web interface, so flushing it can be useful.
Note that your statistics will be reset and you lose the statistics up to this point.
</div>
</div>
+21 -10
View File
@@ -42,12 +42,24 @@ var piholeVersion = $("#piholeVersion").html();
var webVersion = $("#webVersion").html();
// Credit for following function: https://gist.github.com/alexey-bass/1115557
// Modified to discard any possible "v" in the string
function versionCompare(left, right) {
if (typeof left + typeof right != 'stringstring')
if (typeof left + typeof right !== 'stringstring')
return false;
var a = left.split('.')
, b = right.split('.')
// If we are on vDev then we assume that it is always
// newer than the latest online release, i.e. version
// comparion should return 1
if(left === "vDev")
{
return 1;
}
var aa = left.split("v"),
bb = right.split("v");
var a = aa[aa.length-1].split(".")
, b = bb[bb.length-1].split(".")
, i = 0, len = Math.max(a.length, b.length);
for (; i < len; i++) {
@@ -57,22 +69,20 @@ function versionCompare(left, right) {
return -1;
}
}
return 0;
}
// Update check
$.getJSON("https://api.github.com/repos/pi-hole/pi-hole/releases/latest", function(json) {
// Skip if on dev
if(piholeVersion !== "vDev" && versionCompare(piholeVersion, json.tag_name.slice(1)) < 0) {
if(versionCompare(piholeVersion, json.tag_name.slice(1)) < 0) {
// Alert user
$("#piholeVersion").html($("#piholeVersion").text() + '<a class="alert-link" href="https://github.com/pi-hole/pi-hole/releases">(Update available!)</a>');
$("#alPiholeUpdate").show();
}
});
$.getJSON("https://api.github.com/repos/pi-hole/AdminLTE/releases/latest", function(json) {
// Skip if on dev
if(webVersion !== "vDev" && versionCompare(webVersion, json.tag_name.slice(1)) < 0) {
if(versionCompare(webVersion, json.tag_name.slice(1)) < 0) {
// Alert user
$("#webVersion").html($("#webVersion").text() + '<a class="alert-link" href="https://github.com/pi-hole/adminLTE/releases">(Update available!)</a>');
$("#alWebUpdate").show();
@@ -83,8 +93,9 @@ $.getJSON("https://api.github.com/repos/pi-hole/AdminLTE/releases/latest", funct
* Make sure that Pi-hole is updated to at least v2.7, since that is needed to use the sudo
* features of the interface. Skip if on dev
*/
if(piholeVersion !== "vDev" && versionCompare(piholeVersion, "v2.7") < 0)
alert("Pi-hole needs to be updated to at least v2.7 before you can use features such as whitelisting/blacklisting from this web interface!")
if(versionCompare(piholeVersion, "v2.7") < 0) {
alert("Pi-hole needs to be updated to at least v2.7 before you can use features such as whitelisting/blacklisting from this web interface!");
}
// Session timer
var sessionvalidity = parseInt(document.getElementById("sessiontimercounter").textContent);
+74 -6
View File
@@ -1,19 +1,87 @@
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<div class="col-sm-6 col-sm-offset-3">
<center>
<img src="img/lock.svg" width="60%">
<div class="page-header">Protected page</div>
<svg width="100%" viewBox="-60 -5 220 140" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="max-width: 400px;"><!-- " border: 1px solid black;" > -->
<defs>
<style type="text/css">
<![CDATA[
.bluranddarken{
filter: url(#bluranddarken);
}
.blurslightly{
filter: url(#blurslightly);
}
]]>
</style>
<filter id="bluranddarken">
<!-- Add blur -->
<feGaussianBlur in="SourceGraphic" stdDeviation="3,3" />
<feComponentTransfer> <!-- Make it darker -->
<feFuncR type="linear" slope="0.5"/>
<feFuncG type="linear" slope="0.5"/>
<feFuncB type="linear" slope="0.5"/>
</feComponentTransfer>
</filter>
<filter id="blurslightly">
<feGaussianBlur in="SourceGraphic" stdDeviation="2,2" />
</filter>
</defs>
<g class="bluranddarken">
<image x="0" y="0" width="100" height="100" xlink:href="img/logo.svg"/>
</g>
<g class="blurslightly">
<text font-family="Verdana" x="-18" y="130" font-size="24" class="protected">Protected area</text>
</g>
<!--
M is moveto
A is a general elliptical arc command.
L is lineto
-->
</svg>
</center>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<form action="" method="POST">
<div class="form-group <?php if($wrongpassword){ ?>has-error<?php } ?> input-group-lg">
<?php if($wrongpassword){ ?><label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> Wrong password!</label><?php } ?>
<?php if($wrongpassword){ ?><center><label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> Wrong password!</label></center><?php } ?>
<div class="input-group">
<input type="password" class="form-control" name="pw" placeholder="Enter password to continue">
<input type="password" class="form-control " name="pw" placeholder="Enter password to unlock">
<span class="input-group-btn">
<button type="submit" class="btn btn-info btn-flat <?php if($wrongpassword){ ?>btn-danger<?php } ?>">Submit</button>
</span>
</span>
</div>
</div>
</form>
</center>
</div>
</div>
<style type="text/css">
.protected {
<?php if($wrongpassword){ ?>
animation-name: color;
animation-duration: 2s;
animation-timing-function: linear;
animation-iteration-count: infinite;
<?php } ?>
}
@keyframes color {
0% {
stroke: #000;
}
50% {
stroke: #C00;
}
100% {
stroke: #000;
}
}
</style>