From ea389e1a1323feaa9c85e70b2535dc8d4473203e Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 5 Mar 2020 10:34:46 +0000 Subject: [PATCH 01/16] Add create_dnsmasq_log --- installers/common.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/installers/common.sh b/installers/common.sh index f0817664..23153e61 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -108,6 +108,13 @@ function create_hostapd_scripts() { sudo chmod 750 "$raspap_dir/hostapd/"*.sh || install_error "Unable to change file permissions" } +# Generate dnsmasq logfile +function create_dnsmasq_log() { + install_log "Creating dnsmasq logfile" + sudo touch /tmp/dnsmasq.log || install_error "Unable to create logfile /tmp/dnsmasq.log" + sudo chown dnsmasq:"$raspap_user" /tmp/dnsmasq.log || install_error "Unable to change file ownership" +} + # Generate lighttpd service control scripts function create_lighttpd_scripts() { install_log "Creating lighttpd control scripts" @@ -440,6 +447,7 @@ function install_raspap() { download_latest_files change_file_ownership create_hostapd_scripts + create_dnsmasq_log create_lighttpd_scripts move_config_file default_configuration From 90b922c43215df3a2cc39a4b43053a00c4e8f31d Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 5 Mar 2020 10:35:40 +0000 Subject: [PATCH 02/16] Update with dnsmasq logfile output --- includes/dhcp.php | 8 +++++++- templates/dhcp.php | 45 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/includes/dhcp.php b/includes/dhcp.php index 007a89a8..b1838214 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -65,7 +65,12 @@ function DisplayDHCPConfig() foreach ($_POST['server'] as $server) { $config .= "server=$server".PHP_EOL; } - + if ($_POST['log-dhcp'] == "1") { + $config .= "log-dhcp".PHP_EOL; + } + if ($_POST['log-queries'] == "1") { + $config .= "log-queries".PHP_EOL; + } if ($_POST['DNS1']) { $config .= "dhcp-option=6," . $_POST['DNS1']; if ($_POST['DNS2']) { @@ -74,6 +79,7 @@ function DisplayDHCPConfig() $config .= PHP_EOL; } + $config .= "log-facility=/tmp/dnsmasq.log".PHP_EOL; $config .= "conf-dir=/etc/dnsmasq.d".PHP_EOL; file_put_contents("/tmp/dnsmasqdata", $config); diff --git a/templates/dhcp.php b/templates/dhcp.php index 5b15a23c..3ec22cec 100755 --- a/templates/dhcp.php +++ b/templates/dhcp.php @@ -35,6 +35,7 @@ +
@@ -96,7 +97,7 @@
- + @@ -163,15 +164,29 @@ - - +
+
+
+

+ +

+
+ aria-describedby="log-dhcp-requests"> + +
+
+ aria-describedby="log-dhcp-queries"> + +
+
+

Client list

-
+
@@ -203,7 +218,10 @@
+
+

+
@@ -221,7 +239,7 @@
-

+
" class="form-control" autofocus="autofocus"> @@ -233,6 +251,7 @@
+
- + + +
+

+
+
+ '.htmlspecialchars($log, ENT_QUOTES).''; + ?> +
+
+
+ +
From ddd8b53fdfabfc6d52478fa218bc98bd483159bf Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 5 Mar 2020 12:43:14 +0000 Subject: [PATCH 03/16] Minor: label change --- templates/dhcp.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/templates/dhcp.php b/templates/dhcp.php index 3ec22cec..a8df0a5d 100755 --- a/templates/dhcp.php +++ b/templates/dhcp.php @@ -35,7 +35,7 @@ - +
@@ -97,11 +97,8 @@
- -
-
@@ -166,7 +163,7 @@
-
+

