From 871d5353a5a26c21be880f90745f5acad764bbae Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 21 Feb 2021 10:28:55 +0000 Subject: [PATCH 1/7] Update br0 dhcpcd sequence, thx @lifros --- includes/hostapd.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index 9aeb59e2..43e04bd1 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -306,8 +306,8 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) if ($bridgedEnable == 1) { $config = array_keys(getDefaultNetOpts('dhcp')); $config[] = PHP_EOL.'# RaspAP br0 configuration'; - $config[] = 'interface br0'; $config[] = 'denyinterfaces eth0 wlan0'; + $config[] = 'interface br0'; $config[] = PHP_EOL; } elseif ($wifiAPEnable == 1) { $config = array_keys(getDefaultNetOpts('dhcp')); From 1eec097b804054f84bf05709420d1e7a15e2b590 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 22 Feb 2021 09:47:25 +0000 Subject: [PATCH 2/7] Bugfix: Parse dhcp-host entries --- includes/dhcp.php | 7 +++++-- templates/dhcp/static_leases.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/dhcp.php b/includes/dhcp.php index 0ebf641b..bc323200 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -45,12 +45,15 @@ function DisplayDHCPConfig() } } getWifiInterface(); + $ap_iface = $_SESSION['ap_interface']; $serviceStatus = $dnsmasq_state ? "up" : "down"; exec('cat '. RASPI_DNSMASQ_PREFIX.'raspap.conf', $return); $conf = ParseConfig($return); + exec('cat '. RASPI_DNSMASQ_PREFIX.$ap_iface.'.conf', $return); + $conf = array_merge(ParseConfig($return)); + $hosts = (array)$conf['dhcp-host']; exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces); exec('cat ' . RASPI_DNSMASQ_LEASES, $leases); - $ap_iface = $_SESSION['ap_interface']; echo renderTemplate( "dhcp", compact( @@ -59,7 +62,7 @@ function DisplayDHCPConfig() "dnsmasq_state", "ap_iface", "conf", - "dhcpHost", + "hosts", "interfaces", "leases" ) diff --git a/templates/dhcp/static_leases.php b/templates/dhcp/static_leases.php index 3b804270..638ff064 100644 --- a/templates/dhcp/static_leases.php +++ b/templates/dhcp/static_leases.php @@ -3,7 +3,7 @@

- +
From 109c4f84d5c6263851f5faf0ad0d6456dc6dbd6d Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 22 Feb 2021 09:49:24 +0000 Subject: [PATCH 3/7] Update features list --- BACKERS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BACKERS.md b/BACKERS.md index 6c51208d..8ea2c184 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -19,6 +19,8 @@ When backers were asked which feature they'd most like to see added to RaspAP, t ✅ Multiple OpenVPN client configs ✅ OpenVPN service logging +✅ Night mode toggle +✅ Restrict network to static clients ⚙️ Traffic shaping (in progress) Look for the list above to grow as we add more exclusive features. @@ -29,6 +31,8 @@ Below is a list of funding targets. When a funding target is reached, the featur #### $500 ✅ Multiple OpenVPN client configs ✅ OpenVPN service logging +✅ Night mode toggle +✅ Restrict network to static clients ⚙️ Traffic shaping (in progress) ### Frequently asked questions From 54b9d7ec5e0679effb5ad3c42678010f32038d66 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 22 Feb 2021 12:02:12 +0000 Subject: [PATCH 4/7] Update release version --- README.md | 2 +- includes/defaults.php | 2 +- index.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0ee055e1..4ceebd7a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![](https://i.imgur.com/xeKD93p.png) -[![Release 2.6.1](https://img.shields.io/badge/release-v2.6.1-green)](https://github.com/raspap/raspap-webgui/releases) [![Awesome](https://awesome.re/badge.svg)](https://github.com/thibmaek/awesome-raspberry-pi) [![Financial Contributors on Open Collective](https://opencollective.com/raspap/all/badge.svg?label=financial+contributors)](https://opencollective.com/raspap) ![https://travis-ci.com/github/raspap/raspap-webgui/](https://api.travis-ci.org/RaspAP/raspap-webgui.svg) [![Crowdin](https://badges.crowdin.net/raspap/localized.svg)](https://crowdin.com/project/raspap) [![Twitter URL](https://img.shields.io/twitter/url?label=%40RaspAP&logoColor=%23d8224c&url=https%3A%2F%2Ftwitter.com%2Frasp_ap)](https://twitter.com/rasp_ap) [![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/RaspAP?style=social)](https://www.reddit.com/r/RaspAP/) +[![Release 2.6.2](https://img.shields.io/badge/release-v2.6.2-green)](https://github.com/raspap/raspap-webgui/releases) [![Awesome](https://awesome.re/badge.svg)](https://github.com/thibmaek/awesome-raspberry-pi) [![Financial Contributors on Open Collective](https://opencollective.com/raspap/all/badge.svg?label=financial+contributors)](https://opencollective.com/raspap) ![https://travis-ci.com/github/raspap/raspap-webgui/](https://api.travis-ci.org/RaspAP/raspap-webgui.svg) [![Crowdin](https://badges.crowdin.net/raspap/localized.svg)](https://crowdin.com/project/raspap) [![Twitter URL](https://img.shields.io/twitter/url?label=%40RaspAP&logoColor=%23d8224c&url=https%3A%2F%2Ftwitter.com%2Frasp_ap)](https://twitter.com/rasp_ap) [![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/RaspAP?style=social)](https://www.reddit.com/r/RaspAP/) RaspAP lets you quickly get a wireless access point up and running to share the connectivity of many popular [Debian-based devices](#supported-operating-systems), including the Raspberry Pi. Our popular [Quick installer](#quick-installer) creates a known-good default configuration that "just works" on all current Raspberry Pis with onboard wireless. A responsive interface gives you control over the relevant services and networking options. Advanced DHCP settings, OpenVPN client support, SSL, security audits, themes and multilingual options are included. diff --git a/includes/defaults.php b/includes/defaults.php index 89fdb759..dfdb7ccb 100755 --- a/includes/defaults.php +++ b/includes/defaults.php @@ -6,7 +6,7 @@ if (!defined('RASPI_CONFIG')) { $defaults = [ 'RASPI_BRAND_TEXT' => 'RaspAP', - 'RASPI_VERSION' => '2.6.1', + 'RASPI_VERSION' => '2.6.2', 'RASPI_CONFIG_NETWORK' => RASPI_CONFIG.'/networking/defaults.json', 'RASPI_ADMIN_DETAILS' => RASPI_CONFIG.'/raspap.auth', 'RASPI_WIFI_AP_INTERFACE' => 'wlan0', diff --git a/index.php b/index.php index d0884831..87b0c8b8 100755 --- a/index.php +++ b/index.php @@ -14,7 +14,7 @@ * @author Lawrence Yau * @author Bill Zimmerman * @license GNU General Public License, version 3 (GPL-3.0) - * @version 2.6.1 + * @version 2.6.2 * @link https://github.com/raspap/raspap-webgui/ * @link https://raspap.com/ * @see http://sirlagz.net/2013/02/08/raspap-webgui/ From d6570cbc41fb834ffdfa1939d0d626f9615b1f95 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 22 Feb 2021 16:08:24 +0000 Subject: [PATCH 5/7] Update install loader --- installers/raspbian.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/installers/raspbian.sh b/installers/raspbian.sh index 4b8011fd..469fff7f 100755 --- a/installers/raspbian.sh +++ b/installers/raspbian.sh @@ -17,9 +17,10 @@ # -a, --adblock Used with -y, --yes, sets Adblock install option (0=no install) # -r, --repo, --repository Overrides the default GitHub repo (raspap/raspap-webgui) # -b, --branch Overrides the default git branch (master) -# -h, --help Outputs usage notes and exits # -u, --upgrade Upgrades an existing installation to the latest release version +# -i, --insiders Installs from the Insiders Edition (raspap/raspap-insiders) # -v, --version Outputs release info and exits +# -h, --help Outputs usage notes and exits # # Depending on options passed to the installer, ONE of the following # additional shell scripts will be downloaded and sourced: @@ -81,6 +82,9 @@ function _parse_params() { -u|--upgrade) upgrade=1 ;; + -i|--insiders) + repo="raspap/raspap-insiders" + ;; -v|--version) _version ;; @@ -126,6 +130,7 @@ OPTIONS: -r, --repo, --repository Overrides the default GitHub repo (raspap/raspap-webgui) -b, --branch Overrides the default git branch (latest release) -u, --upgrade Upgrades an existing installation to the latest release version +-i, --insiders Installs from the Insiders Edition (raspap/raspap-insiders) -v, --version Outputs release info and exits -h, --help Outputs usage notes and exits @@ -139,13 +144,16 @@ Examples: Invoke installer remotely, run non-interactively with option flags: curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 1 --adblock 0 + Invoke remotely, uprgrade an existing install to the Insiders Edition: + curl -sL https://install.raspap.com | bash -s -- --upgrade --insiders + EOF exit } function _version() { _get_release - echo -e "RaspAP v${RASPAP_LATEST} - Simple AP setup & WiFi management for Debian-based devices" + echo -e "RaspAP v${RASPAP_LATEST} - Simple wireless AP setup & management for Debian-based devices" exit } @@ -166,7 +174,12 @@ function _display_welcome() { # Fetch latest release from GitHub API function _get_release() { - readonly RASPAP_LATEST=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' ) + if [ "$repo" == "raspap/raspap-insiders" ]; then + readonly RASPAP_LATEST="Insiders" + branch="master" + else + readonly RASPAP_LATEST=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' ) + fi } # Outputs a RaspAP Install log line From 33ac6d26cf3f01bb92eb69a55a3848492225cb4b Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 2 Mar 2021 14:37:50 +0000 Subject: [PATCH 6/7] Fix for #803 by @mp035 --- config/50-raspap-router.conf | 8 ++++---- installers/common.sh | 22 +++++++++++++++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/config/50-raspap-router.conf b/config/50-raspap-router.conf index 31ac6b1a..c7634436 100644 --- a/config/50-raspap-router.conf +++ b/config/50-raspap-router.conf @@ -2,8 +2,8 @@ server.modules += ( "mod_rewrite", ) -$HTTP["url"] =~ "^/(?!(dist|app|ajax|config)).*" { - url.rewrite-once = ( - "^/[^\?]*(\?.*)?" => "/index.php$1" - ) +$HTTP["url"] =~ "^/REPLACE_ME/(?!(dist|app|ajax|config)).*" { + url.rewrite-once = ( "^/REPLACE_ME/(.*?)(\?.+)?$"=>"/REPLACE_ME/index.php/$1?$2" ) + server.error-handler-404 = "/REPLACE_ME/index.php" } + diff --git a/installers/common.sh b/installers/common.sh index cf3883e1..dba8a0b9 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -208,14 +208,30 @@ function _install_lighttpd_configs() { # Copy config files echo "Copying 50-raspap-router.conf to /etc/lighttpd/conf-available" - sudo cp "$webroot_dir/config/50-raspap-router.conf" "/etc/lighttpd/conf-available" || _install_status 1 "Unable to copy lighttpd config file." + + CONFSRC="$webroot_dir/config/50-raspap-router.conf" + LTROOT=$(grep "server.document-root" /etc/lighttpd/lighttpd.conf | awk -F '=' '{print $2}' | tr -d " \"") + + # compare values and get difference + HTROOT=${webroot_dir/$LTROOT} + + # remove trailing slash if present + HTROOT=$(echo "$HTROOT" | sed -e 's/\/$//') + + # substitute values + awk "{gsub(\"/REPLACE_ME\",\"$HTROOT\")}1" $CONFSRC > /tmp/50-raspap-router.conf + + # copy into place + sudo cp /tmp/50-raspap-router.conf /etc/lighttpd/conf-available/ || _install_status 1 "Unable to copy lighttpd config file into place." + # link into conf-enabled - echo "Creating link to /etc/lighttpd/conf-enabled"|| _install_status 1 "Unable to copy lighttpd config file." - sudo ln -s "/etc/lighttpd/conf-available/50-raspap-router.conf" "/etc/lighttpd/conf-enabled/50-raspap-router.conf" || _install_status 1 "Unable to symlink lighttpd config file." + echo "Creating link to /etc/lighttpd/conf-enabled" + sudo ln -s "/etc/lighttpd/conf-available/50-raspap-router.conf" "/etc/lighttpd/conf-enabled/50-raspap-router.conf" || _install_status 1 "Unable to symlink lighttpd config file (this is normal if the link already exists)." sudo systemctl restart lighttpd.service || _install_status 1 "Unable to restart lighttpd" _install_status 0 } + # Prompt to install ad blocking function _prompt_install_adblock() { _install_log "Configure ad blocking (Beta)" From 74497bebf1d61fed388c3c87d97518807770aa13 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 2 Mar 2021 17:27:40 +0000 Subject: [PATCH 7/7] Update page routing with PATH_INFO --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 87b0c8b8..b69f89b9 100755 --- a/index.php +++ b/index.php @@ -49,7 +49,7 @@ require_once 'includes/torproxy.php'; $config = getConfig(); $output = $return = 0; -$page = $_SERVER['REQUEST_URI']; +$page = $_SERVER['PATH_INFO']; $theme_url = getThemeOpt(); $toggleState = getSidebarState();