From cff02c86fbf6bc6110ff0afd14e0ae6f5f54b397 Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 5 Mar 2020 18:34:21 +0000 Subject: [PATCH 04/16] Update rc.local to set log ownership. Resolves #518 --- installers/common.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/installers/common.sh b/installers/common.sh index 23153e61..b291b769 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -252,6 +252,8 @@ function default_configuration() { 'echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward #RASPAP' 'iptables -t nat -A POSTROUTING -j MASQUERADE #RASPAP' 'iptables -t nat -A POSTROUTING -s 192.168.50.0\/24 ! -d 192.168.50.0\/24 -j MASQUERADE #RASPAP' + 'chown dnsmasq:www-data /tmp/dnsmasq.log #RASPAP' + 'chown root:www-data /tmp/hostapd.log #RASPAP' ) for line in "${lines[@]}"; do From c6fe7ebe36ebd0fa46fc6c3d1682b56e50d9ee04 Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 5 Mar 2020 21:47:46 +0000 Subject: [PATCH 05/16] Minor: update comment block --- installers/raspbian.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installers/raspbian.sh b/installers/raspbian.sh index 3dc41a45..ea828999 100755 --- a/installers/raspbian.sh +++ b/installers/raspbian.sh @@ -24,9 +24,9 @@ # Depending on options passed to the installer, ONE of the following # additional shell scripts will be downloaded and sourced: # -# https://raw.githubusercontent.com/billz/raspap-webgui/installers/common.sh +# https://raw.githubusercontent.com/billz/raspap-webgui/master/installers/common.sh # - or - -# https://raw.githubusercontent.com/billz/raspap-webgui/installers/mkcert.sh +# https://raw.githubusercontent.com/billz/raspap-webgui/master/installers/mkcert.sh # Set defaults repo="billz/raspap-webgui" From 67eefdcf0591faa6a6f77c3c4f7e53528dbde0c6 Mon Sep 17 00:00:00 2001 From: glaszig Date: Fri, 6 Mar 2020 16:26:23 +0100 Subject: [PATCH 06/16] fixed dhcp template markup there was one closing div too many leading to empty content area when nav is collapsed --- templates/dhcp.php | 518 +++++++++++++++++++++++---------------------- 1 file changed, 262 insertions(+), 256 deletions(-) diff --git a/templates/dhcp.php b/templates/dhcp.php index a8df0a5d..64b11b67 100755 --- a/templates/dhcp.php +++ b/templates/dhcp.php @@ -10,282 +10,288 @@
-
-
-
-
-
- -
-
- -
-
-
-
- showMessages(); ?> -
- - - - -
-
-

DHCP server settings

-
-
- - -
-
-
-
- - -
-
+
+
-
-
- - -
-
- -
-
- - -
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
- -
- - -
- -
-
-
- -
- -
- aria-describedby="no-resolv-description"> - -
-

- send DNS queries to the servers configured below exclusively. By default RaspAP also uses its upstream DHCP server's name servers.") ?> -
no-resolv to the dnsmasq configuration.") ?> -

+
+
+
+
+
+ +
+
+
-
- -
- -
- +
+ showMessages(); ?> + + + + + + + +
+ +
+

DHCP server settings

+
+
+ +
- -
- -
- -
- "> -
- +
+
+ + +
-
-

- - - ]/[domain/]][[#][@|[#]]"); ?> - -

- -
-
- -
+
+
+ + +
+
-
-
-
-

- -

-
- aria-describedby="log-dhcp-requests"> - -
-
- aria-describedby="log-dhcp-queries"> - -
-
-
-
+
+
+ + +
+
+ + +
+
-
-

Client list

-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
-
+
+
+ + +
+
- -
-

+
+
+ + +
+
-
- - -
-
- " class="form-control"> +
+ + +
+ +
+
+
+ +
+ +
+ aria-describedby="no-resolv-description"> + +
+

+ send DNS queries to the servers configured below exclusively. By default RaspAP also uses its upstream DHCP server's name servers.") ?> +
no-resolv to the dnsmasq configuration.") ?> +

+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ "> +
+ +
+
+

+ + + ]/[domain/]][[#][@|[#]]"); ?> + +

+ +
+
+ + +
+ +
+
+
+

+ +

+
+ aria-describedby="log-dhcp-requests"> + +
+
+ aria-describedby="log-dhcp-queries"> + +
+
+
+ +
+ +
+

Client list

+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+ + +
+

+ +
+ + +
+
+ " class="form-control"> +
+
+ " class="form-control"> +
+
+ +
+
+ +
+ +
+
+
+ " class="form-control" autofocus="autofocus">
- " class="form-control"> + " class="form-control">
- +
-
- -
+
+
-
-
-
- " class="form-control" autofocus="autofocus"> -
-
- " class="form-control"> -
-
- -
-
-
- - + - -
-

-
-
- '.htmlspecialchars($log, ENT_QUOTES).''; - ?> -
-
-
+ +
+

+
+
+ '.htmlspecialchars($log, ENT_QUOTES).''; + ?> +
+
+
- +
-
+ + +
-
- -
- -
-
+ + +
+
From 287bfcb5686fc413ee43c861cce38dd4bb079a25 Mon Sep 17 00:00:00 2001 From: glaszig Date: Fri, 6 Mar 2020 16:39:24 +0100 Subject: [PATCH 07/16] dhcp: moved logging-related controls to logging tab --- templates/dhcp.php | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/templates/dhcp.php b/templates/dhcp.php index 64b11b67..3b6f665a 100755 --- a/templates/dhcp.php +++ b/templates/dhcp.php @@ -33,7 +33,7 @@ -
-
-
-
-

- -

-
- aria-describedby="log-dhcp-requests"> - -
-
- aria-describedby="log-dhcp-queries"> - -
-
-
-
@@ -273,15 +256,22 @@
-

-
-
- '.htmlspecialchars($log, ENT_QUOTES).''; - ?> -
-
+

+

+ +
+ aria-describedby="log-dhcp-requests"> + +
+
+ aria-describedby="log-dhcp-queries"> + +
+ + '.htmlspecialchars($log, ENT_QUOTES).''; + ?>
From ad6a4b5228e7ce0c23bbdb60bb5fc6b08fd8ade2 Mon Sep 17 00:00:00 2001 From: glaszig Date: Fri, 6 Mar 2020 16:41:49 +0100 Subject: [PATCH 08/16] improved tab id --- templates/dhcp.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/dhcp.php b/templates/dhcp.php index 3b6f665a..09c46450 100755 --- a/templates/dhcp.php +++ b/templates/dhcp.php @@ -38,7 +38,7 @@ - + @@ -255,7 +255,7 @@ -
+

From 1d6b4e64687b7cafa44ae8b405ace7e3800e3eb4 Mon Sep 17 00:00:00 2001 From: glaszig Date: Fri, 6 Mar 2020 16:53:22 +0100 Subject: [PATCH 09/16] moved dhcp tab panes into partials --- templates/dhcp.php | 238 +------------------------------ templates/dhcp/advanced.php | 63 ++++++++ templates/dhcp/clients.php | 35 +++++ templates/dhcp/general.php | 59 ++++++++ templates/dhcp/logging.php | 19 +++ templates/dhcp/static_leases.php | 48 +++++++ 6 files changed, 230 insertions(+), 232 deletions(-) create mode 100644 templates/dhcp/advanced.php create mode 100644 templates/dhcp/clients.php create mode 100644 templates/dhcp/general.php create mode 100644 templates/dhcp/logging.php create mode 100644 templates/dhcp/static_leases.php diff --git a/templates/dhcp.php b/templates/dhcp.php index 09c46450..2b57586a 100755 --- a/templates/dhcp.php +++ b/templates/dhcp.php @@ -40,240 +40,14 @@ + -
- -
-

DHCP server settings

-
-
- - -
-
-
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
- -
- - -
- -
-
-
- -
- -
- aria-describedby="no-resolv-description"> - -
-

- send DNS queries to the servers configured below exclusively. By default RaspAP also uses its upstream DHCP server's name servers.") ?> -
no-resolv to the dnsmasq configuration.") ?> -

-
- -
- -
- -
- -
-
- -
- -
- -
- "> -
- -
-
-

- - - ]/[domain/]][[#][@|[#]]"); ?> - -

- -
-
- - -
- -
- -
-

Client list

-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
-
- - -
-

- -
- - -
-
- " class="form-control"> -
-
- " class="form-control"> -
-
- -
-
- -
- -
-
-
- " class="form-control" autofocus="autofocus"> -
-
- " class="form-control"> -
-
- -
-
-
- - - - - -
-

-

- -
- aria-describedby="log-dhcp-requests"> - -
-
- aria-describedby="log-dhcp-queries"> - -
- - '.htmlspecialchars($log, ENT_QUOTES).''; - ?> -
- + + + + +
diff --git a/templates/dhcp/advanced.php b/templates/dhcp/advanced.php new file mode 100644 index 00000000..6366977c --- /dev/null +++ b/templates/dhcp/advanced.php @@ -0,0 +1,63 @@ + +
+ +
+
+
+ +
+ +
+ aria-describedby="no-resolv-description"> + +
+

+ send DNS queries to the servers configured below exclusively. By default RaspAP also uses its upstream DHCP server's name servers.") ?> +
no-resolv to the dnsmasq configuration.") ?> +

+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ "> +
+ +
+
+

+ + + ]/[domain/]][[#][@|[#]]"); ?> + +

+ +
+
+ + +
+ +
diff --git a/templates/dhcp/clients.php b/templates/dhcp/clients.php new file mode 100644 index 00000000..c0d9d06d --- /dev/null +++ b/templates/dhcp/clients.php @@ -0,0 +1,35 @@ +
+

Client list

+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
diff --git a/templates/dhcp/general.php b/templates/dhcp/general.php new file mode 100644 index 00000000..e4023392 --- /dev/null +++ b/templates/dhcp/general.php @@ -0,0 +1,59 @@ +
+

DHCP server settings

+
+
+ + +
+
+
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
diff --git a/templates/dhcp/logging.php b/templates/dhcp/logging.php new file mode 100644 index 00000000..60e7166e --- /dev/null +++ b/templates/dhcp/logging.php @@ -0,0 +1,19 @@ + +
+

+

+ +
+ aria-describedby="log-dhcp-requests"> + +
+
+ aria-describedby="log-dhcp-queries"> + +
+ + '.htmlspecialchars($log, ENT_QUOTES).''; + ?> +
diff --git a/templates/dhcp/static_leases.php b/templates/dhcp/static_leases.php new file mode 100644 index 00000000..3b804270 --- /dev/null +++ b/templates/dhcp/static_leases.php @@ -0,0 +1,48 @@ + +
+

+ +
+ + +
+
+ " class="form-control"> +
+
+ " class="form-control"> +
+
+ +
+
+ +
+ +
+
+
+ " class="form-control" autofocus="autofocus"> +
+
+ " class="form-control"> +
+
+ +
+
+ + +
From 29d4653524852b81769d846c863fce9cf63c0b50 Mon Sep 17 00:00:00 2001 From: glaszig Date: Fri, 6 Mar 2020 16:54:48 +0100 Subject: [PATCH 10/16] prevent variable name collision in renderTemplate() function --- includes/functions.php | 6 +++--- templates/dhcp.php | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index c5ba1a47..e177aa52 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -271,15 +271,15 @@ function ConvertToSecurity($security) /** * Renders a simple PHP template */ -function renderTemplate($name, $data = []) +function renderTemplate($name, $__template_data = []) { $file = realpath(dirname(__FILE__) . "/../templates/$name.php"); if (!file_exists($file)) { return "template $name ($file) not found"; } - if (is_array($data)) { - extract($data); + if (is_array($__template_data)) { + extract($__template_data); } ob_start(); diff --git a/templates/dhcp.php b/templates/dhcp.php index 2b57586a..c93ab7ef 100755 --- a/templates/dhcp.php +++ b/templates/dhcp.php @@ -43,11 +43,11 @@
- - - - - + + + + +
From 88f0859955430e1f129f6bcd33b2840dac1761cb Mon Sep 17 00:00:00 2001 From: billz Date: Fri, 6 Mar 2020 18:40:47 +0000 Subject: [PATCH 11/16] Terminal theme => Lights Out --- app/css/custom.css | 8 + app/css/hackernews.css | 8 + app/css/{terminal.css => lightsout.css} | 238 ++++++++++++------------ app/js/custom.js | 2 +- includes/themes.php | 4 +- templates/about.php | 2 +- 6 files changed, 137 insertions(+), 125 deletions(-) rename app/css/{terminal.css => lightsout.css} (55%) diff --git a/app/css/custom.css b/app/css/custom.css index de7423a1..f815e50c 100644 --- a/app/css/custom.css +++ b/app/css/custom.css @@ -1,3 +1,11 @@ +/* +Theme Name: RaspAP default +Author: @billz +Author URI: https://github.com/billz +Description: Default theme for RaspAP +License: GNU General Public License v3.0 +*/ + body { color: #212529; } diff --git a/app/css/hackernews.css b/app/css/hackernews.css index c44fa01d..113b5b4c 100644 --- a/app/css/hackernews.css +++ b/app/css/hackernews.css @@ -1,3 +1,11 @@ +/* +Theme Name: HackerNews +Author: @billz +Author URI: https://github.com/billz +Description: A theme inspired by HackerNews for RaspAP +License: GNU General Public License v3.0 +*/ + html * { font-family: Verdana, Geneva, sans-serif; font-size: 0.9rem; diff --git a/app/css/terminal.css b/app/css/lightsout.css similarity index 55% rename from app/css/terminal.css rename to app/css/lightsout.css index c16270c7..1f85e51c 100644 --- a/app/css/terminal.css +++ b/app/css/lightsout.css @@ -1,7 +1,15 @@ +/* +Theme Name: Lights Out +Author: @billz +Author URI: https://github.com/billz +Description: A dark mode theme for RaspAP +License: GNU General Public License v3.0 +*/ + html * { - font-family: Courier New, Andale Mono, monospace; + font-family: Helvetica,Arial,sans-serif; font-size: 1.0rem; - color: #2bcb02; + color: #afafaf; } h4 { @@ -14,24 +22,25 @@ h5.card-title { .page-header { padding: 0 20px; - border-left: .01rem solid #2bcb02; + border-left: .01rem solid #d2d2d2; } .navbar-logo { margin-top: 0.5em; margin-left: 0.5em; + filter: brightness(70%); } .sidebar-light .nav-item.active .nav-link i { - color: #2bcb02; + color: #d2d2d2; } .sidebar .nav-item.active .nav-link { - font-weight: 700; + font-weight: 400; } #wrapper #content-wrapper #content { - background-color: #000; + background-color: #202020; } /* Small devices (portait phones, up to 576px) */ @@ -46,129 +55,110 @@ h5.card-title { } .topbar { - background-color: #000; + background-color: #202020; } +.nav-tabs { + border-bottom: 1px solid #404040; +} .nav-tabs .nav-link.active, .nav-tabs .nav-link { font-size: 1.0rem; } -.nav-tabs>li.active>a, -.nav-tabs>li.active>a:focus, -.nav-tabs>li.active>a:hover, -.nav-tabs .nav-link:hover, -.input-group-addon { - color: #2bcb02; - cursor: default; - background-color: #000; - border: .01rem solid #2bcb02; - border-bottom-color: #2bcb02; - border-radius: inherit; +.nav-tabs .nav-link:hover { + border-color: transparent; } -.nav-tabs>li>a,.nav-tabs>li>a:hover { - border: .01rem solid #2bcb02; -} - -.nav-tabs { - border-bottom: .01rem solid #2bcb02; -} - -.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { - color: #2bcb02; + color: #d2d2d2; } .navbar-default .navbar-toggle { - border-color: #2bcb02; + border-color: #d2d2d2; } .navbar-default .navbar-toggle .icon-bar { - background-color: #2bcb02; + background-color: #d2d2d2; } .navbar-default .navbar-toggle:focus, .navbar-default .navbar-toggle:hover { - background-color: #000; + background-color: #202020; } .nav-tabs .nav-link.active { - color: #000; - background-color: #2bcb02; - border-color: #2bcb02; - border-radius: inherit; -} - -.sidebar-brand-icon { - filter: invert(65%) sepia(900%) saturate(536%) hue-rotate(68deg) brightness(100%) contrast(120%); + color: #d2d2d2; + background-color: #141414; + border-color: #404040 #404040 #141414; } a:focus, a:hover { - color: #2bcb02; + color: #d2d2d2; } .card>.card-header { - border-color: #2bcb02; - background-color: #2bcb02; - color: #000; - border-radius: unset; + border-color: #404040; + background-color: #202020; + color: #202020; + border-top-right-radius: 3px; + border-top-left-radius: 3px; font-size: 1.1rem; - font-weight: bold; + font-weight: 400; } .card>.card-header .fa { - color: #000; + color: #202020; } .card-header [class^="fa"] { - color: #000; + color: #afafaf; font-size: 1.0rem; } .col { - color: #000; + color: #afafaf; } .card, .card-body { - margin-bottom: 20px; - border: .01rem solid #2bcb02; - border-radius: 0px; - background-color: #000; + border-color: #343434; + border-radius: 3px; + background-color: #141414; } hr { - border-top: .01rem solid #2bcb02; + border-top: .01rem solid #d2d2d2; } .page-header { font-size: 24pt; margin: 10px 0 20px; - border-bottom: .01rem solid #2bcb02; + border-bottom: .01rem solid #d2d2d2; } .sidebar-brand-text { text-transform: none; - color: #2bcb02; + color: #ac1b3d; font-size: 2.0rem; font-weight: 500; font-family: inherit; } .sidebar-light #sidebarToggle { - background-color: #2bcb02; + background-color: #202020; + border: 1px solid #eaecf4 !important } .sidebar-light #sidebarToggle::after { - color: #000; + color: #eaecf4; } .sidebar-light .nav-item .nav-link:hover i { - color: #81ff61; + color: #d2d2d2; } .sidebar-light #sidebarToggle:hover { - background-color: #81ff61; + background-color: #202020; } .sidebar.toggled .nav-item .nav-link span { @@ -182,8 +172,8 @@ hr { } .card-footer { - background-color: #000; - border-top: .01rem solid #2bcb02; + background-color: #202020; + border-top: 0px; } .card>.card-header::before, .navbar-default::before { @@ -194,30 +184,35 @@ hr { left: 0; bottom: 0; right: 0; - background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06)); z-index: 2; background-size: 100% 2px, 3px 100%; pointer-events: none; } .sidebar-light, .sticky-footer { - background-color: #000; + background-color: #202020; } .sidebar-light .nav-item .nav-link i { - color: #2bcb02; + color: rgba(230, 230, 230, .3); } .sidebar .nav-item .nav-link { padding: 0.6rem; + padding-left: 1.2rem; } .sidebar-light hr.sidebar-divider { - border-top: .01rem solid #2bcb02; + border-top: 1px solid #404040; + padding-top: 0.5rem; +} + +.sidebar .nav-item .nav-link span { + font-size: 1.0rem; } .topbar .topbar-divider { - border-right: .01rem solid #2bcb02; + border-right: 1px solid #404040; } .info-item { @@ -226,9 +221,9 @@ hr { } .info-item-xs { - font-family: Verdana, Arial, sans-serif; font-size: 0.7rem; - margin-left: 0.3rem; + line-height: 1.5em; + margin-left: 0.5rem; } .info-item-wifi { @@ -237,11 +232,11 @@ hr { } .label-warning { - background-color: #2bcb02; + background-color: #d2d2d2; } span.label.label-warning { - color: #000; + color: #202020; } .table>tbody>tr>td, @@ -250,29 +245,27 @@ span.label.label-warning { .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th { - background-color: #000; - border-top: .01rem solid #000; + background-color: #202020; + border-top: .01rem solid #202020; } .table>thead>tr>th { vertical-align: bottom; - border-bottom: .01rem solid #2bcb02; + border-bottom: .01rem solid #d2d2d2; } [class*="btn"], [class*="btn"]:focus, [class*="btn"]:disabled { - background-color: #000; - border-color: #2bcb02; - border-color: #2bcb02; - border-radius: 0px; - color: #2bcb02; + background-color: #202020; + border-color: #404040; + border-radius: 3px; + color: #d2d2d2; } [class*="btn"]:hover { - background-color: #81ff61; - border-color: #81ff61; - border-color: #81ff61; - border-radius: 0px; - color: #000; + border-radius: 3px; + color: #d2d2d2; + background-color: #202020; + border-color: #afafaf; } [class*="btn"]:hover .disabled { @@ -281,72 +274,67 @@ span.label.label-warning { [class*="alert"] { border-radius: 0px; - color: #2bcb02; - background-color: #000; - border-color: #2bcb02; + color: #d2d2d2; + background-color: #202020; + border-color: #d2d2d2; border: 1px dashed; } .close { font-size: 18px; font-weight: normal; - text-shadow: 0 0px 0 #000; + text-shadow: 0 0px 0 #202020; opacity: 1; } .form-control, .form-control:focus { - color: #2bcb02; - background-color: #000; - border: .01rem solid #2bcb02; - border-radius: 0px; - transition: unset; + color: #d2d2d2; + background-color: #202020; + border: 1px solid #404040; + border-radius: 3px; } .form-control:disabled, .form-control[readonly] { - background-color: #000; + background-color: #202020; opacity: 0.5; } -.form-control::-webkit-input-placeholder { color: #2bcb02; } -.form-control:-moz-placeholder { color: #2bcb02; } -.form-control::-moz-placeholder { color: #2bcb02; } -.form-control:-ms-input-placeholder { color: #2bcb02; } -.form-control::-ms-input-placeholder { color: #2bcb02; } +.form-control::-webkit-input-placeholder { color: #d2d2d2; } +.form-control:-moz-placeholder { color: #d2d2d2; } +.form-control::-moz-placeholder { color: #d2d2d2; } +.form-control:-ms-input-placeholder { color: #d2d2d2; } +.form-control::-ms-input-placeholder { color: #d2d2d2; } input[type="text"]{ -color: #2bcb02 !important +color: #d2d2d2 !important } .progress { - background-color: #000; + background-color: #202020; border-radius: 0px; } .progress-bar { - color: #000; + color: #202020; } .progress-bar.progress-bar-info.progress-bar-striped.active { - background-color: #2bcb02; + background-color: #d2d2d2; } .logoutput { width: 100%; height: 300px; - background-color: #000; - border-color: #2bcb02; + background-color: #202020; + border-color: #404040; } .webconsole { width: 100%; - height: 100%; - border-color: #2bcb02; - border-bottom: .01rem solid; - border-left: .01rem solid; - border-top: 0px; - border-right: .01rem solid; + height: 20rem; + border: 1px solid #404040; } #console { @@ -354,11 +342,7 @@ color: #2bcb02 !important } tspan, rect { - fill: #2bcb02; -} - -.service-status { - border-width: 0; + fill: #d2d2d2; } span.text.service-status { @@ -366,16 +350,24 @@ span.text.service-status { margin-top: 0.2rem; } +.text-muted { + font-size: 0.8rem; +} + .fas.fa-circle { font-size: 0.5rem; } -i.fas.fa-circle.service-status-up { - color: #2bcb02; +.service-status-up { + color: #a1ec38 !important; } -i.fas.fa-circle.service-status-down { - color: #2bcb02; +.service-status-warn { + color: #f6f044 !important; +} + +.service-status-down { + color: #f80107 !important; animation: flash 1s linear infinite; } @keyframes flash { @@ -385,8 +377,8 @@ i.fas.fa-circle.service-status-down { } pre { - background-color: #000; - border: #000; + background-color: #202020; + border: #202020; } .dhcp-static-leases { @@ -420,3 +412,7 @@ canvas#divDBChartBandwidthhourly { .table { margin-bottom: 0rem; } + +.figure, .authors { + filter: brightness(70%) !important; +} diff --git a/app/js/custom.js b/app/js/custom.js index adc019cb..73adfa06 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -356,7 +356,7 @@ function getCookie(cname) { var themes = { "default": "custom.css", "hackernews" : "hackernews.css", - "terminal" : "terminal.css", + "lightsout" : "lightsout.css", } // Toggles the sidebar navigation. diff --git a/includes/themes.php b/includes/themes.php index 0df4e296..7dde1824 100755 --- a/includes/themes.php +++ b/includes/themes.php @@ -8,12 +8,12 @@ function DisplayThemeConfig() $themes = [ "default" => "RaspAP (default)", "hackernews" => "HackerNews", - "terminal" => "Terminal" + "lightsout" => "Lights Out" ]; $themeFiles = [ "default" => "custom.css", "hackernews" => "hackernews.css", - "terminal" => "terminal.css" + "lightsout" => "lightsout.css" ]; $selectedTheme = array_search($_COOKIE['theme'], $themeFiles); diff --git a/templates/about.php b/templates/about.php index f5c542d1..a52d6818 100755 --- a/templates/about.php +++ b/templates/about.php @@ -11,7 +11,7 @@

GNU General Public License v3.0
-

+

RaspAP is a co-creation of @billz and @SirLagz
with the contributions of our community.

https://github.com/billz/raspap-webgui

From 51e736c79b2340a909aa1ed4bedfb17ff14d250f Mon Sep 17 00:00:00 2001 From: billz Date: Fri, 6 Mar 2020 18:57:16 +0000 Subject: [PATCH 12/16] Update for dark theme --- app/js/linkquality.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/js/linkquality.js b/app/js/linkquality.js index 2de34512..40f87a7c 100644 --- a/app/js/linkquality.js +++ b/app/js/linkquality.js @@ -1,12 +1,12 @@ // Link quality gauge for ChartJS -// Support for dark terminal theme +// Support for dark theme theme = getCookie('theme'); -if (theme == 'terminal.css') { - var bgColor1 = '#000'; - var bgColor2 = '#000'; - var borderColor = 'rgba(46, 230, 0, 1)'; - var labelColor = 'rgba(46, 230, 0, 1)'; +if (theme == 'lightsout.css') { + var bgColor1 = '#141414'; + var bgColor2 = '#141414'; + var borderColor = 'rgba(37, 153, 63, 1)'; + var labelColor = 'rgba(37, 153, 63, 1)'; } else { var bgColor1 = '#d4edda'; var bgColor2 = '#eaecf4'; From 227fc3d775003ba7212ffef1b0f1579ae4ca3813 Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 7 Mar 2020 07:07:55 +0000 Subject: [PATCH 13/16] Dark mode style tweak --- app/css/lightsout.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/css/lightsout.css b/app/css/lightsout.css index 1f85e51c..dfb92517 100644 --- a/app/css/lightsout.css +++ b/app/css/lightsout.css @@ -146,11 +146,11 @@ hr { .sidebar-light #sidebarToggle { background-color: #202020; - border: 1px solid #eaecf4 !important + border: 1px solid #afafaf !important } .sidebar-light #sidebarToggle::after { - color: #eaecf4; + color: #afafaf; } .sidebar-light .nav-item .nav-link:hover i { From 1b87d57af43f6c68f9e7320641c7083107fe5be9 Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 7 Mar 2020 09:17:02 +0000 Subject: [PATCH 14/16] Bugfix: Escape backslashes --- installers/common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index b291b769..576c0f07 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -252,8 +252,8 @@ function default_configuration() { 'echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward #RASPAP' 'iptables -t nat -A POSTROUTING -j MASQUERADE #RASPAP' 'iptables -t nat -A POSTROUTING -s 192.168.50.0\/24 ! -d 192.168.50.0\/24 -j MASQUERADE #RASPAP' - 'chown dnsmasq:www-data /tmp/dnsmasq.log #RASPAP' - 'chown root:www-data /tmp/hostapd.log #RASPAP' + 'chown dnsmasq:www-data \/tmp\/dnsmasq.log #RASPAP' + 'chown root:www-data \/tmp\/hostapd.log #RASPAP' ) for line in "${lines[@]}"; do From c44d58d51bd2c2da2cdebb09653d00dd1f834cc8 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 8 Mar 2020 17:40:40 +0000 Subject: [PATCH 15/16] Stats display for the Adafruit Mini PiTFT --- app/pitft/stats.py | 98 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 app/pitft/stats.py diff --git a/app/pitft/stats.py b/app/pitft/stats.py new file mode 100644 index 00000000..ba8a3648 --- /dev/null +++ b/app/pitft/stats.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +# +# Author: @billz +# Author URI: https://github.com/billz +# Description: RaspAP stats display for the Adafruit Mini PiTFT, +# a 135x240 Color TFT add-on for the Raspberry Pi. +# Based on Adafruit's rgb_display_ministats.py +# See: https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display +# License: MIT License + +import time +import subprocess +import digitalio +import board +from PIL import Image, ImageDraw, ImageFont +import adafruit_rgb_display.st7789 as st7789 + +# Configuration for CS and DC pins +cs_pin = digitalio.DigitalInOut(board.CE0) +dc_pin = digitalio.DigitalInOut(board.D25) +reset_pin = None + +# Config for display baudrate (default max is 24mhz) +BAUDRATE = 64000000 + +# Setup SPI bus using hardware SPI +spi = board.SPI() + +# Create the ST7789 display +disp = st7789.ST7789(spi, cs=cs_pin, dc=dc_pin, rst=reset_pin, baudrate=BAUDRATE, + width=135, height=240, x_offset=53, y_offset=40) + +# Create blank image with mode 'RGB' +height = disp.width # swap height/width to rotate it to landscape +width = disp.height +image = Image.new('RGB', (width, height)) +rotation = 90 + +# Get a drawing object and clear the image +draw = ImageDraw.Draw(image) +draw.rectangle((0, 0, width, height), outline=0, fill=(0, 0, 0)) +disp.image(image,rotation) + +# Define some constants +padding = -2 +top = padding +bottom = height-padding +# Move left to right keeping track of the current x position +x = 0 + +# Load DejaVu TTF Font +# Install with: sudo apt-get install ttf-dejavu +font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', 24) + +# Turn on the backlight +backlight = digitalio.DigitalInOut(board.D22) +backlight.switch_to_output() +backlight.value = True + +while True: + # Draw a black filled box to clear the image + draw.rectangle((0, 0, width, height), outline=0, fill=0) + + # Collect basic system stats + cmd = "hostname -I | cut -d\' \' -f1" + IP = "IP: "+subprocess.check_output(cmd, shell=True).decode("utf-8") + + cmd = "pidof hostapd | wc -l | awk '{printf \"Hotspot: %s\", $1 == 1 ? \"Active\" : \"Down\"}'" + Hostapd = subprocess.check_output(cmd, shell=True).decode("utf-8") + + cmd = "vnstat -i wlan0 | grep tx: | awk '{printf \"Data Tx: %d %s\", $5,$6}'" + DataTx = subprocess.check_output(cmd, shell=True).decode("utf-8") + + cmd = "top -bn1 | grep load | awk '{printf \"CPU Load: %.2f\", $(NF-2)}'" + CPU = subprocess.check_output(cmd, shell=True).decode("utf-8") + + cmd = "free -m | awk 'NR==2{printf \"Mem: %sMB %.2f%%\", $3,$3*100/$2 }'" + MemUsage = subprocess.check_output(cmd, shell=True).decode("utf-8") + + cmd = "cat /sys/class/thermal/thermal_zone0/temp | awk \'{printf \"CPU Temp: %.1f C\", $(NF-0) / 1000}\'" # pylint: disable=line-too-long + Temp = subprocess.check_output(cmd, shell=True).decode("utf-8") + + # Write five lines of stats + y = top + draw.text((x, y), IP, font=font, fill="#ffaaaa") + y += font.getsize(IP)[1] + draw.text((x, y), Hostapd, font=font, fill="#d46a6a") + y += font.getsize(Hostapd)[1] + draw.text((x, y), DataTx, font=font, fill="#aa3939") + y += font.getsize(DataTx)[1] + draw.text((x, y), MemUsage, font=font, fill="#801515") + y += font.getsize(MemUsage)[1] + draw.text((x, y), Temp, font=font, fill="#550000") + + # Display image + disp.image(image, rotation) + time.sleep(.1) + From 57bcb793100ddc59d0fa7c999690c34ee604ab1a Mon Sep 17 00:00:00 2001 From: Taikuh Date: Mon, 9 Mar 2020 20:11:11 +0800 Subject: [PATCH 16/16] download_latest_files follows quick installer --- installers/common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installers/common.sh b/installers/common.sh index 576c0f07..c4b5e74e 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -8,6 +8,7 @@ raspap_dir="/etc/raspap" raspap_user="www-data" webroot_dir="/var/www/html" version=`sed 's/\..*//' /etc/debian_version` +git_source_url="https://github.com/$repo" # $repo from install.raspap.com # Determine Raspbian version, set default home location for lighttpd and # php package to install @@ -176,7 +177,7 @@ function download_latest_files() { fi install_log "Cloning latest files from github" - git clone --depth 1 https://github.com/billz/raspap-webgui /tmp/raspap-webgui || install_error "Unable to download files from github" + git clone --branch $branch --depth 1 $git_source_url /tmp/raspap-webgui || install_error "Unable to download files from github" sudo mv /tmp/raspap-webgui $webroot_dir || install_error "Unable to move raspap-webgui to web root" }