From 01052bf8af223b379b54652568a2301767550e7b Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 25 Apr 2020 00:49:05 +0100 Subject: [PATCH 001/128] Revamp testing Add a composer.json file Bring in squizlabs/php_codesniffer and phpcompatibility/php-compatibility via composer Do php linting via jakub-onderka/php-parallel-lint --- .travis.yml | 21 +++------------------ composer.json | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 composer.json diff --git a/.travis.yml b/.travis.yml index 28668e83..72c7fa7d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,24 +13,9 @@ matrix: allow_failures: - php: nightly -before_install: - - if [[ "$SNIFF" == "1" ]]; then export PHPCS_DIR=/tmp/phpcs; fi - - if [[ "$SNIFF" == "1" ]]; then export PHPCOMPAT_DIR=/tmp/PHPCompatibility; fi - # Install PHP CodeSniffer - - if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR; fi - # Install PHP Compatibility Standard - - if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/wimg/PHPCompatibility.git $PHPCOMPAT_DIR; fi - # Set install path for PHP Compatibility Standard - # @link https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-installed-standard-paths - - if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/bin/phpcs --config-set installed_paths $PHPCOMPAT_DIR; fi - # Refresh path - - if [[ "$SNIFF" == "1" ]]; then phpenv rehash; fi - +before_script: + - composer install --prefer-source --quiet --no-interaction # Run test script commands. -# All commands must exit with code 0 on success. Anything else is considered failure. script: - # Search for PHP syntax errors - - find -L . -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l - # Run PHPCS - - if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/bin/phpcs . ; fi + - composer test diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..fb900ec2 --- /dev/null +++ b/composer.json @@ -0,0 +1,19 @@ +{ + "name": "billz/raspap-webgui", + "homepage": "https://raspap.com/", + "license": "GPL-3.0", + "keywords": ["raspberrypi"], + "require-dev": { + "jakub-onderka/php-parallel-lint": "1.0.0", + "phpcompatibility/php-compatibility": "^9.3.5", + "squizlabs/php_codesniffer": "^3.5.5" + }, + "scripts": { + "lint": "parallel-lint . --exclude vendor", + "phpcs": "phpcs -p -s --config-set installed_paths vendor/phpcompatibility/php-compatibility .", + "test": [ + "composer lint", + "composer phpcs" + ] + } +} From 74c2c1759b723b7557c2ea7968e2ea07a1d69a0e Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 25 Apr 2020 01:01:41 +0100 Subject: [PATCH 002/128] Test on PHP 7.3 and 7.4 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 28668e83..957e32e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,8 @@ matrix: - php: '7.0' - php: '7.1' - php: '7.2' + - php: '7.3' + - php: '7.4' - php: 'nightly' allow_failures: From 2a4645bc085e3380a9d8deb0622613b3756a95fa Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 25 Apr 2020 22:06:02 +0100 Subject: [PATCH 003/128] Fixes #570 --- installers/raspbian.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/installers/raspbian.sh b/installers/raspbian.sh index d0e72769..1e30fa19 100755 --- a/installers/raspbian.sh +++ b/installers/raspbian.sh @@ -133,6 +133,11 @@ function _install_log() { echo -e "${ANSI_GREEN}RaspAP Install: $1${ANSI_RESET}" } +# Outputs a RaspAP divider +function _install_divider() { + echo -e "\033[1;32m***************************************************************$*\033[m" +} + # Outputs a RaspAP status indicator function _install_status() { case $1 in From a20db9185badc01565484b11d8fa75408e5ffd8a Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 30 Apr 2020 12:42:31 +0100 Subject: [PATCH 004/128] Fix wifi client connect button. Resolves #572, thx @zbchristian --- includes/configure_client.php | 3 ++- installers/raspap.sudoers | 2 +- templates/wifi_stations.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/configure_client.php b/includes/configure_client.php index 37aabd91..4e0b001f 100755 --- a/includes/configure_client.php +++ b/includes/configure_client.php @@ -16,7 +16,8 @@ function DisplayWPAConfig() if (isset($_POST['connect'])) { $result = 0; - exec('sudo wpa_cli -i ' . RASPI_WPA_CTRL_INTERFACE . ' select_network '.strval($_POST['connect'])); + exec('sudo wpa_cli -i ' . RASPI_WIFI_CLIENT_INTERFACE . ' select_network '.strval($_POST['connect'])); + $status->addMessage('New network selected', 'success'); } elseif (isset($_POST['client_settings'])) { $tmp_networks = $networks; if ($wpa_file = fopen('/tmp/wifidata', 'w')) { diff --git a/installers/raspap.sudoers b/installers/raspap.sudoers index 517fbdef..4d40eaa9 100644 --- a/installers/raspap.sudoers +++ b/installers/raspap.sudoers @@ -7,7 +7,7 @@ www-data ALL=(ALL) NOPASSWD:/bin/cp /tmp/wifidata /etc/wpa_supplicant/wpa_suppli www-data ALL=(ALL) NOPASSWD:/sbin/wpa_cli -i wlan[0-9] scan_results www-data ALL=(ALL) NOPASSWD:/sbin/wpa_cli -i wlan[0-9] scan www-data ALL=(ALL) NOPASSWD:/sbin/wpa_cli -i wlan[0-9] reconfigure -www-data ALL=(ALL) NOPASSWD:/sbin/wpa_cli -i wlan[0-9] select_network +www-data ALL=(ALL) NOPASSWD:/sbin/wpa_cli -i wlan[0-9] select_network [0-9]* www-data ALL=(ALL) NOPASSWD:/bin/cp /tmp/hostapddata /etc/hostapd/hostapd.conf www-data ALL=(ALL) NOPASSWD:/bin/systemctl start hostapd.service www-data ALL=(ALL) NOPASSWD:/bin/systemctl stop hostapd.service diff --git a/templates/wifi_stations.php b/templates/wifi_stations.php index 071b5331..1769cc9e 100755 --- a/templates/wifi_stations.php +++ b/templates/wifi_stations.php @@ -78,7 +78,7 @@
" id="update" name="update" /> - + " id="update" name="update" /> From 1a7222ccfb98b48ba60ac7388cfe9c86c75d3434 Mon Sep 17 00:00:00 2001 From: Reedy Date: Thu, 30 Apr 2020 13:13:39 +0100 Subject: [PATCH 005/128] Use php-parallel-lint/php-parallel-lint instead of jakub-onderka/php-parallel-lint --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index fb900ec2..2d1021ca 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "license": "GPL-3.0", "keywords": ["raspberrypi"], "require-dev": { - "jakub-onderka/php-parallel-lint": "1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.2.0", "phpcompatibility/php-compatibility": "^9.3.5", "squizlabs/php_codesniffer": "^3.5.5" }, From dbb71d10c93641ce24bf2e213011999be98d23bd Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 30 Apr 2020 13:35:17 +0100 Subject: [PATCH 006/128] Style update for font-based logo --- app/css/lightsout.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/css/lightsout.css b/app/css/lightsout.css index d1d9119f..0de93ab3 100644 --- a/app/css/lightsout.css +++ b/app/css/lightsout.css @@ -166,6 +166,10 @@ hr { font-family: inherit; } +.ra-raspap:before { + color: #ac1b3d !important; +} + .sidebar-light #sidebarToggle { background-color: #202020; border: 1px solid #afafaf !important From 2a7bb37167248d561617850796de8b3f56efdf6a Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 30 Apr 2020 13:37:40 +0100 Subject: [PATCH 007/128] Update jquery to v3.5.0 --- package.json | 3 ++- yarn.lock | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a64d48e5..a96a30c8 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,8 @@ "url": "https://github.com/billz/raspap-webgui.git" }, "dependencies": { - "startbootstrap-sb-admin-2": "4.0.7" + "startbootstrap-sb-admin-2": "4.0.7", + "jquery": "^3.5.0" }, "devDependencies": { "browser-sync": "^2.26.7", diff --git a/yarn.lock b/yarn.lock index 0bea7c19..d0c28296 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2321,6 +2321,11 @@ jquery@3.4.1, jquery@>=1.7: resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.1.tgz#714f1f8d9dde4bdfa55764ba37ef214630d80ef2" integrity sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw== +jquery@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.5.0.tgz#9980b97d9e4194611c36530e7dc46a58d7340fc9" + integrity sha512-Xb7SVYMvygPxbFMpTFQiHh1J7HClEaThguL15N/Gg37Lri/qKyhRGZYzHRyLH8Stq3Aow0LsHO2O2ci86fCrNQ== + js-base64@^2.1.8: version "2.5.1" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.5.1.tgz#1efa39ef2c5f7980bb1784ade4a8af2de3291121" From 25d9743e3bb78e38e8391af04550e4d162841880 Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Fri, 8 May 2020 17:27:15 +0200 Subject: [PATCH 008/128] Update stale.yml --- .github/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/stale.yml b/.github/stale.yml index 17e3b052..b1f787d3 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -1,5 +1,5 @@ # Number of days of inactivity before an issue becomes stale -daysUntilStale: 60 +daysUntilStale: 30 # Number of days of inactivity before a stale issue is closed daysUntilClose: 7 # Issues with these labels will never be considered stale From f02f9c62118b79d611eda37d11ce38803b0dc179 Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Fri, 8 May 2020 18:35:54 +0200 Subject: [PATCH 009/128] Update stale.yml --- .github/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/stale.yml b/.github/stale.yml index b1f787d3..17e3b052 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -1,5 +1,5 @@ # Number of days of inactivity before an issue becomes stale -daysUntilStale: 30 +daysUntilStale: 60 # Number of days of inactivity before a stale issue is closed daysUntilClose: 7 # Issues with these labels will never be considered stale From 15032a3f44dc8e1fcc42c06971410e16da3a8af6 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 12 May 2020 07:50:28 +0100 Subject: [PATCH 010/128] Apply zbchristian patch --- ajax/networking/gen_int_config.php | 12 +++---- includes/hostapd.php | 53 +++++++++++++++++++----------- templates/dashboard.php | 12 ++++--- 3 files changed, 47 insertions(+), 30 deletions(-) diff --git a/ajax/networking/gen_int_config.php b/ajax/networking/gen_int_config.php index f49d1fa0..8de760e9 100644 --- a/ajax/networking/gen_int_config.php +++ b/ajax/networking/gen_int_config.php @@ -6,18 +6,20 @@ require_once '../../includes/config.php'; require_once '../../includes/functions.php'; if (isset($_POST['generate'])) { - $cnfNetworking = array_diff(scandir(RASPI_CONFIG_NETWORKING, 1), array('..','.','dhcpcd.conf')); + $cnfNetworking = array_diff(scandir(RASPI_CONFIG_NETWORKING, 1), array('..','.','dhcpcd.conf','defaults')); $cnfNetworking = array_combine($cnfNetworking, $cnfNetworking); - $strConfFile = ""; + $strConfFile = file_get_contents(RASPI_CONFIG_NETWORKING.'/defaults')."\n"; foreach ($cnfNetworking as $index => $file) { if ($index != "defaults") { $cnfFile = parse_ini_file(RASPI_CONFIG_NETWORKING.'/'.$file, false, INI_SCANNER_RAW); if ($cnfFile['static'] === 'true') { + $strConfFile .= "#Static IP configured for ".$cnfFile['interface']."\n"; $strConfFile .= "interface ".$cnfFile['interface']."\n"; $strConfFile .= "static ip_address=".$cnfFile['ip_address']."\n"; $strConfFile .= "static routers=".$cnfFile['routers']."\n"; - $strConfFile .= "static domain_name_servers=".$cnfFile['domain_name_server']."\n"; + $strConfFile .= "static domain_name_servers=".$cnfFile['domain_name_server']."\n\n"; } elseif ($cnfFile['static'] === 'false' && $cnfFile['failover'] === 'true') { + $strConfFile .= "#Failover static IP configured for ".$cnfFile['interface']."\n"; $strConfFile .= "profile static_".$cnfFile['interface']."\n"; $strConfFile .= "static ip_address=".$cnfFile['ip_address']."\n"; $strConfFile .= "static routers=".$cnfFile['routers']."\n"; @@ -27,13 +29,11 @@ if (isset($_POST['generate'])) { } else { $strConfFile .= "#DHCP configured for ".$cnfFile['interface']."\n\n"; } - } else { - $strConfFile .= file_get_contents(RASPI_CONFIG_NETWORKING.'/'.$index)."\n\n"; } } if (file_put_contents(RASPI_CONFIG_NETWORKING.'/dhcpcd.conf', $strConfFile)) { - exec('sudo /bin/cp /etc/raspap/networking/dhcpcd.conf /etc/dhcpcd.conf'); + exec('sudo /bin/cp '.RASPI_CONFIG_NETWORKING.'/dhcpcd.conf '.RASPI_DHCPCD_CONFIG); $output = ['return'=>0,'output'=>'Settings successfully applied']; } else { $output = ['return'=>2,'output'=>'Unable to write to apply settings']; diff --git a/includes/hostapd.php b/includes/hostapd.php index ad321dbf..4a1d330d 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -56,7 +56,7 @@ function DisplayHostAPDConfig() } exec('cat '. RASPI_HOSTAPD_CONFIG, $hostapdconfig); - exec('iwgetid '. RASPI_WIFI_CLIENT_INTERFACE. ' -r', $wifiNetworkID); + exec('iwgetid '. $_POST['interface']. ' -r', $wifiNetworkID); if (!empty($wifiNetworkID[0])) { $managedModeEnabled = true; } @@ -165,7 +165,7 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $cfg['WifiAPEnable'] = ($bridgedEnable == 1 ? $arrHostapdConf['WifiAPEnable'] : $wifiAPEnable); $cfg['BridgedEnable'] = $bridgedEnable; - $cfg['WifiManaged'] = RASPI_WIFI_CLIENT_INTERFACE; + $cfg['WifiManaged'] = $_POST['interface']; write_php_ini($cfg, '/etc/raspap/hostapd.ini'); // Verify input @@ -252,7 +252,7 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) if ($wifiAPEnable == 1) { $config.= 'interface=uap0'.PHP_EOL; } elseif ($bridgedEnable == 1) { - $config.='interface='.RASPI_WIFI_CLIENT_INTERFACE.PHP_EOL; + $config.='interface='.$_POST['interface'].PHP_EOL; $config.= 'bridge=br0'.PHP_EOL; } else { $config.= 'interface='.$_POST['interface'].PHP_EOL; @@ -300,21 +300,13 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) system('sudo cp /tmp/dnsmasqdata '.RASPI_DNSMASQ_CONFIG, $return); // Set dnsmasq values from ini, fallback to default if undefined - $intConfig = parse_ini_file(RASPI_CONFIG_NETWORKING.'/'.RASPI_WIFI_CLIENT_INTERFACE.'.ini', false, INI_SCANNER_RAW); + $intConfig = parse_ini_file(RASPI_CONFIG_NETWORKING.'/'.$_POST['interface'].'.ini', false, INI_SCANNER_RAW); $domain_name_server = ($intConfig['domain_name_server'] =='') ? '1.1.1.1 8.8.8.8' : $intConfig['domain_name_server']; $routers = ($intConfig['routers'] == '') ? '10.3.141.1' : $intConfig['routers']; - $config = [ '# RaspAP wlan0 configuration' ]; - $config[] = 'hostname'; - $config[] = 'clientid'; - $config[] = 'persistent'; - $config[] = 'option rapid_commit'; - $config[] = 'option domain_name_servers, domain_name, domain_search, host_name'; - $config[] = 'option classless_static_routes'; - $config[] = 'option ntp_servers'; - $config[] = 'require dhcp_server_identifier'; - $config[] = 'slaac private'; - $config[] = 'nohook lookup-hostname'; + // load the defaults for dhcpcd.conf + $config = file_get_contents(RASPI_CONFIG_NETWORKING.'/defaults')."\n\n"; + $config = explode('\n', $config); if ($bridgedEnable == 1) { $config[] = 'denyinterfaces eth0 wlan0'; @@ -327,14 +319,37 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $config[] = 'static ip_address='.$ip_address; $config[] = 'nohook wpa_supplicant'; } else { - // Default config - $ip_address = ($intConfig['ip_address'] == '') ? '10.3.141.1/24' : $intConfig['ip_address']; - $config[] = 'interface '.RASPI_WIFI_CLIENT_INTERFACE; + // Default config + $ip_address = "10.3.141.1/24"; // fallback IP + // default IP of the AP xxx.xxx.xxx.1/24 of the selected dhcp range + $def_ip = array(); + if (preg_match("/^([0-9]{1,3}\.){3}/",$dhcp_range,$def_ip) ) $ip_address = $def_ip[0]."1/24"; + // use static IP assigned to interface only, if consistent with the selected dhcp range + if (preg_match("/^([0-9]{1,3}\.){3}/",$intConfig['ip_address'],$int_ip) && $def_ip[0] === $int_ip[0]) $ip_address = $intConfig['ip_address']; + + $routers = ""; // NO default route to be set for the hotspot. This screws up the routing! + $config[] = 'interface '.$_POST['interface']; $config[] = 'static ip_address='.$ip_address; $config[] = 'static routers='.$routers; $config[] = 'static domain_name_server='.$domain_name_server; - } + // write the static IP back to the $_POST['interface'].ini file + $intConfig['interface'] = $_POST['interface']; + $intConfig['ip_address'] = $ip_address; + $intConfig['domain_name_server'] = $domain_name_server; + $intConfig['routers'] = $routers; + $intConfig['static'] = "true"; + $intConfig['failover'] = "false"; + write_php_ini($intConfig, RASPI_CONFIG_NETWORKING.'/'.$_POST['interface'].".ini"); + + $config[] = 'interface '.$_POST['interface']; + $config[] = 'static ip_address='.$ip_address; + $config[] = 'static routers='.$routers; + $config[] = 'static domain_name_server='.$domain_name_server; + $config[] = PHP_EOL; + } + + $config = join(PHP_EOL, $config); file_put_contents("/tmp/dhcpddata", $config); system('sudo cp /tmp/dhcpddata '.RASPI_DHCPCD_CONFIG, $return); diff --git a/templates/dashboard.php b/templates/dashboard.php index 97c02fbf..e79dbf8d 100755 --- a/templates/dashboard.php +++ b/templates/dashboard.php @@ -5,13 +5,15 @@ if ($arrHostapdConf['WifiAPEnable'] == 1) { } else { $client_iface = RASPI_WIFI_CLIENT_INTERFACE; } +exec('cat '.RASPI_HOSTAPD_CONFIG.' | sed -rn "s/interface=(wlan[0-9])/\1/p" ',$ap_iface); +$ap_iface = $ap_iface[0]; $MACPattern = '"([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"'; if ($arrHostapdConf['BridgedEnable'] == 1) { $moreLink = "index.php?page=hostapd_conf"; - exec('iw dev '.$client_iface.' station dump | grep -oE '.$MACPattern, $clients); + exec('iw dev '.$ap_iface.' station dump | grep -oE '.$MACPattern, $clients); } else { $moreLink = "index.php?page=dhcpd_conf"; - exec('cat '.RASPI_DNSMASQ_LEASES.'| grep -E $(iw dev '.$client_iface.' station dump | grep -oE '.$MACPattern.' | paste -sd "|")', $clients); + exec('cat '.RASPI_DNSMASQ_LEASES.'| grep -E $(iw dev '.$ap_iface.' station dump | grep -oE '.$MACPattern.' | paste -sd "|")', $clients); } $ifaceStatus = $wlan0up ? "up" : "down"; ?> @@ -39,7 +41,7 @@ $ifaceStatus = $wlan0up ? "up" : "down";

-
+
@@ -126,9 +128,9 @@ $ifaceStatus = $wlan0up ? "up" : "down"; - " name="ifup_wlan0" /> + " name="ifup_wlan0" /> - " name="ifdown_wlan0" /> + " name="ifdown_wlan0" /> From dabec4651127292cd362d0413aa707b22e8a4ddb Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 12 May 2020 08:10:54 +0100 Subject: [PATCH 011/128] Minor: untabify --- includes/hostapd.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index 4a1d330d..f730d602 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -304,7 +304,7 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $domain_name_server = ($intConfig['domain_name_server'] =='') ? '1.1.1.1 8.8.8.8' : $intConfig['domain_name_server']; $routers = ($intConfig['routers'] == '') ? '10.3.141.1' : $intConfig['routers']; - // load the defaults for dhcpcd.conf + // load the defaults for dhcpcd.conf $config = file_get_contents(RASPI_CONFIG_NETWORKING.'/defaults')."\n\n"; $config = explode('\n', $config); @@ -320,14 +320,14 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $config[] = 'nohook wpa_supplicant'; } else { // Default config - $ip_address = "10.3.141.1/24"; // fallback IP - // default IP of the AP xxx.xxx.xxx.1/24 of the selected dhcp range - $def_ip = array(); + $ip_address = "10.3.141.1/24"; // fallback IP + // default IP of the AP xxx.xxx.xxx.1/24 of the selected dhcp range + $def_ip = array(); if (preg_match("/^([0-9]{1,3}\.){3}/",$dhcp_range,$def_ip) ) $ip_address = $def_ip[0]."1/24"; - // use static IP assigned to interface only, if consistent with the selected dhcp range + // use static IP assigned to interface only, if consistent with the selected dhcp range if (preg_match("/^([0-9]{1,3}\.){3}/",$intConfig['ip_address'],$int_ip) && $def_ip[0] === $int_ip[0]) $ip_address = $intConfig['ip_address']; - $routers = ""; // NO default route to be set for the hotspot. This screws up the routing! + $routers = ""; // NO default route to be set for the hotspot. This screws up the routing! $config[] = 'interface '.$_POST['interface']; $config[] = 'static ip_address='.$ip_address; $config[] = 'static routers='.$routers; @@ -346,10 +346,9 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $config[] = 'static ip_address='.$ip_address; $config[] = 'static routers='.$routers; $config[] = 'static domain_name_server='.$domain_name_server; - $config[] = PHP_EOL; - } + $config[] = PHP_EOL; + } - $config = join(PHP_EOL, $config); file_put_contents("/tmp/dhcpddata", $config); system('sudo cp /tmp/dhcpddata '.RASPI_DHCPCD_CONFIG, $return); From 14508ee7733d5e7e1b9facef97e3392d247fe22f Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 12 May 2020 09:16:04 +0100 Subject: [PATCH 012/128] Remove duplicate $config[] block --- includes/hostapd.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index f730d602..91aa6182 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -332,6 +332,7 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $config[] = 'static ip_address='.$ip_address; $config[] = 'static routers='.$routers; $config[] = 'static domain_name_server='.$domain_name_server; + $config[] = PHP_EOL; // write the static IP back to the $_POST['interface'].ini file $intConfig['interface'] = $_POST['interface']; @@ -341,12 +342,6 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $intConfig['static'] = "true"; $intConfig['failover'] = "false"; write_php_ini($intConfig, RASPI_CONFIG_NETWORKING.'/'.$_POST['interface'].".ini"); - - $config[] = 'interface '.$_POST['interface']; - $config[] = 'static ip_address='.$ip_address; - $config[] = 'static routers='.$routers; - $config[] = 'static domain_name_server='.$domain_name_server; - $config[] = PHP_EOL; } $config = join(PHP_EOL, $config); From f4169a0ede0cae3a66647c2963a2945b4652ba74 Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 16 May 2020 11:46:01 +0100 Subject: [PATCH 013/128] Update composer.json --- composer.json | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 2d1021ca..8101d1f3 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,19 @@ { "name": "billz/raspap-webgui", - "homepage": "https://raspap.com/", + "description": "Simple AP setup and wifi mangement for Debian-based devices", "license": "GPL-3.0", - "keywords": ["raspberrypi"], + "homepage": "https://raspap.com/", + "keywords": ["raspberrypi", "debian", "armbian", "wifi"], + "type": "raspap-core", + "authors": { + "name": "RaspAP Team", + "email": "billzimmerman@gmail.com", + "homepage": "https://raspap.com/" + }, + "require": { + "php": "^7.0", + "raspap/composer-installer": "^1.0" + }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.2.0", "phpcompatibility/php-compatibility": "^9.3.5", From dec0be87bbe62bce5177a4758fc492622bbbc1c6 Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 16 May 2020 11:54:35 +0100 Subject: [PATCH 014/128] Update composer.json --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 8101d1f3..d5279040 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,7 @@ "homepage": "https://raspap.com/" }, "require": { - "php": "^7.0", - "raspap/composer-installer": "^1.0" + "php": "^7.0" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.2.0", From 807a8bb7f3a30793a281c35afb61896ec4b5038c Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 16 May 2020 12:05:56 +0100 Subject: [PATCH 015/128] Update composer.json --- composer.json | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index d5279040..4b0f48c0 100644 --- a/composer.json +++ b/composer.json @@ -5,11 +5,13 @@ "homepage": "https://raspap.com/", "keywords": ["raspberrypi", "debian", "armbian", "wifi"], "type": "raspap-core", - "authors": { - "name": "RaspAP Team", - "email": "billzimmerman@gmail.com", - "homepage": "https://raspap.com/" - }, + "authors": [ + { + "name": "RaspAP Team", + "email": "billzimmerman@gmail.com", + "homepage": "https://raspap.com/" + } + ], "require": { "php": "^7.0" }, From 650af228d9cc99099ddc961ef7ce043a3e585106 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 19 May 2020 13:47:31 +0100 Subject: [PATCH 016/128] Disable Ad block when bridgedEnabled --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index c2fe13ee..136c72b9 100755 --- a/index.php +++ b/index.php @@ -146,7 +146,7 @@ $bridgedEnabled = $arrHostapdConf['BridgedEnable']; - + From 18285bca22cb2b316e0477d5ca38abc974ce3791 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 19 May 2020 16:35:41 +0100 Subject: [PATCH 017/128] =?UTF-8?q?Update=20=D0=A0=D1=83=D1=81=D1=81=D0=BA?= =?UTF-8?q?=D0=B8=D0=B9=20translation,=20thx=20Denis=20Trifiniuc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locale/ru_RU/LC_MESSAGES/messages.mo | Bin 17052 -> 20232 bytes locale/ru_RU/LC_MESSAGES/messages.po | 104 ++++++++++++++++++++------- 2 files changed, 78 insertions(+), 26 deletions(-) diff --git a/locale/ru_RU/LC_MESSAGES/messages.mo b/locale/ru_RU/LC_MESSAGES/messages.mo index fe97cb789b5a51c30da3b4cd9f91526b94acb96a..8c5c4d55e7715a66ea7cd1d1a5b6a64b947ab720 100644 GIT binary patch delta 8393 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 WM@oytQo762uU8izDxvSHANXIkg}bW& delta 5157 zcmYk;30zfG0>|<55Jhpr9Tee-LV|*zBue5M?puYG<`U(LArKVMvasid>F8*BU31CF zF{f}!y^1TDl}nA~qiifc)|fNnl(x(?PT4fg%erQ-b$kGkgP^;5phf&}6+546DdI@SkTTuhvgBrl$X!c(Xo#2LMdIq(mpINVC64y6T1BhqZ zasX!FG<&@obyoJG2KXLoU|*ry{T{UfO*k;xf)1#GrnhJPHS=NI&`L~1jj#~aK$*R+ zL_JW2`u-Nw7QKoZ@L|*dPT9X-LA7@S)p0m~)XKK9#v@}g-Td}OE^0~cL3K0{)xk_u z2TvnynWd-!?m&HiH}XQ5{ivCpv3`o`_&d~_?BU&3JI#?>CKkJ+zYi5Pf^uLEXY=5%%e@3l9l$Z6_ zh~lZ}Ml$ANAJhn+u|9{I!HcNx)nFGqiTd6(RLB2D9m0Anm#(8x6N*P2-mcgahoB}h zrxWY1h8J=}r*b_e;65COAKB|fZmQwos3o6*+L|KN57kWTQhR?pYGON4EAyK5Ack>$ z91}doyqVxPrj{Fj=^R?39ZX9P)*|0Ar?D4aL;aS=C30S{2dd*j)YdG(Y+QkQi%w%Q zeuk;oFo}N&u{Sa&Ga0k+8NdBQ4c@_xOPGV+N$BGm7avW5XL`;ibk{+&tna0#LF4J8aj;XpboWFmvIu_Ks`4u zCDiaNWb9@UYJjgGzuM*~(xf?$oICR~GDg#p+4a-=pG!rjb0MmuEtrPYs8f6q2jkbM z5vTLBrH0319u}Ymd<^&DHPisMa#J&X6?yZ_yQt^CM71BmM>_qR-c-hNqX6&58f<_+ zVKWS4-J4(w6|6{H|?qDwaBwR zi}!MU1a+vIW-v$`j(4FS)$mbdjOKmROn*jp#l+AUt89j#&PWMrtJYu??niCyN%S|Q z@+lSiGFMSEYR8e+567LTk&i;{*(_{1{a}LWD{zsUPR8FaZwNc5nJO;)c2cag$B?WwZu87 z=cb{4@n)h1v>Y|#TGZB@MXl%$ekx4T#Py%x)fX2m~%W+(}e<3ux7(b;HBULhyQ%S1(ce3;y?3kutBHV_@gUy*@i zjrPA6mGk6Q(d(k$0F@8OkzkGgx3~TtU$FJ<)?Z*A*+G6ys!30x@+{d&>XQ%2>qM)i z(nkCLD3wxDMfCgs9w{R_T$N-lxm70GN+;|_9wgK4y_YbB#1kE4m4`wEe=Sw*Xs?CN z$QJrH)5tyKx8z>(K1n3CMCC;?C|EP*H>ks>a*!+}Iy1MIUvlvTX=-mSx$TdOsh=bt zk^6}H5B_`p6s{wWkO^ckQAsEJ$X24C=riOrQAr|wgSF7dIB-b~8B5~G?PY|$sKaxl znfhNzr?m~sb{Yr#*JhF2_yOB5Lrf4 z)|1)f6B6A2a4ISVWM;4y`se_WB#RW0Xz~X#h72ReNIA(SDvQVg(p49?l{cs-lT7kE zV)~U=l$Dkg^dDR56el-zzG$_~o!5G~r{R$C6TG8K^QSw@+s3=6+9rlMkuhDJyJIrl zx$QT2oQ&8l?$@z5J?`J);=kmiwnyu(#mG{=W8Vev-1mlsd>Kq8QI?dUuS!L zCDSI{=bX9YAvZs{fyeoKPAg|gO0l!Ib+p^MTV+^Oz^$8Kw0O0UP9lFV3VOncY;HfySi?Wu zFkrXG`6NEaoj0gnn7eDp&M>!VXh)B`b=Y?vr?|^dw_;>lk25&2jeBX-h_KYa>cD}z w1%cyr^8>F3_L2R8+Q6Q=Ro=j%KyBUP!0Y_s7&n##4%Mx4dXG(WipOsGA2KCyX#fBK diff --git a/locale/ru_RU/LC_MESSAGES/messages.po b/locale/ru_RU/LC_MESSAGES/messages.po index bbd6115a..8516ff52 100644 --- a/locale/ru_RU/LC_MESSAGES/messages.po +++ b/locale/ru_RU/LC_MESSAGES/messages.po @@ -1,22 +1,19 @@ -# RaspAP Portable Object file -# Project home: https://github.com/billz/raspap-webgui -# Licensed under the GNU General Public License v3.0 -# This file is distributed under the same license as the RaspAP package -# FIRST AUTHOR billzimmerman@gmail.com, 2017 -# -#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 1.2.1\n" +"Project-Id-Version: raspap\n" "Report-Msgid-Bugs-To: Bill Zimmerman \n" "POT-Creation-Date: 2017-10-19 08:56+0000\n" -"PO-Revision-Date: 2019-10-21 23:15+0000\n" -"Last-Translator: Betep \n" -"Language-Team: \n" -"Language: en_US\n" +"PO-Revision-Date: 2020-05-19 15:29\n" +"Last-Translator: Denis Trifiniuc\n" +"Language-Team: Russian\n" +"Language: ru_RU\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=4; plural=((n%10==1 && n%100!=11) ? 0 : ((n%10 >= 2 && n%10 <=4 && (n%100 < 12 || n%100 > 14)) ? 1 : ((n%10 == 0 || (n%10 >= 5 && n%10 <=9)) || (n%100 >= 11 && n%100 <= 14)) ? 2 : 3));\n" +"X-Crowdin-Project: raspap\n" +"X-Crowdin-Language: ru\n" +"X-Crowdin-File: /master/locale/en_US/LC_MESSAGES/messages.po\n" #: index.php msgid "RaspAP Wifi Configuration Portal" @@ -37,6 +34,12 @@ msgstr "WiFi клиента" msgid "Hotspot" msgstr "Точка доступа" +msgid "Memory Use" +msgstr "Использование RAM" + +msgid "CPU Temp" +msgstr "Температура ЦП" + msgid "Networking" msgstr "Сетевые" @@ -178,8 +181,8 @@ msgstr "Переданные пакеты" msgid "Transferred Bytes" msgstr "Передано Байт" -msgid "Wireless Information" -msgstr "Беспроводная информация" +msgid "Wireless Client" +msgstr "WiFi клиент" msgid "Connected To" msgstr "Подключено к" @@ -248,6 +251,9 @@ msgstr "Список клиентов" msgid "Interface" msgstr "Интерфейс" +msgid "DNS Server" +msgstr "DNS сервер" + msgid "Starting IP Address" msgstr "Начальный IP-адрес" @@ -318,31 +324,31 @@ msgid "Dnsmasq is not running" msgstr "Dnsmasq не запущена" msgid "Upstream DNS servers" -msgstr "Upstream DNS servers" +msgstr "Пользовательские DNS-серверы" msgid "Only ever query DNS servers configured below" -msgstr "Only ever query DNS servers configured below" +msgstr "Использовать только DNS-серверы, настроенные ниже" msgid "Enable this option if you want RaspAP to send DNS queries to the servers configured below exclusively. By default RaspAP also uses its upstream DHCP server's name servers." -msgstr "Enable this option if you want RaspAP to send DNS queries to the servers configured below exclusively. By default RaspAP also uses its upstream DHCP server's name servers." +msgstr "Включите эту опцию, если вы хотите, чтобы RaspAP отправлял DNS-запросы только на серверы, настроенные ниже. По умолчанию RaspAP также использует восходящие DNS-серверы, назначенные через DHCP." msgid "This option adds no-resolv to the dnsmasq configuration." -msgstr "This option adds no-resolv to the dnsmasq configuration." +msgstr "Этот параметр добавляет no-resolv в конфигурацию dnsmasq." msgid "Add upstream DNS server" -msgstr "Add upstream DNS server" +msgstr "Добавить сервер DNS" msgid "Format" -msgstr "Format" +msgstr "Формат" msgid "Choose a hosted server" -msgstr "Choose a hosted server" +msgstr "Общедоступный DNS-сервер" msgid "Log DHCP requests" -msgstr "Log DHCP requests" +msgstr "Журнал DHCP-запросов" msgid "Log DNS queries" -msgstr "Log DNS queries" +msgstr "Журнал DNS-запросов" #: includes/hostapd.php msgid "Basic" @@ -426,6 +432,9 @@ msgstr "Записи журнала" msgid "WiFi client AP mode" msgstr "Режим AP WiFi-клиента" +msgid "Bridged AP mode" +msgstr "Режим моста ТОЧКИ ДОСТУПА" + msgid "Hide SSID in broadcast" msgstr "Скрыть SSID при трансляции" @@ -445,9 +454,6 @@ msgstr "Текущие настройки" msgid "Default Gateway" msgstr "Основной шлюз" -msgid "DNS Server" -msgstr "DNS сервер" - msgid "Alternate DNS Server" msgstr "Альтернативный DNS-сервер" @@ -660,6 +666,10 @@ msgstr "Попытка запуска TOR" msgid "Attempting to stop TOR" msgstr "Попытка остановить TOR" +#: template/dashboard.php +msgid "Bridged AP mode is enabled. For Hostname and IP, see your router's admin page." +msgstr "Мостовой режим ТОЧКИ ДОСТУПА включен. Для хоста и IP-адреса см. страницу администрирования маршрутизатора." + #: common form controls msgid "Save settings" msgstr "Сохранить настройки" @@ -682,3 +692,45 @@ msgstr "вверх" msgid "down" msgstr "вниз" +msgid "adblock" +msgstr "Adblock" + +msgid "Ad Blocking" +msgstr "Ad Blocking" + +msgid "Start Ad Blocking" +msgstr "Запустить Ad Blocking" + +msgid "Restart Ad Blocking" +msgstr "Перезапустить Ad Blocking" + +msgid "Blocklist settings" +msgstr "Настройки блокировки" + +msgid "Enable blocklists" +msgstr "Включить блокировку" + +msgid "Enable this option if you want RaspAP to block DNS requests for ads, tracking and other virtual garbage. Blocklists are gathered from multiple, actively maintained sources and automatically updated, cleaned, optimized and moderated on a daily basis." +msgstr "Включите эту опцию, если вы хотите, чтобы RaspAP блокировал DNS запросы для рекламы, отслеживания и другого виртуального мусора. Блокирующие списки собираются из множества активно поддерживаемых источников и автоматически обновляются, очищаются, оптимизируются и модерируются ежедневно." + +msgid "This option adds conf-file and addn-hosts to the dnsmasq configuration." +msgstr "Эта опция добавляет в конфигурацию dnsmasq conf-file и addn-hosts." + +msgid "Choose a blocklist provider" +msgstr "Выберите поставщика черного списка" + +msgid "Hostnames blocklist last updated" +msgstr "Имена черного списка последнее обновление" + +msgid "Domains blocklist last updated" +msgstr "Последнее обновление списка блокировки доменов" + +msgid "Update now" +msgstr "Обновить сейчас" + +msgid "Statistics" +msgstr "Статистика" + +msgid "Information provided by adblock" +msgstr "Информация получена от Adblock" + From 0c5e93e9d8400e324b7bdc37c8d094f7567fe254 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 19 May 2020 17:28:48 +0100 Subject: [PATCH 018/128] Added 802.11.w MFP support, addresses #484 --- includes/hostapd.php | 4 ++++ templates/hostapd.php | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/includes/hostapd.php b/includes/hostapd.php index ad321dbf..38908754 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -18,6 +18,7 @@ function DisplayHostAPDConfig() 'b' => '802.11b - 2.4 GHz', 'g' => '802.11g - 2.4 GHz', 'n' => '802.11n - 2.4 GHz', + 'w' => '802.11w - 2.4 Ghz', 'ac' => '802.11.ac - 5 GHz' ]; $arrSecurity = array(1 => 'WPA', 2 => 'WPA2', 3 => 'WPA+WPA2', 'none' => _("None")); @@ -242,6 +243,9 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $config.= 'vht_capab=[MAX-AMSDU-3839][SHORT-GI-80]'.PHP_EOL; $config.= 'vht_oper_chwidth=1'.PHP_EOL; $config.= 'vht_oper_centr_freq_seg0_idx=42'.PHP_EOL.PHP_EOL; + } elseif ($_POST['hw_mode'] === 'w') { + $config.= 'ieee80211w=2'.PHP_EOL; + $config.= 'wpa_key_mgmt=WPA-EAP-SHA256'.PHP_EOL; } else { $config.= 'hw_mode='.$_POST['hw_mode'].PHP_EOL; $config.= 'ieee80211n=0'.PHP_EOL; diff --git a/templates/hostapd.php b/templates/hostapd.php index d3d7786e..9fcbd8c1 100755 --- a/templates/hostapd.php +++ b/templates/hostapd.php @@ -61,6 +61,12 @@ $selectedHwMode = 'ac'; } } + if (isset($arrConfig['ieee80211w'])) { + if (strval($arrConfig['ieee80211w']) === '2') { + $selectedHwMode = 'w'; + } + } + if (!in_array($arrConfig['country_code'], $countries_5Ghz_max48ch)) { $hwModeDisabled = 'ac'; if ($selectedHwMode === $hwModeDisabled) { From e04ac679ddfc7283185459d6a5ce5a905d3c790a Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Sat, 23 May 2020 13:55:10 +0200 Subject: [PATCH 019/128] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e145be6..c19bef5e 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,9 @@ configured as an access point as follows: * SSID: `raspi-webgui` * Password: ChangeMe -**Note:** As the name suggests, the Quick Installer is a great way to quickly setup a new AP. However, it does not automagically detect the unique configuration of your system. Best results are obtained by connecting to ethernet (`eth0`) or as a WiFi client, also known as managed mode, with `wlan0`. For the latter, refer to [this FAQ](https://github.com/billz/raspap-webgui/wiki/FAQs#how-do-i-prepare-the-sd-card-to-connect-to-wifi-in-headless-mode). Please [read this](https://github.com/billz/raspap-webgui/wiki/Reporting-issues) before reporting an issue. +**Note:** As the name suggests, the Quick Installer is a great way to quickly setup a new AP. However, it does not automagically detect the unique configuration of your system. Best results are obtained by connecting to ethernet (`eth0`) or as a WiFi client, also known as managed mode, with `wlan0`. For the latter, refer to [this FAQ](https://github.com/billz/raspap-webgui/wiki/FAQs#how-do-i-prepare-the-sd-card-to-connect-to-wifi-in-headless-mode). Special instructions for the Pi Zero W are [available here](https://github.com/billz/raspap-webgui/wiki/RPi-Zero-W-AP-STA-mode). + +Please [read this](https://github.com/billz/raspap-webgui/wiki/Reporting-issues) before reporting an issue. ## Ad Blocking This feature uses DNS blacklisting to block requests for ads, trackers and other undesirable hosts. To enable ad blocking, simply respond to the prompt during the installation. As a beta release, we encourage testing and feedback from users of RaspAP. From ceaa7a3511f18100a7759460dc8b55d68212e4ad Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 23 May 2020 18:01:11 +0100 Subject: [PATCH 020/128] Update _set_php_package w/ pattern match #588 --- installers/common.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index a64e8d1c..b27b0684 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -78,16 +78,16 @@ function _get_linux_distro() { # Sets php package option based on Linux version, abort if unsupported distro function _set_php_package() { case $RELEASE in - "18.04"|"19.10") # Ubuntu Server + 18.04|19.10) # Ubuntu Server php_package="php7.4-cgi" phpcgiconf="/etc/php/7.4/cgi/php.ini" ;; - "10") + 10*) php_package="php7.3-cgi" phpcgiconf="/etc/php/7.3/cgi/php.ini" ;; - "9") + 9*) php_package="php7.0-cgi" phpcgiconf="/etc/php/7.0/cgi/php.ini" ;; - "8") + 8) _install_status 1 "${DESC} and php5 are not supported. Please upgrade." ;; *) _install_status 1 "${DESC} is unsupported. Please install on a supported distro." ;; From b128c4106c7c6db845f7b70ddb0c66d40e3ec304 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 24 May 2020 08:14:07 +0100 Subject: [PATCH 021/128] Applied patches from #581 --- ajax/networking/wifi_stations.php | 1 + includes/configure_client.php | 1 + includes/wifi_functions.php | 45 ++++++++++++++++++++++++------- templates/wifi_stations.php | 19 +++++++------ 4 files changed, 47 insertions(+), 19 deletions(-) diff --git a/ajax/networking/wifi_stations.php b/ajax/networking/wifi_stations.php index a867b6b5..7d9bb82e 100644 --- a/ajax/networking/wifi_stations.php +++ b/ajax/networking/wifi_stations.php @@ -13,5 +13,6 @@ $ssid = null; knownWifiStations($networks); nearbyWifiStations($networks, !isset($_REQUEST["refresh"])); connectedWifiStations($networks); +sortNetworksByRSSI($networks); echo renderTemplate('wifi_stations', compact('networks')); diff --git a/includes/configure_client.php b/includes/configure_client.php index 4e0b001f..07715388 100755 --- a/includes/configure_client.php +++ b/includes/configure_client.php @@ -94,6 +94,7 @@ function DisplayWPAConfig() nearbyWifiStations($networks); connectedWifiStations($networks); + sortNetworksByRSSI($networks); echo renderTemplate("configure_client", compact("status")); } diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index d8a8ce20..d7194b56 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -63,16 +63,26 @@ function nearbyWifiStations(&$networks, $cached = true) } ); - foreach (explode("\n", $scan_results) as $network) { - $arrNetwork = preg_split("/[\t]+/", $network); // split result into array + // get the name of the AP - should be excluded von the nearby networks + exec('cat '.RASPI_HOSTAPD_CONFIG.' | sed -rn "s/ssid=(.*)\s*$/\1/p" ',$ap_ssid); + $ap_ssid = $ap_ssid[0]; + + foreach (explode("\n", $scan_results) as $network) { + $arrNetwork = preg_split("/[\t]+/", $network); // split result into array + if (!array_key_exists(4, $arrNetwork) || + trim($arrNetwork[4]) == $ap_ssid) continue; + + $ssid = trim($arrNetwork[4]); + // filter SSID string - anything invisable in 7bit ASCII or quotes -> ignore network + if( preg_match('[\x00-\x1f\x7f-\xff\'\`\\"]',$ssid)) continue; // If network is saved - if (array_key_exists(4, $arrNetwork) && array_key_exists($arrNetwork[4], $networks)) { - $networks[$arrNetwork[4]]['visible'] = true; - $networks[$arrNetwork[4]]['channel'] = ConvertToChannel($arrNetwork[1]); + if (array_key_exists($ssid, $networks)) { + $networks[$ssid]['visible'] = true; + $networks[$ssid]['channel'] = ConvertToChannel($arrNetwork[1]); // TODO What if the security has changed? } else { - $networks[$arrNetwork[4]] = array( + $networks[$ssid] = array( 'configured' => false, 'protocol' => ConvertToSecurity($arrNetwork[3]), 'channel' => ConvertToChannel($arrNetwork[1]), @@ -82,10 +92,12 @@ function nearbyWifiStations(&$networks, $cached = true) ); } - // Save RSSI - if (array_key_exists(4, $arrNetwork)) { - $networks[$arrNetwork[4]]['RSSI'] = $arrNetwork[2]; + // Save RSSI, if the current value is larger than the already stored + if (array_key_exists(4, $arrNetwork) && array_key_exists($arrNetwork[4],$networks)) { + if(! array_key_exists('RSSI',$networks[$arrNetwork[4]]) || $networks[$ssid]['RSSI'] < $arrNetwork[2]) + $networks[$ssid]['RSSI'] = $arrNetwork[2]; } + } } @@ -98,3 +110,18 @@ function connectedWifiStations(&$networks) } } } + +function sortNetworksByRSSI(&$networks) { + $valRSSI = array(); + foreach ($networks as $SSID => $net) { + if (!array_key_exists('RSSI',$net)) $net['RSSI'] = -1000; + $valRSSI[$SSID] = $net['RSSI']; + } + $nets = $networks; + arsort($valRSSI); + $networks = array(); + foreach ($valRSSI as $SSID => $RSSI) { + $networks[$SSID] = $nets[$SSID]; + $networks[$SSID]['RSSI'] = $RSSI; + } +} diff --git a/templates/wifi_stations.php b/templates/wifi_stations.php index 1769cc9e..cdfcb654 100755 --- a/templates/wifi_stations.php +++ b/templates/wifi_stations.php @@ -40,16 +40,15 @@
- = -50) { - echo 100; - } elseif ($network['RSSI'] <= -100) { - echo 0; - } else { - echo 2*($network['RSSI'] + 100); - } - echo "%)"; + = -200 ) { + echo htmlspecialchars($network['RSSI'], ENT_QUOTES); + echo "dB ("; + if ($network['RSSI'] >= -50) echo 100; + elseif ($network['RSSI'] <= -100) echo 0; + else echo 2*($network['RSSI'] + 100); + echo "%)"; + } else echo " not found "; ?>
From 1a8ffd94fcfc68d3a3c850f7ddfbf55a2facc019 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 24 May 2020 08:24:42 +0100 Subject: [PATCH 022/128] Replaced tabs w/ spaces, applied PSR-2 code standard --- includes/wifi_functions.php | 56 ++++++++++--------- templates/wifi_stations.php | 104 +++++++++++++++++++----------------- 2 files changed, 87 insertions(+), 73 deletions(-) diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index d7194b56..eb1e8d92 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -52,7 +52,8 @@ function nearbyWifiStations(&$networks, $cached = true) } $scan_results = cache( - $cacheKey, function () { + $cacheKey, + function () { exec('sudo wpa_cli -i ' . RASPI_WIFI_CLIENT_INTERFACE . ' scan'); sleep(3); @@ -63,18 +64,22 @@ function nearbyWifiStations(&$networks, $cached = true) } ); - // get the name of the AP - should be excluded von the nearby networks - exec('cat '.RASPI_HOSTAPD_CONFIG.' | sed -rn "s/ssid=(.*)\s*$/\1/p" ',$ap_ssid); + // get the name of the AP. Should be excluded from nearby networks + exec('cat '.RASPI_HOSTAPD_CONFIG.' | sed -rn "s/ssid=(.*)\s*$/\1/p" ', $ap_ssid); $ap_ssid = $ap_ssid[0]; - - foreach (explode("\n", $scan_results) as $network) { - $arrNetwork = preg_split("/[\t]+/", $network); // split result into array + + foreach (explode("\n", $scan_results) as $network) { + $arrNetwork = preg_split("/[\t]+/", $network); // split result into array if (!array_key_exists(4, $arrNetwork) || - trim($arrNetwork[4]) == $ap_ssid) continue; + trim($arrNetwork[4]) == $ap_ssid) { + continue; + } $ssid = trim($arrNetwork[4]); - // filter SSID string - anything invisable in 7bit ASCII or quotes -> ignore network - if( preg_match('[\x00-\x1f\x7f-\xff\'\`\\"]',$ssid)) continue; + // filter SSID string: anything invisible in 7bit ASCII or quotes -> ignore network + if (preg_match('[\x00-\x1f\x7f-\xff\'\`\\"]', $ssid)) { + continue; + } // If network is saved if (array_key_exists($ssid, $networks)) { @@ -93,11 +98,11 @@ function nearbyWifiStations(&$networks, $cached = true) } // Save RSSI, if the current value is larger than the already stored - if (array_key_exists(4, $arrNetwork) && array_key_exists($arrNetwork[4],$networks)) { - if(! array_key_exists('RSSI',$networks[$arrNetwork[4]]) || $networks[$ssid]['RSSI'] < $arrNetwork[2]) + if (array_key_exists(4, $arrNetwork) && array_key_exists($arrNetwork[4], $networks)) { + if (! array_key_exists('RSSI', $networks[$arrNetwork[4]]) || $networks[$ssid]['RSSI'] < $arrNetwork[2]) { $networks[$ssid]['RSSI'] = $arrNetwork[2]; + } } - } } @@ -111,17 +116,20 @@ function connectedWifiStations(&$networks) } } -function sortNetworksByRSSI(&$networks) { - $valRSSI = array(); - foreach ($networks as $SSID => $net) { - if (!array_key_exists('RSSI',$net)) $net['RSSI'] = -1000; - $valRSSI[$SSID] = $net['RSSI']; - } - $nets = $networks; - arsort($valRSSI); - $networks = array(); - foreach ($valRSSI as $SSID => $RSSI) { - $networks[$SSID] = $nets[$SSID]; - $networks[$SSID]['RSSI'] = $RSSI; +function sortNetworksByRSSI(&$networks) +{ + $valRSSI = array(); + foreach ($networks as $SSID => $net) { + if (!array_key_exists('RSSI', $net)) { + $net['RSSI'] = -1000; } + $valRSSI[$SSID] = $net['RSSI']; + } + $nets = $networks; + arsort($valRSSI); + $networks = array(); + foreach ($valRSSI as $SSID => $RSSI) { + networks[$SSID] = $nets[$SSID]; + $networks[$SSID]['RSSI'] = $RSSI; + } } diff --git a/templates/wifi_stations.php b/templates/wifi_stations.php index cdfcb654..d6705628 100755 --- a/templates/wifi_stations.php +++ b/templates/wifi_stations.php @@ -16,40 +16,46 @@ } ?>
-
+
- - - - - - - + + + + + +
-
+
- - - - X - + + + + X +
-
+
- = -200 ) { - echo htmlspecialchars($network['RSSI'], ENT_QUOTES); - echo "dB ("; - if ($network['RSSI'] >= -50) echo 100; - elseif ($network['RSSI'] <= -100) echo 0; - else echo 2*($network['RSSI'] + 100); + = -200) { + echo htmlspecialchars($network['RSSI'], ENT_QUOTES); + echo "dB ("; + if ($network['RSSI'] >= -50) { + echo 100; + } elseif ($network['RSSI'] <= -100) { + echo 0; + } else { + echo 2*($network['RSSI'] + 100); + } echo "%)"; - } else echo " not found "; - ?> + } else { + echo " not found "; + } + ?>
@@ -57,35 +63,35 @@ -
+
-
-
+
+
- - - - -
- -
- -
-
+ + + + +
+ +
+ +
+
-
- - " id="update" name="update" /> - - - " id="update" name="update" /> - - " name="delete" /> -
+
+ + " id="update" name="update" /> + + + " id="update" name="update" /> + + " name="delete" /> +
- - + + From eb6f2c5db70f96d4afcc5f56354efe979e4b593c Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 24 May 2020 08:30:32 +0100 Subject: [PATCH 023/128] Fix build error --- includes/wifi_functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index eb1e8d92..248cbda0 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -129,7 +129,7 @@ function sortNetworksByRSSI(&$networks) arsort($valRSSI); $networks = array(); foreach ($valRSSI as $SSID => $RSSI) { - networks[$SSID] = $nets[$SSID]; + $networks[$SSID] = $nets[$SSID]; $networks[$SSID]['RSSI'] = $RSSI; } } From 4b7262a98b083bd6f771b7870379b016457de9cd Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 26 May 2020 07:49:04 +0100 Subject: [PATCH 024/128] Remove 802.11w option from UI --- includes/hostapd.php | 1 - 1 file changed, 1 deletion(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index 38908754..088fb67b 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -18,7 +18,6 @@ function DisplayHostAPDConfig() 'b' => '802.11b - 2.4 GHz', 'g' => '802.11g - 2.4 GHz', 'n' => '802.11n - 2.4 GHz', - 'w' => '802.11w - 2.4 Ghz', 'ac' => '802.11.ac - 5 GHz' ]; $arrSecurity = array(1 => 'WPA', 2 => 'WPA2', 3 => 'WPA+WPA2', 'none' => _("None")); From 68fb14c390509b65bf44c4ac4b7b191984f41170 Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Tue, 26 May 2020 08:52:40 +0200 Subject: [PATCH 025/128] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c19bef5e..33025128 100644 --- a/README.md +++ b/README.md @@ -80,9 +80,9 @@ By default RaspAP configures a routed AP for your clients to connect to. A bridg More information on Bridged AP mode is provided [on our wiki](https://github.com/billz/raspap-webgui/wiki/Bridged-AP-mode). ## Simultaneous AP and Wifi client -RaspAP lets you easily create an AP with a Wifi client configuration. With your system configured in managed mode, enable the AP from the **Advanced** tab of **Configure hotspot** by sliding the **Wifi client AP mode** toggle. Save settings and start the hotspot. The managed mode AP is functional without restart. +RaspAP lets you create an AP with a Wifi client configuration, often called AP-STA mode. With your system configured in managed mode, enable the AP from the **Advanced** tab of **Configure hotspot** by sliding the **Wifi client AP mode** toggle. Save settings and start the hotspot. The managed mode AP is functional without restart. -**Note:** This option is disabled until you configure your system as a wireless client. For a device operating in [managed mode](https://github.com/billz/raspap-webgui/wiki/FAQs#how-do-i-prepare-the-sd-card-to-connect-to-wifi-in-headless-mode) without an `eth0` connection, this configuration must be enabled _before_ a reboot. +**Note:** This option is disabled until you configure your system as a wireless client. For a device operating in [managed mode](https://github.com/billz/raspap-webgui/wiki/FAQs#how-do-i-prepare-the-sd-card-to-connect-to-wifi-in-headless-mode) without an `eth0` connection, this configuration must be enabled [_before_ a reboot](https://github.com/billz/raspap-webgui/wiki/RPi-Zero-W-AP-STA-mode). ## Support us RaspAP is free software, but powered by your support. If you find RaspAP useful for your personal or commercial projects, please [become a GitHub sponsor](https://github.com/sponsors/billz), join the project on [Open Collective](https://opencollective.com/raspap) or make a one-time donation with [PayPal](https://www.paypal.com/paypalme2/billzgithub). Any of these options makes a big difference! From 7410b45c05dab6f6a916fdfc0459cebd6e7f9f77 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 27 May 2020 08:31:54 +0100 Subject: [PATCH 026/128] Return model info for non-Pi devices --- includes/system.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/system.php b/includes/system.php index a5e86010..1d885b1e 100755 --- a/includes/system.php +++ b/includes/system.php @@ -51,7 +51,12 @@ function RPiVersion() if (array_key_exists($rev, $revisions)) { return $revisions[$rev]; } else { - return 'Unknown Pi'; + exec('cat /proc/device-tree/model', $model); + if (isset($model[0])) { + return $model[0]; + } else { + return 'Unknown Device'; + } } } From 74723f0de32e68fc5555533b8f52908ad59f0972 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 27 May 2020 09:04:16 +0100 Subject: [PATCH 027/128] Update uninstaller. Resolves #593 --- installers/uninstall.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/installers/uninstall.sh b/installers/uninstall.sh index e89ece5c..542ddc65 100755 --- a/installers/uninstall.sh +++ b/installers/uninstall.sh @@ -20,6 +20,7 @@ readonly raspap_user="www-data" readonly raspap_sudoers="/etc/sudoers.d/090_raspap" readonly raspap_dnsmasq="/etc/dnsmasq.d/090_raspap.conf" readonly raspap_sysctl="/etc/sysctl.d/90_raspap.conf" +readonly raspap_network="/etc/systemd/network/" readonly rulesv4="/etc/iptables/rules.v4" webroot_dir="/var/www/html" @@ -44,13 +45,13 @@ function _get_linux_distro() { # Sets php package option based on Linux version, abort if unsupported distro function _set_php_package() { case $RELEASE in - "18.04"|"19.10") # Ubuntu Server + 18.04|19.10) # Ubuntu Server php_package="php7.4-cgi" phpcgiconf="/etc/php/7.4/cgi/php.ini" ;; - "10") + 10*) php_package="php7.3-cgi" phpcgiconf="/etc/php/7.3/cgi/php.ini" ;; - "9") + 9*) php_package="php7.0-cgi" phpcgiconf="/etc/php/7.0/cgi/php.ini" ;; esac @@ -148,7 +149,7 @@ function _remove_raspap_service() { function _restore_networking() { _install_log "Restoring networking config to pre-install defaults" echo "Disabling IP forwarding in $raspap_sysctl" - sudo rm $raspap_sysctl || _install_error "Unable to remove $raspap_sysctl" + sudo rm "$raspap_sysctl" || _install_error "Unable to remove $raspap_sysctl" sudo /etc/init.d/procps restart || _install_error "Unable to execute procps" echo "Checking iptables rules" rules=( @@ -169,6 +170,11 @@ function _restore_networking() { sudo iptables-save | sudo tee $rulesv4 > /dev/null || _install_error "Unable to execute iptables-save" fi echo "Done." + # Remove dnsmasq and bridge configs + echo "Removing 090_raspap.conf from dnsmasq" + sudo rm "$raspap_dnsmasq" || _install_error "Unable to remove $raspap_dnsmasq" + echo "Removing raspap bridge configurations" + sudo rm "$raspap_network"/raspap* || _install_error "Unable to remove bridge config" } # Removes installed packages From 7cc196f4f5284255ed8173e928cb5f6793fb82e5 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 27 May 2020 09:40:44 +0100 Subject: [PATCH 028/128] Update release version --- README.md | 2 +- config/config.php | 2 +- includes/defaults.php | 2 +- index.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 33025128..8ed48f5a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![](https://i.imgur.com/xeKD93p.png) -[![Release 2.4](https://img.shields.io/badge/Release-2.4-green.svg)](https://github.com/billz/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/billz/raspap-webgui/](https://img.shields.io/travis/com/billz/raspap-webgui/master) [![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.4.1](https://img.shields.io/badge/Release-2.4.1-green.svg)](https://github.com/billz/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/billz/raspap-webgui/](https://img.shields.io/travis/com/billz/raspap-webgui/master) [![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 WiFi 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/config/config.php b/config/config.php index f638b2a7..faa08855 100755 --- a/config/config.php +++ b/config/config.php @@ -1,6 +1,6 @@ '2.4', + 'RASPI_VERSION' => '2.4.1', 'RASPI_CONFIG_NETWORKING' => RASPI_CONFIG.'/networking', 'RASPI_ADMIN_DETAILS' => RASPI_CONFIG.'/raspap.auth', 'RASPI_WIFI_CLIENT_INTERFACE' => 'wlan0', diff --git a/index.php b/index.php index 136c72b9..d6682b8e 100755 --- a/index.php +++ b/index.php @@ -13,7 +13,7 @@ * @author Lawrence Yau * @author Bill Zimmerman * @license GNU General Public License, version 3 (GPL-3.0) - * @version 2.4 + * @version 2.4.1 * @link https://github.com/billz/raspap-webgui * @see http://sirlagz.net/2013/02/08/raspap-webgui/ */ From 7393d220ef8933f63ed8715ad77c700f4b317ca4 Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Tue, 2 Jun 2020 00:11:30 +0200 Subject: [PATCH 029/128] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ed48f5a..c63e289e 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ We hope you enjoy using RaspAP as much as we do creating it. Tell us how you use - [License](#license) ## Prerequisites -Start with a clean install of the [latest release of Raspbian](https://www.raspberrypi.org/downloads/raspbian/) (currently Buster). Raspbian Buster Lite is recommended. +Start with a clean install of the [latest release of Raspberry Pi OS (32-bit)](https://www.raspberrypi.org/downloads/raspbian/). Raspberry Pi OS (32-bit) Lite is recommended. 1. Update Raspbian, including the kernel and firmware, followed by a reboot: ``` From 1a59c06d42ea28ec7265bf8916f159f83baec680 Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Tue, 2 Jun 2020 00:22:10 +0200 Subject: [PATCH 030/128] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c63e289e..26953185 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ RaspAP was originally made for Raspbian, but now also installs on the following | Distribution | Release | Architecture | Support | |---|:---:|:---:|:---:| -| Raspbian | Buster | ARM | Official | +| Raspberry Pi OS | (32-bit) Lite Buster | ARM | Official | | Armbian | Buster | [ARM](https://docs.armbian.com/#supported-chips) | Official | | Debian | Buster | ARM / x86_64 | Beta | | Ubuntu | 18.04 LTS / 19.10 | ARM / x86_64 | Beta | From d13c77bd2f5a2d74c47d2d48719e1de58729ce16 Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Wed, 3 Jun 2020 23:32:32 +0200 Subject: [PATCH 031/128] Write required options to dhcpcd.conf --- includes/hostapd.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index 91aa6182..34fbfd59 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -304,9 +304,18 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $domain_name_server = ($intConfig['domain_name_server'] =='') ? '1.1.1.1 8.8.8.8' : $intConfig['domain_name_server']; $routers = ($intConfig['routers'] == '') ? '10.3.141.1' : $intConfig['routers']; - // load the defaults for dhcpcd.conf - $config = file_get_contents(RASPI_CONFIG_NETWORKING.'/defaults')."\n\n"; - $config = explode('\n', $config); + // write options to dhcpcd.conf + $config = [ '# RaspAP '.$_POST['interface'].' configuration' ]; + $config[] = 'hostname'; + $config[] = 'clientid'; + $config[] = 'persistent'; + $config[] = 'option rapid_commit'; + $config[] = 'option domain_name_servers, domain_name, domain_search, host_name'; + $config[] = 'option classless_static_routes'; + $config[] = 'option ntp_servers'; + $config[] = 'require dhcp_server_identifier'; + $config[] = 'slaac private'; + $config[] = 'nohook lookup-hostname'; if ($bridgedEnable == 1) { $config[] = 'denyinterfaces eth0 wlan0'; From e390c00a2b80e9533fa2223ae444404a0c70e0d0 Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Wed, 3 Jun 2020 23:33:43 +0200 Subject: [PATCH 032/128] Get interface of AP from hostapd config file --- templates/dashboard.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/dashboard.php b/templates/dashboard.php index e79dbf8d..cef8190b 100755 --- a/templates/dashboard.php +++ b/templates/dashboard.php @@ -5,8 +5,8 @@ if ($arrHostapdConf['WifiAPEnable'] == 1) { } else { $client_iface = RASPI_WIFI_CLIENT_INTERFACE; } -exec('cat '.RASPI_HOSTAPD_CONFIG.' | sed -rn "s/interface=(wlan[0-9])/\1/p" ',$ap_iface); -$ap_iface = $ap_iface[0]; +$pars=parse_ini_file(RASPI_HOSTAPD_CONFIG,false,INI_SCANNER_RAW ); +$ap_iface = $pars['interface']; $MACPattern = '"([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"'; if ($arrHostapdConf['BridgedEnable'] == 1) { $moreLink = "index.php?page=hostapd_conf"; From 677a6c52b0a25da298d08b30abf1dde4c94e59ce Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 7 Jun 2020 14:23:40 +0100 Subject: [PATCH 033/128] Get/set wireless iface from ini, store in _SESSION --- includes/hostapd.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index 34fbfd59..67f93255 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -4,6 +4,15 @@ require_once 'includes/status_messages.php'; require_once 'app/lib/system.php'; require_once 'config.php'; +if (empty($_SESSION['client_iface'])) { + $arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini'); + if (isset($arrHostapdConf['WifiInterface'])) { + $_SESSION['client_iface'] = $arrHostapdConf['WifiInterface']; + } else { // fallback to default + $_SESSSION['client_iface'] = RASPI_WIFI_CLIENT_INTERFACE; + } +} + /** * * @@ -146,27 +155,28 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) if ($arrHostapdConf['LogEnable'] == 0) { if (isset($_POST['logEnable'])) { $logEnable = 1; - exec('sudo /etc/raspap/hostapd/enablelog.sh'); + exec('sudo '.RASPI_CONFIG.'/hostapd/enablelog.sh'); } else { - exec('sudo /etc/raspap/hostapd/disablelog.sh'); + exec('sudo '.RASPI_CONFIG.'/hostapd/disablelog.sh'); } } else { if (isset($_POST['logEnable'])) { $logEnable = 1; - exec('sudo /etc/raspap/hostapd/enablelog.sh'); + exec('sudo '.RASPI_CONFIG.'/hostapd/enablelog.sh'); } else { - exec('sudo /etc/raspap/hostapd/disablelog.sh'); + exec('sudo '.RASPI_CONFIG.'/hostapd/disablelog.sh'); } } $cfg = []; + $cfg['WifiInterface'] = $_POST['interface']; $cfg['LogEnable'] = $logEnable; // Save previous Client mode status when Bridged $cfg['WifiAPEnable'] = ($bridgedEnable == 1 ? $arrHostapdConf['WifiAPEnable'] : $wifiAPEnable); $cfg['BridgedEnable'] = $bridgedEnable; $cfg['WifiManaged'] = $_POST['interface']; - write_php_ini($cfg, '/etc/raspap/hostapd.ini'); + write_php_ini($cfg, RASPI_CONFIG.'/hostapd.ini'); // Verify input if (empty($_POST['ssid']) || strlen($_POST['ssid']) > 32) { @@ -335,11 +345,8 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) if (preg_match("/^([0-9]{1,3}\.){3}/",$dhcp_range,$def_ip) ) $ip_address = $def_ip[0]."1/24"; // use static IP assigned to interface only, if consistent with the selected dhcp range if (preg_match("/^([0-9]{1,3}\.){3}/",$intConfig['ip_address'],$int_ip) && $def_ip[0] === $int_ip[0]) $ip_address = $intConfig['ip_address']; - - $routers = ""; // NO default route to be set for the hotspot. This screws up the routing! $config[] = 'interface '.$_POST['interface']; $config[] = 'static ip_address='.$ip_address; - $config[] = 'static routers='.$routers; $config[] = 'static domain_name_server='.$domain_name_server; $config[] = PHP_EOL; From b14175ab0c901854dfc3d70c32b71f7a41a4979a Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 7 Jun 2020 14:25:28 +0100 Subject: [PATCH 034/128] Replace interface constant with _SESSION value --- includes/configure_client.php | 5 +++-- includes/dashboard.php | 24 ++++++++++++------------ includes/openvpn.php | 3 ++- includes/wifi_functions.php | 5 +++-- templates/dashboard.php | 4 ++-- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/includes/configure_client.php b/includes/configure_client.php index 4e0b001f..9552dae7 100755 --- a/includes/configure_client.php +++ b/includes/configure_client.php @@ -2,6 +2,7 @@ require_once 'includes/status_messages.php'; require_once 'includes/wifi_functions.php'; +require_once 'includes/hostapd.php'; /** * @@ -16,7 +17,7 @@ function DisplayWPAConfig() if (isset($_POST['connect'])) { $result = 0; - exec('sudo wpa_cli -i ' . RASPI_WIFI_CLIENT_INTERFACE . ' select_network '.strval($_POST['connect'])); + exec('sudo wpa_cli -i ' . $_SESSION['client_iface'] . ' select_network '.strval($_POST['connect'])); $status->addMessage('New network selected', 'success'); } elseif (isset($_POST['client_settings'])) { $tmp_networks = $networks; @@ -76,7 +77,7 @@ function DisplayWPAConfig() if ($ok) { system('sudo cp /tmp/wifidata ' . RASPI_WPA_SUPPLICANT_CONFIG, $returnval); if ($returnval == 0) { - exec('sudo wpa_cli -i ' . RASPI_WIFI_CLIENT_INTERFACE . ' reconfigure', $reconfigure_out, $reconfigure_return); + exec('sudo wpa_cli -i ' . $_SESSION['client_iface'] . ' reconfigure', $reconfigure_out, $reconfigure_return); if ($reconfigure_return == 0) { $status->addMessage('Wifi settings updated successfully', 'success'); $networks = $tmp_networks; diff --git a/includes/dashboard.php b/includes/dashboard.php index 1820a4fd..aa31a9eb 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -1,6 +1,7 @@ addMessage(_('Interface name invalid.'), 'danger'); $status->showMessages(); return; @@ -22,7 +23,7 @@ function DisplayDashboard(&$extraFooterScripts) return; } - exec('ip a show '.RASPI_WIFI_CLIENT_INTERFACE, $stdoutIp); + exec('ip a show '.$_SESSION['client_iface'], $stdoutIp); $stdoutIpAllLinesGlued = implode(" ", $stdoutIp); $stdoutIpWRepeatedSpaces = preg_replace('/\s\s+/', ' ', $stdoutIpAllLinesGlued); @@ -61,26 +62,26 @@ function DisplayDashboard(&$extraFooterScripts) // Because of table layout used in the ip output we get the interface statistics directly from // the system. One advantage of this is that it could work when interface is disable. - exec('cat /sys/class/net/'.RASPI_WIFI_CLIENT_INTERFACE.'/statistics/rx_packets ', $stdoutCatRxPackets); + exec('cat /sys/class/net/'.$_SESSION['client_iface'].'/statistics/rx_packets ', $stdoutCatRxPackets); $strRxPackets = _('No data'); if (ctype_digit($stdoutCatRxPackets[0])) { $strRxPackets = $stdoutCatRxPackets[0]; } - exec('cat /sys/class/net/'.RASPI_WIFI_CLIENT_INTERFACE.'/statistics/tx_packets ', $stdoutCatTxPackets); + exec('cat /sys/class/net/'.$_SESSION['client_iface'].'/statistics/tx_packets ', $stdoutCatTxPackets); $strTxPackets = _('No data'); if (ctype_digit($stdoutCatTxPackets[0])) { $strTxPackets = $stdoutCatTxPackets[0]; } - exec('cat /sys/class/net/'.RASPI_WIFI_CLIENT_INTERFACE.'/statistics/rx_bytes ', $stdoutCatRxBytes); + exec('cat /sys/class/net/'.$_SESSION['client_iface'].'/statistics/rx_bytes ', $stdoutCatRxBytes); $strRxBytes = _('No data'); if (ctype_digit($stdoutCatRxBytes[0])) { $strRxBytes = $stdoutCatRxBytes[0]; $strRxBytes .= getHumanReadableDatasize($strRxBytes); } - exec('cat /sys/class/net/'.RASPI_WIFI_CLIENT_INTERFACE.'/statistics/tx_bytes ', $stdoutCatTxBytes); + exec('cat /sys/class/net/'.$_SESSION['client_iface'].'/statistics/tx_bytes ', $stdoutCatTxBytes); $strTxBytes = _('No data'); if (ctype_digit($stdoutCatTxBytes[0])) { $strTxBytes = $stdoutCatTxBytes[0]; @@ -89,7 +90,7 @@ function DisplayDashboard(&$extraFooterScripts) define('SSIDMAXLEN', 32); // Warning iw comes with: "Do NOT screenscrape this tool, we don't consider its output stable." - exec('iw dev '.RASPI_WIFI_CLIENT_INTERFACE.' link ', $stdoutIw); + exec('iw dev '.$_SESSION['client_iface'].' link ', $stdoutIw); $stdoutIwAllLinesGlued = implode(' ', $stdoutIw); $stdoutIwWRepSpaces = preg_replace('/\s\s+/', ' ', $stdoutIwAllLinesGlued); @@ -121,7 +122,7 @@ function DisplayDashboard(&$extraFooterScripts) $bitrate = empty($bitrate) ? "-" : $bitrate; // txpower is now displayed on iw dev(..) info command, not on link command. - exec('iw dev '.RASPI_WIFI_CLIENT_INTERFACE.' info ', $stdoutIwInfo); + exec('iw dev '.$_SESSION['client_iface'].' info ', $stdoutIwInfo); $stdoutIwInfoAllLinesGlued = implode(' ', $stdoutIwInfo); $stdoutIpInfoWRepSpaces = preg_replace('/\s\s+/', ' ', $stdoutIwInfoAllLinesGlued); @@ -147,13 +148,12 @@ function DisplayDashboard(&$extraFooterScripts) $classMsgDevicestatus = 'success'; } - if (!RASPI_MONITOR_ENABLED) { if (isset($_POST['ifdown_wlan0'])) { // Pressed stop button if ($interfaceState === 'UP') { $status->addMessage(sprintf(_('Interface is going %s.'), _('down')), 'warning'); - exec('sudo ip link set '.RASPI_WIFI_CLIENT_INTERFACE.' down'); + exec('sudo ip link set '.$_SESSION['client_iface'].' down'); $wlan0up = false; $status->addMessage(sprintf(_('Interface is now %s.'), _('down')), 'success'); } elseif ($interfaceState === 'unknown') { @@ -165,8 +165,8 @@ function DisplayDashboard(&$extraFooterScripts) // Pressed start button if ($interfaceState === 'DOWN') { $status->addMessage(sprintf(_('Interface is going %s.'), _('up')), 'warning'); - exec('sudo ip link set ' . RASPI_WIFI_CLIENT_INTERFACE . ' up'); - exec('sudo ip -s a f label ' . RASPI_WIFI_CLIENT_INTERFACE); + exec('sudo ip link set ' .$_SESSION['client_iface']. ' up'); + exec('sudo ip -s a f label ' . $_SESSION['client_iface']); $wlan0up = true; $status->addMessage(sprintf(_('Interface is now %s.'), _('up')), 'success'); } elseif ($interfaceState === 'unknown') { diff --git a/includes/openvpn.php b/includes/openvpn.php index 5fc11e63..e5a22b30 100755 --- a/includes/openvpn.php +++ b/includes/openvpn.php @@ -1,6 +1,7 @@ addMessage($line, 'info'); } diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index d8a8ce20..199d6391 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -1,6 +1,7 @@ Date: Sun, 7 Jun 2020 16:42:40 +0200 Subject: [PATCH 035/128] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 26953185..32bde5b4 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ We hope you enjoy using RaspAP as much as we do creating it. Tell us how you use - [License](#license) ## Prerequisites -Start with a clean install of the [latest release of Raspberry Pi OS (32-bit)](https://www.raspberrypi.org/downloads/raspbian/). Raspberry Pi OS (32-bit) Lite is recommended. +Start with a clean install of the [latest release of Raspberry Pi OS (32-bit) Lite](https://www.raspberrypi.org/downloads/raspbian/). The Raspberry Pi OS desktop and 64-bit beta distros are unsupported. 1. Update Raspbian, including the kernel and firmware, followed by a reboot: ``` From e3c378427be688c2332ae563a395f7a62b9843e7 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 7 Jun 2020 17:13:43 +0100 Subject: [PATCH 036/128] Added getWifiInterface --- includes/wifi_functions.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index 199d6391..1125c0e2 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -92,10 +92,23 @@ function nearbyWifiStations(&$networks, $cached = true) function connectedWifiStations(&$networks) { - exec('iwconfig ' . RASPI_WIFI_CLIENT_INTERFACE, $iwconfig_return); + exec('iwconfig ' .$_SESSION['client_iface'], $iwconfig_return); foreach ($iwconfig_return as $line) { if (preg_match('/ESSID:\"([^"]+)\"/i', $line, $iwconfig_ssid)) { $networks[$iwconfig_ssid[1]]['connected'] = true; } } } + +function getWifiInterface() +{ + if (empty($_SESSION['client_iface'])) { + $arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini'); + if (isset($arrHostapdConf['WifiInterface'])) { + $_SESSION['client_iface'] = $arrHostapdConf['WifiInterface']; + } else { // fallback to default + $_SESSSION['client_iface'] = RASPI_WIFI_CLIENT_INTERFACE; + } + } +} + From a1940ae8f26a3ba471a3df5f359ef3c225222cbb Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 7 Jun 2020 17:15:13 +0100 Subject: [PATCH 037/128] Update w/ session var, fix indents --- templates/dashboard.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/dashboard.php b/templates/dashboard.php index 2e0f2c58..9d18e68d 100755 --- a/templates/dashboard.php +++ b/templates/dashboard.php @@ -1,19 +1,19 @@ From a6a92235f909d10953d37d1b2e58fda8bd43be20 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 7 Jun 2020 17:17:16 +0100 Subject: [PATCH 038/128] Add include wifi_functions getWifiInterface() --- includes/configure_client.php | 2 +- includes/dashboard.php | 6 +++--- includes/hostapd.php | 11 ++--------- includes/openvpn.php | 6 ++++-- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/includes/configure_client.php b/includes/configure_client.php index 9552dae7..e6892004 100755 --- a/includes/configure_client.php +++ b/includes/configure_client.php @@ -2,7 +2,6 @@ require_once 'includes/status_messages.php'; require_once 'includes/wifi_functions.php'; -require_once 'includes/hostapd.php'; /** * @@ -13,6 +12,7 @@ function DisplayWPAConfig() $status = new StatusMessages(); $networks = []; + getWifiInterface(); knownWifiStations($networks); if (isset($_POST['connect'])) { diff --git a/includes/dashboard.php b/includes/dashboard.php index aa31a9eb..79c3e545 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -1,14 +1,14 @@ Date: Sun, 7 Jun 2020 17:25:11 +0100 Subject: [PATCH 039/128] Add includes/config --- includes/hostapd.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/hostapd.php b/includes/hostapd.php index 8ae41091..2f662e32 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -3,6 +3,7 @@ require_once 'includes/status_messages.php'; require_once 'app/lib/system.php'; require_once 'includes/wifi_functions.php'; +require_once 'includes/config.php'; getWifiInterface(); From 9fb59918cfd6ae4ef0253a4259319441755e3e7c Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 7 Jun 2020 18:46:14 +0100 Subject: [PATCH 040/128] Fix: Update session var when saving cfg --- includes/hostapd.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/hostapd.php b/includes/hostapd.php index 2f662e32..9702c33c 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -171,6 +171,7 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $cfg['BridgedEnable'] = $bridgedEnable; $cfg['WifiManaged'] = $_POST['interface']; write_php_ini($cfg, RASPI_CONFIG.'/hostapd.ini'); + $_SESSION['client_iface'] = $_POST['interface']; // Verify input if (empty($_POST['ssid']) || strlen($_POST['ssid']) > 32) { From 43819ddfd2f3cf8afcf732358b8fe56c79e92ea5 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 7 Jun 2020 19:12:00 +0100 Subject: [PATCH 041/128] Fix require path --- includes/hostapd.php | 2 +- includes/wifi_functions.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index 9702c33c..f9e7c9ce 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -1,6 +1,6 @@ Date: Mon, 8 Jun 2020 09:16:10 +0100 Subject: [PATCH 042/128] Bugfix: typo --- includes/wifi_functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index bde2f771..2969c517 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -140,7 +140,7 @@ function getWifiInterface() if (isset($arrHostapdConf['WifiInterface'])) { $_SESSION['client_iface'] = $arrHostapdConf['WifiInterface']; } else { // fallback to default - $_SESSSION['client_iface'] = RASPI_WIFI_CLIENT_INTERFACE; + $_SESSION['client_iface'] = RASPI_WIFI_CLIENT_INTERFACE; } } } From 633f389f4ed967deeabb87deedef6c5416c7f469 Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Tue, 9 Jun 2020 10:15:21 +0200 Subject: [PATCH 043/128] Check for second wifi interface as wifi client --- includes/wifi_functions.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index 2969c517..f907536c 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -138,7 +138,10 @@ function getWifiInterface() if (empty($_SESSION['client_iface'])) { $arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini'); if (isset($arrHostapdConf['WifiInterface'])) { - $_SESSION['client_iface'] = $arrHostapdConf['WifiInterface']; + $iface = $arrHostapdConf['WifiInterface']; + // check for 2nd wifi interface + exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2); + $_SESSION['client_iface'] = empty($iface2) ? $iface : trim($iface2[0]); } else { // fallback to default $_SESSION['client_iface'] = RASPI_WIFI_CLIENT_INTERFACE; } From e9470aaf7fc88bd5dc3a6d6e3266d76e17d3fbf9 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 9 Jun 2020 13:09:58 +0100 Subject: [PATCH 044/128] Get 1st wireless iface, fixes client dashboard widget --- includes/dashboard.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/dashboard.php b/includes/dashboard.php index 79c3e545..1d46b67f 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -90,7 +90,11 @@ function DisplayDashboard(&$extraFooterScripts) define('SSIDMAXLEN', 32); // Warning iw comes with: "Do NOT screenscrape this tool, we don't consider its output stable." - exec('iw dev '.$_SESSION['client_iface'].' link ', $stdoutIw); + // fetch first wireless interface + $iface = $_SESSION['client_iface']; + exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2); + $host_iface = empty($iface2) ? $iface1 : trim($iface2[0]); + exec('iw dev ' .$host_iface. ' link ', $stdoutIw); $stdoutIwAllLinesGlued = implode(' ', $stdoutIw); $stdoutIwWRepSpaces = preg_replace('/\s\s+/', ' ', $stdoutIwAllLinesGlued); From 2ca9bf5b6f6ddddf6649cf9074423ddb1f31346f Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 9 Jun 2020 15:32:49 +0100 Subject: [PATCH 045/128] Rename ambiguous variable for clarity --- includes/configure_client.php | 4 ++-- includes/dashboard.php | 22 +++++++++++----------- includes/hostapd.php | 2 +- includes/openvpn.php | 2 +- includes/wifi_functions.php | 12 ++++++------ templates/dashboard.php | 10 +++++----- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/includes/configure_client.php b/includes/configure_client.php index fe45f6e7..22c3febb 100755 --- a/includes/configure_client.php +++ b/includes/configure_client.php @@ -17,7 +17,7 @@ function DisplayWPAConfig() if (isset($_POST['connect'])) { $result = 0; - exec('sudo wpa_cli -i ' . $_SESSION['client_iface'] . ' select_network '.strval($_POST['connect'])); + exec('sudo wpa_cli -i ' . $_SESSION['ap_interface'] . ' select_network '.strval($_POST['connect'])); $status->addMessage('New network selected', 'success'); } elseif (isset($_POST['client_settings'])) { $tmp_networks = $networks; @@ -77,7 +77,7 @@ function DisplayWPAConfig() if ($ok) { system('sudo cp /tmp/wifidata ' . RASPI_WPA_SUPPLICANT_CONFIG, $returnval); if ($returnval == 0) { - exec('sudo wpa_cli -i ' . $_SESSION['client_iface'] . ' reconfigure', $reconfigure_out, $reconfigure_return); + exec('sudo wpa_cli -i ' . $_SESSION['ap_interface'] . ' reconfigure', $reconfigure_out, $reconfigure_return); if ($reconfigure_return == 0) { $status->addMessage('Wifi settings updated successfully', 'success'); $networks = $tmp_networks; diff --git a/includes/dashboard.php b/includes/dashboard.php index 1d46b67f..77b94d5b 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -11,7 +11,7 @@ function DisplayDashboard(&$extraFooterScripts) getWifiInterface(); $status = new StatusMessages(); // Need this check interface name for proper shell execution. - if (!preg_match('/^([a-zA-Z0-9]+)$/', $_SESSION['client_iface'])) { + if (!preg_match('/^([a-zA-Z0-9]+)$/', $_SESSION['ap_interface'])) { $status->addMessage(_('Interface name invalid.'), 'danger'); $status->showMessages(); return; @@ -23,7 +23,7 @@ function DisplayDashboard(&$extraFooterScripts) return; } - exec('ip a show '.$_SESSION['client_iface'], $stdoutIp); + exec('ip a show '.$_SESSION['ap_interface'], $stdoutIp); $stdoutIpAllLinesGlued = implode(" ", $stdoutIp); $stdoutIpWRepeatedSpaces = preg_replace('/\s\s+/', ' ', $stdoutIpAllLinesGlued); @@ -62,26 +62,26 @@ function DisplayDashboard(&$extraFooterScripts) // Because of table layout used in the ip output we get the interface statistics directly from // the system. One advantage of this is that it could work when interface is disable. - exec('cat /sys/class/net/'.$_SESSION['client_iface'].'/statistics/rx_packets ', $stdoutCatRxPackets); + exec('cat /sys/class/net/'.$_SESSION['ap_interface'].'/statistics/rx_packets ', $stdoutCatRxPackets); $strRxPackets = _('No data'); if (ctype_digit($stdoutCatRxPackets[0])) { $strRxPackets = $stdoutCatRxPackets[0]; } - exec('cat /sys/class/net/'.$_SESSION['client_iface'].'/statistics/tx_packets ', $stdoutCatTxPackets); + exec('cat /sys/class/net/'.$_SESSION['ap_interface'].'/statistics/tx_packets ', $stdoutCatTxPackets); $strTxPackets = _('No data'); if (ctype_digit($stdoutCatTxPackets[0])) { $strTxPackets = $stdoutCatTxPackets[0]; } - exec('cat /sys/class/net/'.$_SESSION['client_iface'].'/statistics/rx_bytes ', $stdoutCatRxBytes); + exec('cat /sys/class/net/'.$_SESSION['ap_interface'].'/statistics/rx_bytes ', $stdoutCatRxBytes); $strRxBytes = _('No data'); if (ctype_digit($stdoutCatRxBytes[0])) { $strRxBytes = $stdoutCatRxBytes[0]; $strRxBytes .= getHumanReadableDatasize($strRxBytes); } - exec('cat /sys/class/net/'.$_SESSION['client_iface'].'/statistics/tx_bytes ', $stdoutCatTxBytes); + exec('cat /sys/class/net/'.$_SESSION['ap_interface'].'/statistics/tx_bytes ', $stdoutCatTxBytes); $strTxBytes = _('No data'); if (ctype_digit($stdoutCatTxBytes[0])) { $strTxBytes = $stdoutCatTxBytes[0]; @@ -91,7 +91,7 @@ function DisplayDashboard(&$extraFooterScripts) define('SSIDMAXLEN', 32); // Warning iw comes with: "Do NOT screenscrape this tool, we don't consider its output stable." // fetch first wireless interface - $iface = $_SESSION['client_iface']; + $iface = $_SESSION['ap_interface']; exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2); $host_iface = empty($iface2) ? $iface1 : trim($iface2[0]); exec('iw dev ' .$host_iface. ' link ', $stdoutIw); @@ -126,7 +126,7 @@ function DisplayDashboard(&$extraFooterScripts) $bitrate = empty($bitrate) ? "-" : $bitrate; // txpower is now displayed on iw dev(..) info command, not on link command. - exec('iw dev '.$_SESSION['client_iface'].' info ', $stdoutIwInfo); + exec('iw dev '.$_SESSION['ap_interface'].' info ', $stdoutIwInfo); $stdoutIwInfoAllLinesGlued = implode(' ', $stdoutIwInfo); $stdoutIpInfoWRepSpaces = preg_replace('/\s\s+/', ' ', $stdoutIwInfoAllLinesGlued); @@ -157,7 +157,7 @@ function DisplayDashboard(&$extraFooterScripts) // Pressed stop button if ($interfaceState === 'UP') { $status->addMessage(sprintf(_('Interface is going %s.'), _('down')), 'warning'); - exec('sudo ip link set '.$_SESSION['client_iface'].' down'); + exec('sudo ip link set '.$_SESSION['ap_interface'].' down'); $wlan0up = false; $status->addMessage(sprintf(_('Interface is now %s.'), _('down')), 'success'); } elseif ($interfaceState === 'unknown') { @@ -169,8 +169,8 @@ function DisplayDashboard(&$extraFooterScripts) // Pressed start button if ($interfaceState === 'DOWN') { $status->addMessage(sprintf(_('Interface is going %s.'), _('up')), 'warning'); - exec('sudo ip link set ' .$_SESSION['client_iface']. ' up'); - exec('sudo ip -s a f label ' . $_SESSION['client_iface']); + exec('sudo ip link set ' .$_SESSION['ap_interface']. ' up'); + exec('sudo ip -s a f label ' . $_SESSION['ap_interface']); $wlan0up = true; $status->addMessage(sprintf(_('Interface is now %s.'), _('up')), 'success'); } elseif ($interfaceState === 'unknown') { diff --git a/includes/hostapd.php b/includes/hostapd.php index f9e7c9ce..a2350cf9 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -171,7 +171,7 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $cfg['BridgedEnable'] = $bridgedEnable; $cfg['WifiManaged'] = $_POST['interface']; write_php_ini($cfg, RASPI_CONFIG.'/hostapd.ini'); - $_SESSION['client_iface'] = $_POST['interface']; + $_SESSION['ap_interface'] = $_POST['interface']; // Verify input if (empty($_POST['ssid']) || strlen($_POST['ssid']) > 32) { diff --git a/includes/openvpn.php b/includes/openvpn.php index 6a13b6de..6f9e40b5 100755 --- a/includes/openvpn.php +++ b/includes/openvpn.php @@ -149,7 +149,7 @@ function SaveOpenVPNConfig($status, $file, $authUser, $authPassword) } // Set iptables rules and, optionally, auth-user-pass - exec("sudo /etc/raspap/openvpn/configauth.sh $tmp_ovpnclient $auth_flag " .$_SESSION['client_iface'], $return); + exec("sudo /etc/raspap/openvpn/configauth.sh $tmp_ovpnclient $auth_flag " .$_SESSION['ap_interface'], $return); foreach ($return as $line) { $status->addMessage($line, 'info'); } diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index f907536c..9ad4cc40 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -53,10 +53,10 @@ function nearbyWifiStations(&$networks, $cached = true) $scan_results = cache( $cacheKey, function () { - exec('sudo wpa_cli -i ' .$_SESSION['client_iface']. ' scan'); + exec('sudo wpa_cli -i ' .$_SESSION['ap_interface']. ' scan'); sleep(3); - exec('sudo wpa_cli -i ' .$_SESSION['client_iface']. ' scan_results', $stdout); + exec('sudo wpa_cli -i ' .$_SESSION['ap_interface']. ' scan_results', $stdout); array_shift($stdout); return implode("\n", $stdout); @@ -107,7 +107,7 @@ function nearbyWifiStations(&$networks, $cached = true) function connectedWifiStations(&$networks) { - exec('iwconfig ' .$_SESSION['client_iface'], $iwconfig_return); + exec('iwconfig ' .$_SESSION['ap_interface'], $iwconfig_return); foreach ($iwconfig_return as $line) { if (preg_match('/ESSID:\"([^"]+)\"/i', $line, $iwconfig_ssid)) { $networks[$iwconfig_ssid[1]]['connected'] = true; @@ -135,15 +135,15 @@ function sortNetworksByRSSI(&$networks) function getWifiInterface() { - if (empty($_SESSION['client_iface'])) { + if (empty($_SESSION['ap_interface'])) { $arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini'); if (isset($arrHostapdConf['WifiInterface'])) { $iface = $arrHostapdConf['WifiInterface']; // check for 2nd wifi interface exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2); - $_SESSION['client_iface'] = empty($iface2) ? $iface : trim($iface2[0]); + $_SESSION['ap_interface'] = empty($iface2) ? $iface : trim($iface2[0]); } else { // fallback to default - $_SESSION['client_iface'] = RASPI_WIFI_CLIENT_INTERFACE; + $_SESSION['ap_interface'] = RASPI_WIFI_CLIENT_INTERFACE; } } } diff --git a/templates/dashboard.php b/templates/dashboard.php index 9d18e68d..2ad10123 100755 --- a/templates/dashboard.php +++ b/templates/dashboard.php @@ -1,9 +1,9 @@ @@ -128,9 +128,9 @@ $ifaceStatus = $wlan0up ? "up" : "down"; - " name="ifup_wlan0" /> + " name="ifup_wlan0" /> - " name="ifdown_wlan0" /> + " name="ifdown_wlan0" /> From 8ae1e5a8f271ee97bee73eeaea9b132de939c4b6 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 9 Jun 2020 15:34:19 +0100 Subject: [PATCH 046/128] Rename constant for clarity --- config/config.php | 2 +- includes/defaults.php | 2 +- includes/wifi_functions.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/config.php b/config/config.php index faa08855..2c3c9e8a 100755 --- a/config/config.php +++ b/config/config.php @@ -4,7 +4,7 @@ define('RASPI_VERSION', '2.4.1'); define('RASPI_CONFIG', '/etc/raspap'); define('RASPI_CONFIG_NETWORKING', RASPI_CONFIG.'/networking'); define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth'); -define('RASPI_WIFI_CLIENT_INTERFACE', 'wlan0'); +define('RASPI_WIFI_AP_INTERFACE', 'wlan0'); define('RASPI_CACHE_PATH', sys_get_temp_dir() . '/raspap'); // Constants for configuration file paths. diff --git a/includes/defaults.php b/includes/defaults.php index 4fd5b219..524960f5 100755 --- a/includes/defaults.php +++ b/includes/defaults.php @@ -8,7 +8,7 @@ $defaults = [ 'RASPI_VERSION' => '2.4.1', 'RASPI_CONFIG_NETWORKING' => RASPI_CONFIG.'/networking', 'RASPI_ADMIN_DETAILS' => RASPI_CONFIG.'/raspap.auth', - 'RASPI_WIFI_CLIENT_INTERFACE' => 'wlan0', + 'RASPI_WIFI_AP_INTERFACE' => 'wlan0', 'RASPI_CACHE_PATH' => sys_get_temp_dir() . '/raspap', // Constants for configuration file paths. diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index 9ad4cc40..afd81e60 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -143,7 +143,7 @@ function getWifiInterface() exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2); $_SESSION['ap_interface'] = empty($iface2) ? $iface : trim($iface2[0]); } else { // fallback to default - $_SESSION['ap_interface'] = RASPI_WIFI_CLIENT_INTERFACE; + $_SESSION['ap_interface'] = RASPI_WIFI_AP_INTERFACE; } } } From 9d1659b97bc66ba2cd3932e06fee1444ff5af66f Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 9 Jun 2020 15:44:21 +0100 Subject: [PATCH 047/128] Document getWifiInterface --- includes/wifi_functions.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index afd81e60..3ab2db93 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -133,6 +133,13 @@ function sortNetworksByRSSI(&$networks) } } +/* + * Determines the configured wireless AP interface + * + * If not saved in /etc/raspap/hostapd.ini, check for a second + * wireless interface with iw dev. Fallback to the constant + * value defined in config.php + */ function getWifiInterface() { if (empty($_SESSION['ap_interface'])) { From 1a85237d15fbcc7100da15bb3618a37ec3bab763 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 9 Jun 2020 17:01:58 +0100 Subject: [PATCH 048/128] Rename var for clarity --- includes/dashboard.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/includes/dashboard.php b/includes/dashboard.php index 77b94d5b..b3d92e5f 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -22,7 +22,6 @@ function DisplayDashboard(&$extraFooterScripts) $status->showMessages(); return; } - exec('ip a show '.$_SESSION['ap_interface'], $stdoutIp); $stdoutIpAllLinesGlued = implode(" ", $stdoutIp); $stdoutIpWRepeatedSpaces = preg_replace('/\s\s+/', ' ', $stdoutIpAllLinesGlued); @@ -93,8 +92,8 @@ function DisplayDashboard(&$extraFooterScripts) // fetch first wireless interface $iface = $_SESSION['ap_interface']; exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2); - $host_iface = empty($iface2) ? $iface1 : trim($iface2[0]); - exec('iw dev ' .$host_iface. ' link ', $stdoutIw); + $wifi_client_interface = empty($iface2) ? $iface1 : trim($iface2[0]); + exec('iw dev ' .$wifi_client_interface. ' link ', $stdoutIw); $stdoutIwAllLinesGlued = implode(' ', $stdoutIw); $stdoutIwWRepSpaces = preg_replace('/\s\s+/', ' ', $stdoutIwAllLinesGlued); From f8a094134bfeb5c805022027ac5dfeb851e813f3 Mon Sep 17 00:00:00 2001 From: christian Zeitnitz Date: Tue, 9 Jun 2020 20:25:19 +0200 Subject: [PATCH 049/128] Add Session variable "wifi_client_interface" --- includes/configure_client.php | 4 ++-- includes/dashboard.php | 17 +++++++---------- includes/wifi_functions.php | 14 +++++++------- templates/dashboard.php | 13 ++++++------- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/includes/configure_client.php b/includes/configure_client.php index 22c3febb..d6f2f554 100755 --- a/includes/configure_client.php +++ b/includes/configure_client.php @@ -17,7 +17,7 @@ function DisplayWPAConfig() if (isset($_POST['connect'])) { $result = 0; - exec('sudo wpa_cli -i ' . $_SESSION['ap_interface'] . ' select_network '.strval($_POST['connect'])); + exec('sudo wpa_cli -i ' . $_SESSION['wifi_client_interface'] . ' select_network '.strval($_POST['connect'])); $status->addMessage('New network selected', 'success'); } elseif (isset($_POST['client_settings'])) { $tmp_networks = $networks; @@ -77,7 +77,7 @@ function DisplayWPAConfig() if ($ok) { system('sudo cp /tmp/wifidata ' . RASPI_WPA_SUPPLICANT_CONFIG, $returnval); if ($returnval == 0) { - exec('sudo wpa_cli -i ' . $_SESSION['ap_interface'] . ' reconfigure', $reconfigure_out, $reconfigure_return); + exec('sudo wpa_cli -i ' . $_SESSION['wifi_client_interface'] . ' reconfigure', $reconfigure_out, $reconfigure_return); if ($reconfigure_return == 0) { $status->addMessage('Wifi settings updated successfully', 'success'); $networks = $tmp_networks; diff --git a/includes/dashboard.php b/includes/dashboard.php index b3d92e5f..0fd1831f 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -11,7 +11,7 @@ function DisplayDashboard(&$extraFooterScripts) getWifiInterface(); $status = new StatusMessages(); // Need this check interface name for proper shell execution. - if (!preg_match('/^([a-zA-Z0-9]+)$/', $_SESSION['ap_interface'])) { + if (!preg_match('/^([a-zA-Z0-9]+)$/', $_SESSION['wifi_client_interface'])) { $status->addMessage(_('Interface name invalid.'), 'danger'); $status->showMessages(); return; @@ -22,7 +22,7 @@ function DisplayDashboard(&$extraFooterScripts) $status->showMessages(); return; } - exec('ip a show '.$_SESSION['ap_interface'], $stdoutIp); + exec('ip a show '.$_SESSION['wifi_client_interface'], $stdoutIp); $stdoutIpAllLinesGlued = implode(" ", $stdoutIp); $stdoutIpWRepeatedSpaces = preg_replace('/\s\s+/', ' ', $stdoutIpAllLinesGlued); @@ -90,10 +90,7 @@ function DisplayDashboard(&$extraFooterScripts) define('SSIDMAXLEN', 32); // Warning iw comes with: "Do NOT screenscrape this tool, we don't consider its output stable." // fetch first wireless interface - $iface = $_SESSION['ap_interface']; - exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2); - $wifi_client_interface = empty($iface2) ? $iface1 : trim($iface2[0]); - exec('iw dev ' .$wifi_client_interface. ' link ', $stdoutIw); + exec('iw dev ' .$_SESSION['wifi_client_interface']. ' link ', $stdoutIw); $stdoutIwAllLinesGlued = implode(' ', $stdoutIw); $stdoutIwWRepSpaces = preg_replace('/\s\s+/', ' ', $stdoutIwAllLinesGlued); @@ -125,7 +122,7 @@ function DisplayDashboard(&$extraFooterScripts) $bitrate = empty($bitrate) ? "-" : $bitrate; // txpower is now displayed on iw dev(..) info command, not on link command. - exec('iw dev '.$_SESSION['ap_interface'].' info ', $stdoutIwInfo); + exec('iw dev '.$_SESSION['wifi_client_interface'].' info ', $stdoutIwInfo); $stdoutIwInfoAllLinesGlued = implode(' ', $stdoutIwInfo); $stdoutIpInfoWRepSpaces = preg_replace('/\s\s+/', ' ', $stdoutIwInfoAllLinesGlued); @@ -156,7 +153,7 @@ function DisplayDashboard(&$extraFooterScripts) // Pressed stop button if ($interfaceState === 'UP') { $status->addMessage(sprintf(_('Interface is going %s.'), _('down')), 'warning'); - exec('sudo ip link set '.$_SESSION['ap_interface'].' down'); + exec('sudo ip link set '.$_SESSION['wifi_client_interface'].' down'); $wlan0up = false; $status->addMessage(sprintf(_('Interface is now %s.'), _('down')), 'success'); } elseif ($interfaceState === 'unknown') { @@ -168,8 +165,8 @@ function DisplayDashboard(&$extraFooterScripts) // Pressed start button if ($interfaceState === 'DOWN') { $status->addMessage(sprintf(_('Interface is going %s.'), _('up')), 'warning'); - exec('sudo ip link set ' .$_SESSION['ap_interface']. ' up'); - exec('sudo ip -s a f label ' . $_SESSION['ap_interface']); + exec('sudo ip link set ' .$_SESSION['wifi_client_interface']. ' up'); + exec('sudo ip -s a f label ' . $_SESSION['wifi_client_interface']); $wlan0up = true; $status->addMessage(sprintf(_('Interface is now %s.'), _('up')), 'success'); } elseif ($interfaceState === 'unknown') { diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index 3ab2db93..62d27c3a 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -53,10 +53,10 @@ function nearbyWifiStations(&$networks, $cached = true) $scan_results = cache( $cacheKey, function () { - exec('sudo wpa_cli -i ' .$_SESSION['ap_interface']. ' scan'); + exec('sudo wpa_cli -i ' .$_SESSION['wifi_client_interface']. ' scan'); sleep(3); - exec('sudo wpa_cli -i ' .$_SESSION['ap_interface']. ' scan_results', $stdout); + exec('sudo wpa_cli -i ' .$_SESSION['wifi_client_interface']. ' scan_results', $stdout); array_shift($stdout); return implode("\n", $stdout); @@ -107,7 +107,7 @@ function nearbyWifiStations(&$networks, $cached = true) function connectedWifiStations(&$networks) { - exec('iwconfig ' .$_SESSION['ap_interface'], $iwconfig_return); + exec('iwconfig ' .$_SESSION['wifi_client_interface'], $iwconfig_return); foreach ($iwconfig_return as $line) { if (preg_match('/ESSID:\"([^"]+)\"/i', $line, $iwconfig_ssid)) { $networks[$iwconfig_ssid[1]]['connected'] = true; @@ -145,12 +145,12 @@ function getWifiInterface() if (empty($_SESSION['ap_interface'])) { $arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini'); if (isset($arrHostapdConf['WifiInterface'])) { - $iface = $arrHostapdConf['WifiInterface']; - // check for 2nd wifi interface + $iface = $_SESSION['ap_interface'] = $arrHostapdConf['WifiInterface']; + // check for 2nd wifi interface -> wifi client on different interface exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2); - $_SESSION['ap_interface'] = empty($iface2) ? $iface : trim($iface2[0]); + $_SESSION['wifi_client_interface'] = empty($iface2) ? $iface : trim($iface2[0]); } else { // fallback to default - $_SESSION['ap_interface'] = RASPI_WIFI_AP_INTERFACE; + $_SESSION['ap_interface'] = $_SESSION['wifi_client_interface'] = RASPI_WIFI_AP_INTERFACE; } } } diff --git a/templates/dashboard.php b/templates/dashboard.php index 2ad10123..1ce73bea 100755 --- a/templates/dashboard.php +++ b/templates/dashboard.php @@ -1,12 +1,11 @@ @@ -128,9 +127,9 @@ $ifaceStatus = $wlan0up ? "up" : "down"; - " name="ifup_wlan0" /> + " name="ifup_wlan0" /> - " name="ifdown_wlan0" /> + " name="ifdown_wlan0" /> From 656ba9234b551a693fd8f3b0b0b9004fd6e71e22 Mon Sep 17 00:00:00 2001 From: christian Zeitnitz Date: Tue, 9 Jun 2020 20:53:11 +0200 Subject: [PATCH 050/128] Fix intial assignment of $_SESSION['ap_interface'] --- includes/wifi_functions.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index 62d27c3a..e40a628d 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -144,14 +144,10 @@ function getWifiInterface() { if (empty($_SESSION['ap_interface'])) { $arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini'); - if (isset($arrHostapdConf['WifiInterface'])) { - $iface = $_SESSION['ap_interface'] = $arrHostapdConf['WifiInterface']; - // check for 2nd wifi interface -> wifi client on different interface - exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2); - $_SESSION['wifi_client_interface'] = empty($iface2) ? $iface : trim($iface2[0]); - } else { // fallback to default - $_SESSION['ap_interface'] = $_SESSION['wifi_client_interface'] = RASPI_WIFI_AP_INTERFACE; - } + $iface = $_SESSION['ap_interface'] = isset($arrHostapdConf['WifiInterface']) ? $arrHostapdConf['WifiInterface'] : RASPI_WIFI_AP_INTERFACE; + // check for 2nd wifi interface -> wifi client on different interface + exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2); + $_SESSION['wifi_client_interface'] = empty($iface2) ? $iface : trim($iface2[0]); } } From b9ba2946a546ed9d388347d7b5eb02f9c24c0ceb Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 10 Jun 2020 09:09:10 +0100 Subject: [PATCH 051/128] Fix: display AP interface stats --- includes/dashboard.php | 3 +-- templates/dashboard.php | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/includes/dashboard.php b/includes/dashboard.php index 0fd1831f..ab26c934 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -22,7 +22,7 @@ function DisplayDashboard(&$extraFooterScripts) $status->showMessages(); return; } - exec('ip a show '.$_SESSION['wifi_client_interface'], $stdoutIp); + exec('ip a show '.$_SESSION['ap_interface'], $stdoutIp); $stdoutIpAllLinesGlued = implode(" ", $stdoutIp); $stdoutIpWRepeatedSpaces = preg_replace('/\s\s+/', ' ', $stdoutIpAllLinesGlued); @@ -89,7 +89,6 @@ function DisplayDashboard(&$extraFooterScripts) define('SSIDMAXLEN', 32); // Warning iw comes with: "Do NOT screenscrape this tool, we don't consider its output stable." - // fetch first wireless interface exec('iw dev ' .$_SESSION['wifi_client_interface']. ' link ', $stdoutIw); $stdoutIwAllLinesGlued = implode(' ', $stdoutIw); $stdoutIwWRepSpaces = preg_replace('/\s\s+/', ' ', $stdoutIwAllLinesGlued); diff --git a/templates/dashboard.php b/templates/dashboard.php index 1ce73bea..b7257de6 100755 --- a/templates/dashboard.php +++ b/templates/dashboard.php @@ -3,7 +3,7 @@ $arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini'); if ($arrHostapdConf['WifiAPEnable'] == 1) { $client_interface = 'uap0'; } else { - $client_interface = $_SESSION['wifi_client_interface']; + $client_interface = $_SESSION['ap_interface']; } $ap_iface = $_SESSION['ap_interface']; $MACPattern = '"([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"'; @@ -40,7 +40,7 @@ $ifaceStatus = $wlan0up ? "up" : "down";

-
+
From 88d91b6063ba387b060fb6455f1db3de195fe8e5 Mon Sep 17 00:00:00 2001 From: echaritos Date: Sat, 13 Jun 2020 10:57:38 +0200 Subject: [PATCH 052/128] Update README.md corrected typos --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 32bde5b4..e462892a 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ The following translations are currently maintained by the project: - Español - Finnish - Français -- ελληνικό (Greek) +- Ελληνικά (Greek) - Indonesian - Italiano - 日本語 (Japanese) From 417e9489bb72df8b47a0671c68d38815975e171d Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Sun, 14 Jun 2020 17:40:50 +0200 Subject: [PATCH 053/128] disable check on existing session variable --- includes/wifi_functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index e40a628d..6822ba12 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -142,12 +142,12 @@ function sortNetworksByRSSI(&$networks) */ function getWifiInterface() { - if (empty($_SESSION['ap_interface'])) { +// if (empty($_SESSION['ap_interface'])) { $arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini'); $iface = $_SESSION['ap_interface'] = isset($arrHostapdConf['WifiInterface']) ? $arrHostapdConf['WifiInterface'] : RASPI_WIFI_AP_INTERFACE; // check for 2nd wifi interface -> wifi client on different interface exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2); $_SESSION['wifi_client_interface'] = empty($iface2) ? $iface : trim($iface2[0]); - } +// } } From a8238d688e214439fa6dd1eaf53a9aae30befb53 Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Sun, 14 Jun 2020 18:19:34 +0200 Subject: [PATCH 054/128] select correct wifi interface as client --- templates/dashboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/dashboard.php b/templates/dashboard.php index b7257de6..0b0e7c0d 100755 --- a/templates/dashboard.php +++ b/templates/dashboard.php @@ -3,7 +3,7 @@ $arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini'); if ($arrHostapdConf['WifiAPEnable'] == 1) { $client_interface = 'uap0'; } else { - $client_interface = $_SESSION['ap_interface']; + $client_interface = $_SESSION['wifi_client_interface']; } $ap_iface = $_SESSION['ap_interface']; $MACPattern = '"([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"'; From e6652c025d1f6b7a55e31d4860a190d16b23e944 Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Sun, 14 Jun 2020 18:22:51 +0200 Subject: [PATCH 055/128] Remove check on existing SESSION variable --- includes/wifi_functions.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index 6822ba12..c4ec7c60 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -142,12 +142,10 @@ function sortNetworksByRSSI(&$networks) */ function getWifiInterface() { -// if (empty($_SESSION['ap_interface'])) { $arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini'); $iface = $_SESSION['ap_interface'] = isset($arrHostapdConf['WifiInterface']) ? $arrHostapdConf['WifiInterface'] : RASPI_WIFI_AP_INTERFACE; // check for 2nd wifi interface -> wifi client on different interface exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2); $_SESSION['wifi_client_interface'] = empty($iface2) ? $iface : trim($iface2[0]); -// } } From e1bb73a76dcf4dd44977bcbafa45f31c1ea051a7 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 15 Jun 2020 09:35:44 +0100 Subject: [PATCH 056/128] Update service-status to indicate AP interface --- templates/dashboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/dashboard.php b/templates/dashboard.php index 0b0e7c0d..5b606255 100755 --- a/templates/dashboard.php +++ b/templates/dashboard.php @@ -27,7 +27,7 @@ $ifaceStatus = $wlan0up ? "up" : "down";
From bff66c0b7e34cedf63b139a804bade1555b9238c Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Mon, 15 Jun 2020 23:46:26 +0200 Subject: [PATCH 057/128] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e462892a..af4da2d0 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ RaspAP has been featured on sites such as [Instructables](http://www.instructabl We hope you enjoy using RaspAP as much as we do creating it. Tell us how you use this with [your own projects](https://github.com/billz/raspap-awesome). -![](https://i.imgur.com/BdEinwg.gif) +![](https://i.imgur.com/1p0DDQi.gif) ![](https://i.imgur.com/EiIpdOS.gif) ![](https://i.imgur.com/eCjUS1H.gif) ![](https://i.imgur.com/5FT2BcS.gif) From b7fd77bcf82791ed0bf96e3355f020cc349aaf40 Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Tue, 16 Jun 2020 22:04:32 +0200 Subject: [PATCH 058/128] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index af4da2d0..2e4547ed 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ RaspAP has been featured on sites such as [Instructables](http://www.instructabl We hope you enjoy using RaspAP as much as we do creating it. Tell us how you use this with [your own projects](https://github.com/billz/raspap-awesome). -![](https://i.imgur.com/1p0DDQi.gif) +![](https://i.imgur.com/ikWvsMG.gif) ![](https://i.imgur.com/EiIpdOS.gif) ![](https://i.imgur.com/eCjUS1H.gif) ![](https://i.imgur.com/5FT2BcS.gif) From 199065e93f15651165d37a97b4d385df9c031267 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 24 Jun 2020 23:36:19 +0100 Subject: [PATCH 059/128] Update installer with upgrade option. Resolves #617 --- installers/common.sh | 200 +++++++++++++++++++++++------------------ installers/raspbian.sh | 7 ++ 2 files changed, 120 insertions(+), 87 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index b27b0684..d00384fe 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -30,12 +30,17 @@ git_source_url="https://github.com/$repo" # $repo from install.raspap.com # Prompts user to set installation options function _config_installation() { - _install_log "Configure installation" + if [ "$upgrade" == 1 ]; then + opt=(Upgrade Upgrading upgrade) + else + opt=(Install Installing installation) + fi + _install_log "Configure ${opt[2]}" _get_linux_distro echo "Detected OS: ${DESC}" echo "Using GitHub repository: ${repo} ${branch} branch" - echo "Install directory: ${raspap_dir}" - echo -n "Install to lighttpd root: ${webroot_dir}? [Y/n]: " + echo "Configuration directory: ${raspap_dir}" + echo -n "lighttpd root: ${webroot_dir}? [Y/n]: " if [ "$assume_yes" == 0 ]; then read answer < /dev/tty if [ "$answer" != "${answer#[Nn]}" ]; then @@ -44,8 +49,12 @@ function _config_installation() { else echo -e fi - echo "Installing to lighttpd directory: ${webroot_dir}" - echo -n "Complete installation with these values? [Y/n]: " + echo "${opt[1]} lighttpd directory: ${webroot_dir}" + if [ "$upgrade" == 1 ]; then + echo "This will upgrade your existing install to version ${RASPAP_LATEST}" + echo "Your configuration will NOT be changed" + fi + echo -n "Complete ${opt[2]} with these values? [Y/n]: " if [ "$assume_yes" == 0 ]; then read answer < /dev/tty if [ "$answer" != "${answer#[Nn]}" ]; then @@ -290,6 +299,12 @@ function _download_latest_files() { git clone --branch $branch --depth 1 $git_source_url /tmp/raspap-webgui || _install_status 1 "Unable to download files from github" sudo mv /tmp/raspap-webgui $webroot_dir || _install_status 1 "Unable to move raspap-webgui to web root" + if [ "$upgrade" == 1 ]; then + _install_log "Applying existing configuration to ${webroot_dir}/includes" + sudo mv /tmp/config.php $webroot_dir/includes || _install_status 1 "Unable to move config.php to ${webroot_dir}/includes" + sudo mv /tmp/defaults.php $webroot_dir/includes || _install_status 1 "Unable to move defaults.php to ${webroot_dir}/includes" + fi + _install_status 0 } @@ -305,33 +320,40 @@ function _change_file_ownership() { # Check for existing configuration files function _check_for_old_configs() { - if [ -f /etc/network/interfaces ]; then - sudo cp /etc/network/interfaces "$raspap_dir/backups/interfaces.`date +%F-%R`" - sudo ln -sf "$raspap_dir/backups/interfaces.`date +%F-%R`" "$raspap_dir/backups/interfaces" - fi - - if [ -f /etc/hostapd/hostapd.conf ]; then - sudo cp /etc/hostapd/hostapd.conf "$raspap_dir/backups/hostapd.conf.`date +%F-%R`" - sudo ln -sf "$raspap_dir/backups/hostapd.conf.`date +%F-%R`" "$raspap_dir/backups/hostapd.conf" - fi - - if [ -f $raspap_dnsmasq ]; then - sudo cp $raspap_dnsmasq "$raspap_dir/backups/dnsmasq.conf.`date +%F-%R`" - sudo ln -sf "$raspap_dir/backups/dnsmasq.conf.`date +%F-%R`" "$raspap_dir/backups/dnsmasq.conf" - fi - - if [ -f /etc/dhcpcd.conf ]; then - sudo cp /etc/dhcpcd.conf "$raspap_dir/backups/dhcpcd.conf.`date +%F-%R`" - sudo ln -sf "$raspap_dir/backups/dhcpcd.conf.`date +%F-%R`" "$raspap_dir/backups/dhcpcd.conf" - fi - - for file in /etc/systemd/network/raspap-*.net*; do - if [ -f "${file}" ]; then - filename=$(basename $file) - sudo cp "$file" "${raspap_dir}/backups/${filename}.`date +%F-%R`" - sudo ln -sf "${raspap_dir}/backups/${filename}.`date +%F-%R`" "${raspap_dir}/backups/${filename}" + if [ "$upgrade" == 1 ]; then + _install_log "Moving existing configuration to /tmp" + sudo mv $webroot_dir/includes/config.php /tmp || _install_status 1 "Unable to move config.php to /tmp" + sudo mv $webroot_dir/includes/defaults.php /tmp || _install_status 1 "Unable to move defaults.php to /tmp" + else + _install_log "Backing up existing configs to ${raspap_dir}/backups" + if [ -f /etc/network/interfaces ]; then + sudo cp /etc/network/interfaces "$raspap_dir/backups/interfaces.`date +%F-%R`" + sudo ln -sf "$raspap_dir/backups/interfaces.`date +%F-%R`" "$raspap_dir/backups/interfaces" fi - done + + if [ -f /etc/hostapd/hostapd.conf ]; then + sudo cp /etc/hostapd/hostapd.conf "$raspap_dir/backups/hostapd.conf.`date +%F-%R`" + sudo ln -sf "$raspap_dir/backups/hostapd.conf.`date +%F-%R`" "$raspap_dir/backups/hostapd.conf" + fi + + if [ -f $raspap_dnsmasq ]; then + sudo cp $raspap_dnsmasq "$raspap_dir/backups/dnsmasq.conf.`date +%F-%R`" + sudo ln -sf "$raspap_dir/backups/dnsmasq.conf.`date +%F-%R`" "$raspap_dir/backups/dnsmasq.conf" + fi + + if [ -f /etc/dhcpcd.conf ]; then + sudo cp /etc/dhcpcd.conf "$raspap_dir/backups/dhcpcd.conf.`date +%F-%R`" + sudo ln -sf "$raspap_dir/backups/dhcpcd.conf.`date +%F-%R`" "$raspap_dir/backups/dhcpcd.conf" + fi + + for file in /etc/systemd/network/raspap-*.net*; do + if [ -f "${file}" ]; then + filename=$(basename $file) + sudo cp "$file" "${raspap_dir}/backups/${filename}.`date +%F-%R`" + sudo ln -sf "${raspap_dir}/backups/${filename}.`date +%F-%R`" "${raspap_dir}/backups/${filename}" + fi + done + fi _install_status 0 } @@ -348,29 +370,31 @@ function _move_config_file() { # Set up default configuration function _default_configuration() { - _install_log "Applying default configuration to installed services" - if [ -f /etc/default/hostapd ]; then - sudo mv /etc/default/hostapd /tmp/default_hostapd.old || _install_status 1 "Unable to remove old /etc/default/hostapd file" + if [ "$upgrade" == 0 ]; then + _install_log "Applying default configuration to installed services" + if [ -f /etc/default/hostapd ]; then + sudo mv /etc/default/hostapd /tmp/default_hostapd.old || _install_status 1 "Unable to remove old /etc/default/hostapd file" + fi + sudo cp $webroot_dir/config/default_hostapd /etc/default/hostapd || _install_status 1 "Unable to move hostapd defaults file" + sudo cp $webroot_dir/config/hostapd.conf /etc/hostapd/hostapd.conf || _install_status 1 "Unable to move hostapd configuration file" + sudo cp $webroot_dir/config/dnsmasq.conf $raspap_dnsmasq || _install_status 1 "Unable to move dnsmasq configuration file" + sudo cp $webroot_dir/config/dhcpcd.conf /etc/dhcpcd.conf || _install_status 1 "Unable to move dhcpcd configuration file" + + echo "Checking for existence of /etc/dnsmasq.d" + [ -d /etc/dnsmasq.d ] || sudo mkdir /etc/dnsmasq.d + + echo "Copying bridged AP config to /etc/systemd/network" + sudo systemctl stop systemd-networkd + sudo systemctl disable systemd-networkd + sudo cp $webroot_dir/config/raspap-bridge-br0.netdev /etc/systemd/network/raspap-bridge-br0.netdev || _install_status 1 "Unable to move br0 netdev file" + sudo cp $webroot_dir/config/raspap-br0-member-eth0.network /etc/systemd/network/raspap-br0-member-eth0.network || _install_status 1 "Unable to move br0 member file" + + echo "Copying primary RaspAP config to includes/config.php" + if [ ! -f "$webroot_dir/includes/config.php" ]; then + sudo cp "$webroot_dir/config/config.php" "$webroot_dir/includes/config.php" + fi + _install_status 0 fi - sudo cp $webroot_dir/config/default_hostapd /etc/default/hostapd || _install_status 1 "Unable to move hostapd defaults file" - sudo cp $webroot_dir/config/hostapd.conf /etc/hostapd/hostapd.conf || _install_status 1 "Unable to move hostapd configuration file" - sudo cp $webroot_dir/config/dnsmasq.conf $raspap_dnsmasq || _install_status 1 "Unable to move dnsmasq configuration file" - sudo cp $webroot_dir/config/dhcpcd.conf /etc/dhcpcd.conf || _install_status 1 "Unable to move dhcpcd configuration file" - - echo "Checking for existence of /etc/dnsmasq.d" - [ -d /etc/dnsmasq.d ] || sudo mkdir /etc/dnsmasq.d - - echo "Copying bridged AP config to /etc/systemd/network" - sudo systemctl stop systemd-networkd - sudo systemctl disable systemd-networkd - sudo cp $webroot_dir/config/raspap-bridge-br0.netdev /etc/systemd/network/raspap-bridge-br0.netdev || _install_status 1 "Unable to move br0 netdev file" - sudo cp $webroot_dir/config/raspap-br0-member-eth0.network /etc/systemd/network/raspap-br0-member-eth0.network || _install_status 1 "Unable to move br0 member file" - - echo "Copying primary RaspAP config to includes/config.php" - if [ ! -f "$webroot_dir/includes/config.php" ]; then - sudo cp "$webroot_dir/config/config.php" "$webroot_dir/includes/config.php" - fi - _install_status 0 } # Install and enable RaspAP daemon @@ -453,51 +477,53 @@ function _patch_system_files() { # Optimize configuration of php-cgi. function _optimize_php() { - _install_log "Optimize PHP configuration" - if [ ! -f "$phpcgiconf" ]; then - _install_warning "PHP configuration could not be found." - return - fi - - # Backup php.ini and create symlink for restoring. - datetimephpconf=$(date +%F-%R) - sudo cp "$phpcgiconf" "$raspap_dir/backups/php.ini.$datetimephpconf" - sudo ln -sf "$raspap_dir/backups/php.ini.$datetimephpconf" "$raspap_dir/backups/php.ini" - - echo -n "Enable HttpOnly for session cookies (Recommended)? [Y/n]: " - if [ "$assume_yes" == 0 ]; then - read answer < /dev/tty - if [ "$answer" != "${answer#[Nn]}" ]; then - echo -e - else - php_session_cookie=1; + if [ "$upgrade" == 0 ]; then + _install_log "Optimize PHP configuration" + if [ ! -f "$phpcgiconf" ]; then + _install_warning "PHP configuration could not be found." + return fi - fi - if [ "$assume_yes" == 1 ] || [ "$php_session_cookie" == 1 ]; then - echo "Php-cgi enabling session.cookie_httponly." - sudo sed -i -E 's/^session\.cookie_httponly\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/session.cookie_httponly = 1/' "$phpcgiconf" - fi + # Backup php.ini and create symlink for restoring. + datetimephpconf=$(date +%F-%R) + sudo cp "$phpcgiconf" "$raspap_dir/backups/php.ini.$datetimephpconf" + sudo ln -sf "$raspap_dir/backups/php.ini.$datetimephpconf" "$raspap_dir/backups/php.ini" - if [ "$php_package" = "php7.1-cgi" ]; then - echo -n "Enable PHP OPCache (Recommended)? [Y/n]: " + echo -n "Enable HttpOnly for session cookies (Recommended)? [Y/n]: " if [ "$assume_yes" == 0 ]; then read answer < /dev/tty if [ "$answer" != "${answer#[Nn]}" ]; then echo -e else - php_opcache=1; + php_session_cookie=1; fi fi - if [ "$assume_yes" == 1 ] || [ "$phpopcache" == 1 ]; then - echo -e "Php-cgi enabling opcache.enable." - sudo sed -i -E 's/^;?opcache\.enable\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/opcache.enable = 1/' "$phpcgiconf" - # Make sure opcache extension is turned on. - if [ -f "/usr/sbin/phpenmod" ]; then - sudo phpenmod opcache - else - _install_status 2 "phpenmod not found." + if [ "$assume_yes" == 1 ] || [ "$php_session_cookie" == 1 ]; then + echo "Php-cgi enabling session.cookie_httponly." + sudo sed -i -E 's/^session\.cookie_httponly\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/session.cookie_httponly = 1/' "$phpcgiconf" + fi + + if [ "$php_package" = "php7.1-cgi" ]; then + echo -n "Enable PHP OPCache (Recommended)? [Y/n]: " + if [ "$assume_yes" == 0 ]; then + read answer < /dev/tty + if [ "$answer" != "${answer#[Nn]}" ]; then + echo -e + else + php_opcache=1; + fi + fi + + if [ "$assume_yes" == 1 ] || [ "$phpopcache" == 1 ]; then + echo -e "Php-cgi enabling opcache.enable." + sudo sed -i -E 's/^;?opcache\.enable\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/opcache.enable = 1/' "$phpcgiconf" + # Make sure opcache extension is turned on. + if [ -f "/usr/sbin/phpenmod" ]; then + sudo phpenmod opcache + else + _install_status 2 "phpenmod not found." + fi fi fi fi diff --git a/installers/raspbian.sh b/installers/raspbian.sh index 1e30fa19..bc8c5aab 100755 --- a/installers/raspbian.sh +++ b/installers/raspbian.sh @@ -20,6 +20,8 @@ # Overrides the default git branch (master) # -h, --help # Outputs usage notes and exits +# -u, --upgrade +# Upgrades an existing installation to the latest release version # -v, --version # Outputs release info and exits # @@ -37,6 +39,7 @@ repo="billz/raspap-webgui" branch="master" assume_yes=0 +upgrade=0 ovpn_option=1 adblock_option=1 @@ -61,6 +64,7 @@ Usage: raspbian.sh [OPTION]\n -r, --repo, --repository \n\tOverrides the default GitHub repo (billz/raspap-webgui) -b, --branch \n\tOverrides the default git branch (master) -h, --help\n\tOutputs usage notes and exits +-u, --upgrade\n\tUpgrades an existing installation to the latest release version -v, --version\n\tOutputs release info and exits\n EOF ) @@ -95,6 +99,9 @@ while :; do printf "$usage" exit 1 ;; + -u|--upgrade) + upgrade=1 + ;; -v|--version) printf "RaspAP v${RASPAP_LATEST} - Simple AP setup & WiFi management for Debian-based devices\n" exit 1 From 850f52e128dbbcab8c208e51941cce9bf4c905d0 Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Thu, 25 Jun 2020 15:54:56 +0200 Subject: [PATCH 060/128] Create internetRoute.php --- includes/internetRoute.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 includes/internetRoute.php diff --git a/includes/internetRoute.php b/includes/internetRoute.php new file mode 100644 index 00000000..711d7fff --- /dev/null +++ b/includes/internetRoute.php @@ -0,0 +1,33 @@ + $route) { + $prop=explode(' ',$route); + $rInfo[$i]["interface"]=$prop[0]; + $rInfo[$i]["ip-address"]=$prop[1]; + $rInfo[$i]["gateway"]=$prop[2]; + // resolve the name of the gateway (if possible) + exec('host '.$prop[2].' | sed -rn "s/.*domain name pointer (.*)\./\1/p" | head -n 1',$host); + if (empty($host)) $host[0]="*"; + $rInfo[$i]["gw-name"] = $host[0]; + if (isset($checkAccess) && $checkAccess) { + // check internet connectivity w/ and w/o DNS resolution + exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_IP.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\;$ + if (empty($okip)) $okip[0]="failed"; + $rInfo[$i]["access-ip"] = $okip[0]; + exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_DNS.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\$ + if (empty($okdns)) $okdns[0]="failed"; + $rInfo[$i]["access-dns"] = $okdns[0]; + } + } + } else { + $data = array("error"=>"No route to the internet found"); + } + $rInfo_json = json_encode($rInfo); +?> From 365bb3fa25ccfbe24df652b642b8f8d84dbe9b8e Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Thu, 25 Jun 2020 16:00:41 +0200 Subject: [PATCH 061/128] Add internet connectivity information --- templates/networking.php | 42 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/templates/networking.php b/templates/networking.php index 7723733b..7bf20e94 100755 --- a/templates/networking.php +++ b/templates/networking.php @@ -27,7 +27,47 @@
-
+

+

+
+
+
+
+
+ + + + + + + + + + + "; + } else { + foreach($rInfo as $route) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + } + ?> + +
No route to the internet found
".$route["interface"]."".$route["ip-address"]."".$route["gateway"]."
".$route["gw-name"]."
".$route["access-ip"]."
".ACCESS_CHECK_IP."
".$route["access-dns"]."
".ACCESS_CHECK_DNS."
+
+
+
+
+

From dc790b246b83c10e0ec2d6013cf78a7c2f637990 Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Thu, 25 Jun 2020 16:55:25 +0200 Subject: [PATCH 062/128] fix failed copy/paste lines --- includes/internetRoute.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/internetRoute.php b/includes/internetRoute.php index 711d7fff..d3f4cd1b 100644 --- a/includes/internetRoute.php +++ b/includes/internetRoute.php @@ -5,7 +5,7 @@ define("ACCESS_CHECK_DNS","one.one.one.one"); $rInfo=array(); // get all default routes - exec('ip route list | sed -rn "s/default via (([0-9]{1,3}\.){3}[0-9]{1,3}).*dev (\w*).*src (([0-9]{1,3}\.){$ + exec('ip route list | sed -rn "s/default via (([0-9]{1,3}\.){3}[0-9]{1,3}).*dev (\w*).*src (([0-9]{1,3}\.){3}[0-9]{1,3}).*/\3 \4 \1/p"',$routes); if ( !empty($routes) ) { foreach ($routes as $i => $route) { $prop=explode(' ',$route); @@ -18,16 +18,16 @@ define("ACCESS_CHECK_DNS","one.one.one.one"); $rInfo[$i]["gw-name"] = $host[0]; if (isset($checkAccess) && $checkAccess) { // check internet connectivity w/ and w/o DNS resolution - exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_IP.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\;$ + exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_IP.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\;/p"',$okip); if (empty($okip)) $okip[0]="failed"; $rInfo[$i]["access-ip"] = $okip[0]; - exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_DNS.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\$ + exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_DNS.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\;/p"',$okdns); if (empty($okdns)) $okdns[0]="failed"; $rInfo[$i]["access-dns"] = $okdns[0]; } } } else { - $data = array("error"=>"No route to the internet found"); + $rInfo = array("error"=>"No route to the internet found"); } $rInfo_json = json_encode($rInfo); ?> From 5a311d24eceee26a235d1b2dc2b68395f2594930 Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Thu, 25 Jun 2020 16:56:53 +0200 Subject: [PATCH 063/128] Remove duplicated title --- templates/networking.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/networking.php b/templates/networking.php index 7bf20e94..a08fa884 100755 --- a/templates/networking.php +++ b/templates/networking.php @@ -27,7 +27,7 @@
-

+

From 90e5f50da653bc12e5b568a18396dc86906569f8 Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Thu, 25 Jun 2020 17:18:23 +0200 Subject: [PATCH 064/128] reset input vars to exec before call --- includes/internetRoute.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/internetRoute.php b/includes/internetRoute.php index d3f4cd1b..b91e15c2 100644 --- a/includes/internetRoute.php +++ b/includes/internetRoute.php @@ -13,14 +13,17 @@ define("ACCESS_CHECK_DNS","one.one.one.one"); $rInfo[$i]["ip-address"]=$prop[1]; $rInfo[$i]["gateway"]=$prop[2]; // resolve the name of the gateway (if possible) + unset($host); exec('host '.$prop[2].' | sed -rn "s/.*domain name pointer (.*)\./\1/p" | head -n 1',$host); if (empty($host)) $host[0]="*"; $rInfo[$i]["gw-name"] = $host[0]; if (isset($checkAccess) && $checkAccess) { // check internet connectivity w/ and w/o DNS resolution + unset($okip); exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_IP.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\;/p"',$okip); if (empty($okip)) $okip[0]="failed"; $rInfo[$i]["access-ip"] = $okip[0]; + unset($okdns); exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_DNS.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\;/p"',$okdns); if (empty($okdns)) $okdns[0]="failed"; $rInfo[$i]["access-dns"] = $okdns[0]; From e5f2c218e1f2d05344dc9bae5f99701dae6e9a2d Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 28 Jun 2020 16:58:42 +0100 Subject: [PATCH 065/128] Processed with phpcbf, removed tabs --- includes/internetRoute.php | 55 ++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/includes/internetRoute.php b/includes/internetRoute.php index b91e15c2..715bc3c4 100644 --- a/includes/internetRoute.php +++ b/includes/internetRoute.php @@ -1,36 +1,39 @@ $route) { - $prop=explode(' ',$route); - $rInfo[$i]["interface"]=$prop[0]; - $rInfo[$i]["ip-address"]=$prop[1]; - $rInfo[$i]["gateway"]=$prop[2]; - // resolve the name of the gateway (if possible) - unset($host); - exec('host '.$prop[2].' | sed -rn "s/.*domain name pointer (.*)\./\1/p" | head -n 1',$host); - if (empty($host)) $host[0]="*"; - $rInfo[$i]["gw-name"] = $host[0]; - if (isset($checkAccess) && $checkAccess) { +exec('ip route list | sed -rn "s/default via (([0-9]{1,3}\.){3}[0-9]{1,3}).*dev (\w*).*src (([0-9]{1,3}\.){3}[0-9]{1,3}).*/\3 \4 \1/p"', $routes); +if (!empty($routes) ) { + foreach ($routes as $i => $route) { + $prop=explode(' ', $route); + $rInfo[$i]["interface"]=$prop[0]; + $rInfo[$i]["ip-address"]=$prop[1]; + $rInfo[$i]["gateway"]=$prop[2]; + // resolve the name of the gateway (if possible) + unset($host); + exec('host '.$prop[2].' | sed -rn "s/.*domain name pointer (.*)\./\1/p" | head -n 1', $host); + if (empty($host)) { + $host[0]="*"; + } + $rInfo[$i]["gw-name"] = $host[0]; + if (isset($checkAccess) && $checkAccess) { // check internet connectivity w/ and w/o DNS resolution unset($okip); - exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_IP.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\;/p"',$okip); - if (empty($okip)) $okip[0]="failed"; + exec('ping -W1 -c 1 -I '.$prop[0].' '.RASPI_ACCESS_CHECK_IP.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\;/p"', $okip); + if (empty($okip)) { + $okip[0]="failed"; + } $rInfo[$i]["access-ip"] = $okip[0]; unset($okdns); - exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_DNS.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\;/p"',$okdns); - if (empty($okdns)) $okdns[0]="failed"; + exec('ping -W1 -c 1 -I '.$prop[0].' '.RASPI_ACCESS_CHECK_DNS.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\;/p"', $okdns); + if (empty($okdns)) { + $okdns[0]="failed"; + } $rInfo[$i]["access-dns"] = $okdns[0]; - } } - } else { - $rInfo = array("error"=>"No route to the internet found"); - } - $rInfo_json = json_encode($rInfo); + } +} else { + $rInfo = array("error"=>"No route to the internet found"); +} +$rInfo_json = json_encode($rInfo); ?> From c4e2faa25ab2f95e629b3c695f179578d454931c Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 28 Jun 2020 17:01:32 +0100 Subject: [PATCH 066/128] Update networking msg --- locale/en_US/LC_MESSAGES/messages.po | 3 +++ 1 file changed, 3 insertions(+) diff --git a/locale/en_US/LC_MESSAGES/messages.po b/locale/en_US/LC_MESSAGES/messages.po index 70a9b06e..1ce53d99 100644 --- a/locale/en_US/LC_MESSAGES/messages.po +++ b/locale/en_US/LC_MESSAGES/messages.po @@ -451,6 +451,9 @@ msgstr "Configures the max_num_sta option of hostapd. The default and maximum is msgid "Summary" msgstr "Summary" +msgid "Internet connection" +msgstr "Internet connection" + msgid "Current settings" msgstr "Current settings" From 8647673d9a46285be06f5ed16d515b3a147fca4c Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 28 Jun 2020 17:02:07 +0100 Subject: [PATCH 067/128] Move + rename constants --- config/config.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/config.php b/config/config.php index 2c3c9e8a..4e73ec2b 100755 --- a/config/config.php +++ b/config/config.php @@ -23,6 +23,9 @@ define('RASPI_OPENVPN_CLIENT_LOGIN', '/etc/openvpn/client/login.conf'); define('RASPI_OPENVPN_SERVER_CONFIG', '/etc/openvpn/server/server.conf'); define('RASPI_TORPROXY_CONFIG', '/etc/tor/torrc'); define('RASPI_LIGHTTPD_CONFIG', '/etc/lighttpd/lighttpd.conf'); +define('RASPI_ACCESS_CHECK_IP', '1.1.1.1'); +define('RASPI_ACCESS_CHECK_DNS', 'one.one.one.one'); + // Constant for the 5GHz wireless regulatory domain define('RASPI_5GHZ_ISO_ALPHA2', array('US')); From 9afb773ab3241deb89711f23b672ffd1b768d16a Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 28 Jun 2020 17:07:38 +0100 Subject: [PATCH 068/128] Minor: remove newline --- config/config.php | 1 - 1 file changed, 1 deletion(-) diff --git a/config/config.php b/config/config.php index 4e73ec2b..bfe464f6 100755 --- a/config/config.php +++ b/config/config.php @@ -26,7 +26,6 @@ define('RASPI_LIGHTTPD_CONFIG', '/etc/lighttpd/lighttpd.conf'); define('RASPI_ACCESS_CHECK_IP', '1.1.1.1'); define('RASPI_ACCESS_CHECK_DNS', 'one.one.one.one'); - // Constant for the 5GHz wireless regulatory domain define('RASPI_5GHZ_ISO_ALPHA2', array('US')); From 36141d1e9cce46280e05d9fec61c6b57e3e279c5 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 28 Jun 2020 17:08:29 +0100 Subject: [PATCH 069/128] Update defaults w/ new constants --- includes/defaults.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/defaults.php b/includes/defaults.php index 524960f5..e1346112 100755 --- a/includes/defaults.php +++ b/includes/defaults.php @@ -27,6 +27,8 @@ $defaults = [ 'RASPI_OPENVPN_SERVER_CONFIG' => '/etc/openvpn/server/server.conf', 'RASPI_TORPROXY_CONFIG' => '/etc/tor/torrc', 'RASPI_LIGHTTPD_CONFIG' => '/etc/lighttpd/lighttpd.conf', + 'RASPI_ACCESS_CHECK_IP' => '1.1.1.1', + 'RASPI_ACCESS_CHECK_DNS' => 'one.one.one.one', // Optional services, set to true to enable. 'RASPI_WIFICLIENT_ENABLED' => true, From d878cbf356ea9a4f19c5c10c57a503daa920de14 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 28 Jun 2020 17:12:42 +0100 Subject: [PATCH 070/128] Processed with phpcbf --- templates/networking.php | 49 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/templates/networking.php b/templates/networking.php index a08fa884..455544bd 100755 --- a/templates/networking.php +++ b/templates/networking.php @@ -17,16 +17,15 @@ $arrHostapdConf = parse_ini_file('/etc/raspap/hostapd.ini'); // defaults to false $bridgedEnabled = $arrHostapdConf['BridgedEnable']; - ?> - - - + ?> + + + - +
-

@@ -45,21 +44,21 @@ No route to the internet found"; - } else { - foreach($rInfo as $route) { - echo ""; - echo "".$route["interface"].""; - echo "".$route["ip-address"].""; - echo "".$route["gateway"]."
".$route["gw-name"].""; - echo "".$route["access-ip"]."
".ACCESS_CHECK_IP.""; - echo "".$route["access-dns"]."
".ACCESS_CHECK_DNS.""; - echo ""; - } - } + } else { + foreach($rInfo as $route) { + echo ""; + echo "".$route["interface"].""; + echo "".$route["ip-address"].""; + echo "".$route["gateway"]."
".$route["gw-name"].""; + echo "".$route["access-ip"]."
".RASPI_ACCESS_CHECK_IP.""; + echo "".$route["access-dns"]."
".RASPI_ACCESS_CHECK_DNS.""; + echo ""; + } + } ?> @@ -71,7 +70,7 @@

- +
@@ -90,7 +89,7 @@
- +
@@ -140,10 +139,10 @@
-
- +
+ - + From 4623060f08b97af2300600d08058272b5274ce65 Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Mon, 29 Jun 2020 13:12:29 +0200 Subject: [PATCH 071/128] Simplify and cleanup handling of return values of system calls Handling of return values done in a single line. Determine only, if access is possible not not (true, false). The actual displayed text has to be determined, when displaying the result of the access check. --- includes/internetRoute.php | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/includes/internetRoute.php b/includes/internetRoute.php index 715bc3c4..db04d685 100644 --- a/includes/internetRoute.php +++ b/includes/internetRoute.php @@ -12,24 +12,15 @@ if (!empty($routes) ) { // resolve the name of the gateway (if possible) unset($host); exec('host '.$prop[2].' | sed -rn "s/.*domain name pointer (.*)\./\1/p" | head -n 1', $host); - if (empty($host)) { - $host[0]="*"; - } - $rInfo[$i]["gw-name"] = $host[0]; + $rInfo[$i]["gw-name"] = empty($host) ? "*" : $host[0]; if (isset($checkAccess) && $checkAccess) { // check internet connectivity w/ and w/o DNS resolution unset($okip); - exec('ping -W1 -c 1 -I '.$prop[0].' '.RASPI_ACCESS_CHECK_IP.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\;/p"', $okip); - if (empty($okip)) { - $okip[0]="failed"; - } - $rInfo[$i]["access-ip"] = $okip[0]; + exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_IP.' | sed -rn "s/.*icmp_seq=1.*time=.*/OK/p"',$okip); + $rInfo[$i]["access-ip"] = empty($okip) ? false : true; unset($okdns); - exec('ping -W1 -c 1 -I '.$prop[0].' '.RASPI_ACCESS_CHECK_DNS.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\;/p"', $okdns); - if (empty($okdns)) { - $okdns[0]="failed"; - } - $rInfo[$i]["access-dns"] = $okdns[0]; + exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_DNS.' | sed -rn "s/.*icmp_seq=1.*time=.*/OK/p"',$okdns); + $rInfo[$i]["access-dns"] = empty($okdns) ? false : true; } } } else { From 33a099de61eef44c0a639d7b53f2dd2d493ad4a2 Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Mon, 29 Jun 2020 13:16:55 +0200 Subject: [PATCH 072/128] Define displayed text for internet access --- templates/networking.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/networking.php b/templates/networking.php index 455544bd..b566a91d 100755 --- a/templates/networking.php +++ b/templates/networking.php @@ -54,8 +54,10 @@ echo "".$route["interface"].""; echo "".$route["ip-address"].""; echo "".$route["gateway"]."
".$route["gw-name"].""; - echo "".$route["access-ip"]."
".RASPI_ACCESS_CHECK_IP.""; - echo "".$route["access-dns"]."
".RASPI_ACCESS_CHECK_DNS.""; + $checkok = $route["access-ip"] ? "✓" : "failed"; + echo "".$checkok."
".RASPI_ACCESS_CHECK_IP.""; + $checkok = $route["access-dns"] ? "✓" : "failed"; + echo "".$checkok."
".RASPI_ACCESS_CHECK_DNS.""; echo ""; } } From 42032e0df0921a53f66326efe13877a172f075cd Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Mon, 29 Jun 2020 13:36:38 +0200 Subject: [PATCH 073/128] Typo corrected --- includes/internetRoute.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/internetRoute.php b/includes/internetRoute.php index db04d685..78207a61 100644 --- a/includes/internetRoute.php +++ b/includes/internetRoute.php @@ -16,10 +16,10 @@ if (!empty($routes) ) { if (isset($checkAccess) && $checkAccess) { // check internet connectivity w/ and w/o DNS resolution unset($okip); - exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_IP.' | sed -rn "s/.*icmp_seq=1.*time=.*/OK/p"',$okip); + exec('ping -W1 -c 1 -I '.$prop[0].' '.RASPI_ACCESS_CHECK_IP.' | sed -rn "s/.*icmp_seq=1.*time=.*/OK/p"',$okip); $rInfo[$i]["access-ip"] = empty($okip) ? false : true; unset($okdns); - exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_DNS.' | sed -rn "s/.*icmp_seq=1.*time=.*/OK/p"',$okdns); + exec('ping -W1 -c 1 -I '.$prop[0].' '.RASPI_ACCESS_CHECK_DNS.' | sed -rn "s/.*icmp_seq=1.*time=.*/OK/p"',$okdns); $rInfo[$i]["access-dns"] = empty($okdns) ? false : true; } } From cfbfff00a9980238e55327b3c9341eace4f50b88 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 29 Jun 2020 14:13:06 +0100 Subject: [PATCH 074/128] Update w/ fontawesome glyphs --- templates/networking.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/networking.php b/templates/networking.php index b566a91d..341e8e0e 100755 --- a/templates/networking.php +++ b/templates/networking.php @@ -54,10 +54,10 @@ echo "".$route["interface"].""; echo "".$route["ip-address"].""; echo "".$route["gateway"]."
".$route["gw-name"].""; - $checkok = $route["access-ip"] ? "✓" : "failed"; - echo "".$checkok."
".RASPI_ACCESS_CHECK_IP.""; - $checkok = $route["access-dns"] ? "✓" : "failed"; - echo "".$checkok."
".RASPI_ACCESS_CHECK_DNS.""; + $status = $route["access-ip"] ? "fa-check" : "fa-times"; + echo '
'.RASPI_ACCESS_CHECK_IP.''; + $status = $route["access-dns"] ? "fa-check" : "fa-times"; + echo '
'.RASPI_ACCESS_CHECK_DNS.''; echo ""; } } From 159d539f59681b1214dbb5c1633cdec4ef756be3 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 29 Jun 2020 16:07:38 +0100 Subject: [PATCH 075/128] Style fontawesome glyphs --- app/css/custom.css | 10 +++++++++- app/css/hackernews.css | 8 ++++++++ app/css/lightsout.css | 8 ++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/css/custom.css b/app/css/custom.css index 75cff67a..c8e6324d 100644 --- a/app/css/custom.css +++ b/app/css/custom.css @@ -228,10 +228,18 @@ canvas#divDBChartBandwidthhourly { .check-updated { opacity: 0; - color: #1cc88a; + color: #90ee90; } .check-progress { color: #999; } +.fa-check { + color: #90ee90; +} + +.fa-times { + color: #ff4500; +} + diff --git a/app/css/hackernews.css b/app/css/hackernews.css index 7af897a2..71dbbd27 100644 --- a/app/css/hackernews.css +++ b/app/css/hackernews.css @@ -263,3 +263,11 @@ canvas#divDBChartBandwidthhourly { color: #999; } +.fa-check { + color: #90ee90; +} + +.fa-times { + color: #ff4500; +} + diff --git a/app/css/lightsout.css b/app/css/lightsout.css index 0de93ab3..e70c4fd7 100644 --- a/app/css/lightsout.css +++ b/app/css/lightsout.css @@ -456,3 +456,11 @@ canvas#divDBChartBandwidthhourly { color: #999; } +.fa-check { + color: #90ee90; +} + +.fa-times { + color: #ff4500; +} + From 624862480dd95d5f414ce735f0999cb622ab97f3 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 00:14:46 +0100 Subject: [PATCH 076/128] Add huebee color-input --- templates/themes.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/templates/themes.php b/templates/themes.php index 4040ee80..0e90a6d9 100755 --- a/templates/themes.php +++ b/templates/themes.php @@ -11,10 +11,14 @@

-
+
+
+ + +
From 665c40d0d45ef46d1584c7b51cc941e849a633d9 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 00:19:47 +0100 Subject: [PATCH 077/128] Update w/ huebee CDN --- index.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.php b/index.php index d6682b8e..7bdfe307 100755 --- a/index.php +++ b/index.php @@ -318,6 +318,10 @@ $bridgedEnabled = $arrHostapdConf['BridgedEnable']; + + + + From 480319a3f494d33b300d2918ad6b0043268b61be Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 00:20:12 +0100 Subject: [PATCH 078/128] Update gulp build --- gulpfile.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 49bbd482..5df9aaa2 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -77,7 +77,10 @@ function modules() { // SB Admin2 CSS var sbadmin2CSS = gulp.src('./node_modules/startbootstrap-sb-admin-2/css/*') .pipe(gulp.dest('./dist/sb-admin-2/css')); - return merge(bootstrapJS, bootstrapSCSS, chartJS, dataTables, fontAwesome, jquery, jqueryEasing, sbadmin2JS, sbadmin2CSS); + // Huebee + var huebee = gulp.src('./node_modules/huebee/dist/*') + .pipe(gulp.dest('./dist/huebee')); + return merge(bootstrapJS, bootstrapSCSS, chartJS, dataTables, fontAwesome, jquery, jqueryEasing, sbadmin2JS, sbadmin2CSS, huebee); } // CSS task From 4af08391fac4ff6ddbccbf31a52440aad77bd30a Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 00:27:54 +0100 Subject: [PATCH 079/128] Update files from gulp build --- dist/huebee/huebee.css | 83 +++ dist/huebee/huebee.min.css | 4 + dist/huebee/huebee.pkgd.js | 1125 ++++++++++++++++++++++++++++++++ dist/huebee/huebee.pkgd.min.js | 22 + 4 files changed, 1234 insertions(+) create mode 100644 dist/huebee/huebee.css create mode 100644 dist/huebee/huebee.min.css create mode 100644 dist/huebee/huebee.pkgd.js create mode 100644 dist/huebee/huebee.pkgd.min.js diff --git a/dist/huebee/huebee.css b/dist/huebee/huebee.css new file mode 100644 index 00000000..f6ef1357 --- /dev/null +++ b/dist/huebee/huebee.css @@ -0,0 +1,83 @@ +/*! Huebee v2.1.0 +https://huebee.buzz +---------------------------------------------- */ + +.huebee { + position: absolute; + z-index: 1; + transform: translateY(0px); + transition: opacity 0.15s, transform 0.15s; +} + +.huebee.is-hidden { + opacity: 0; + transform: translateY(10px); +} + +.huebee.is-static-open { + position: relative; + z-index: auto; +} + +.huebee__container { + position: absolute; + left: 0; + top: 5px; + padding: 10px; + background: #EEE; + border-radius: 5px; + box-shadow: 0 5px 10px hsla(0, 0%, 0%, 0.3); +} + +.huebee.is-static-open .huebee__container { + position: relative; + display: inline-block; + left: auto; + top: auto; + box-shadow: none; +} + +.huebee__canvas { + display: block; + cursor: pointer; +} + +.huebee__cursor { + width: 15px; + height: 15px; + position: absolute; + left: 0px; + top: 0px; + box-sizing: content-box; + border: 3px solid white; + border-radius: 5px; + pointer-events: none; +} + +.huebee__cursor.is-hidden { opacity: 0; } + +.huebee__close-button { + display: block; + position: absolute; + width: 24px; + height: 24px; + top: -9px; + right: -9px; + border-radius: 12px; + background: #222; +} + +.huebee__close-button__x { + stroke: white; + stroke-width: 3; + stroke-linecap: round; +} + +.huebee__close-button:hover { + background: white; + cursor: pointer; +} + +.huebee__close-button:hover .huebee__close-button__x { + stroke: #222; +} diff --git a/dist/huebee/huebee.min.css b/dist/huebee/huebee.min.css new file mode 100644 index 00000000..3f826deb --- /dev/null +++ b/dist/huebee/huebee.min.css @@ -0,0 +1,4 @@ +/*! Huebee v2.1.0 +https://huebee.buzz +---------------------------------------------- */ +.huebee{position:absolute;z-index:1;transform:translateY(0);transition:opacity .15s,transform .15s}.huebee.is-hidden{opacity:0;transform:translateY(10px)}.huebee.is-static-open{position:relative;z-index:auto}.huebee__container{position:absolute;left:0;top:5px;padding:10px;background:#eee;border-radius:5px;box-shadow:0 5px 10px hsla(0,0%,0%,.3)}.huebee.is-static-open .huebee__container{position:relative;display:inline-block;left:auto;top:auto;box-shadow:none}.huebee__canvas{display:block;cursor:pointer}.huebee__cursor{width:15px;height:15px;position:absolute;left:0;top:0;box-sizing:content-box;border:3px solid #fff;border-radius:5px;pointer-events:none}.huebee__cursor.is-hidden{opacity:0}.huebee__close-button{display:block;position:absolute;width:24px;height:24px;top:-9px;right:-9px;border-radius:12px;background:#222}.huebee__close-button__x{stroke:#fff;stroke-width:3;stroke-linecap:round}.huebee__close-button:hover{background:#fff;cursor:pointer}.huebee__close-button:hover .huebee__close-button__x{stroke:#222} \ No newline at end of file diff --git a/dist/huebee/huebee.pkgd.js b/dist/huebee/huebee.pkgd.js new file mode 100644 index 00000000..704bd961 --- /dev/null +++ b/dist/huebee/huebee.pkgd.js @@ -0,0 +1,1125 @@ +/*! + * Huebee PACKAGED v2.1.0 + * 1-click color picker + * MIT license + * https://huebee.buzz + * Copyright 2020 Metafizzy + */ + +/** + * EvEmitter v1.1.0 + * Lil' event emitter + * MIT License + */ + +/* jshint unused: true, undef: true, strict: true */ + +( function( global, factory ) { + // universal module definition + /* jshint strict: false */ /* globals define, module, window */ + if ( typeof define == 'function' && define.amd ) { + // AMD - RequireJS + define( 'ev-emitter/ev-emitter',factory ); + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS - Browserify, Webpack + module.exports = factory(); + } else { + // Browser globals + global.EvEmitter = factory(); + } + +}( typeof window != 'undefined' ? window : this, function() { + +"use strict"; + +function EvEmitter() {} + +var proto = EvEmitter.prototype; + +proto.on = function( eventName, listener ) { + if ( !eventName || !listener ) { + return; + } + // set events hash + var events = this._events = this._events || {}; + // set listeners array + var listeners = events[ eventName ] = events[ eventName ] || []; + // only add once + if ( listeners.indexOf( listener ) == -1 ) { + listeners.push( listener ); + } + + return this; +}; + +proto.once = function( eventName, listener ) { + if ( !eventName || !listener ) { + return; + } + // add event + this.on( eventName, listener ); + // set once flag + // set onceEvents hash + var onceEvents = this._onceEvents = this._onceEvents || {}; + // set onceListeners object + var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; + // set flag + onceListeners[ listener ] = true; + + return this; +}; + +proto.off = function( eventName, listener ) { + var listeners = this._events && this._events[ eventName ]; + if ( !listeners || !listeners.length ) { + return; + } + var index = listeners.indexOf( listener ); + if ( index != -1 ) { + listeners.splice( index, 1 ); + } + + return this; +}; + +proto.emitEvent = function( eventName, args ) { + var listeners = this._events && this._events[ eventName ]; + if ( !listeners || !listeners.length ) { + return; + } + // copy over to avoid interference if .off() in listener + listeners = listeners.slice(0); + args = args || []; + // once stuff + var onceListeners = this._onceEvents && this._onceEvents[ eventName ]; + + for ( var i=0; i < listeners.length; i++ ) { + var listener = listeners[i] + var isOnce = onceListeners && onceListeners[ listener ]; + if ( isOnce ) { + // remove listener + // remove before trigger to prevent recursion + this.off( eventName, listener ); + // unset once flag + delete onceListeners[ listener ]; + } + // trigger listener + listener.apply( this, args ); + } + + return this; +}; + +proto.allOff = function() { + delete this._events; + delete this._onceEvents; +}; + +return EvEmitter; + +})); +/*! + * Unipointer v2.3.0 + * base class for doing one thing with pointer event + * MIT license + */ + +/*jshint browser: true, undef: true, unused: true, strict: true */ + +( function( window, factory ) { + // universal module definition + /* jshint strict: false */ /*global define, module, require */ + if ( typeof define == 'function' && define.amd ) { + // AMD + define( 'unipointer/unipointer',[ + 'ev-emitter/ev-emitter' + ], function( EvEmitter ) { + return factory( window, EvEmitter ); + }); + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS + module.exports = factory( + window, + require('ev-emitter') + ); + } else { + // browser global + window.Unipointer = factory( + window, + window.EvEmitter + ); + } + +}( window, function factory( window, EvEmitter ) { + +'use strict'; + +function noop() {} + +function Unipointer() {} + +// inherit EvEmitter +var proto = Unipointer.prototype = Object.create( EvEmitter.prototype ); + +proto.bindStartEvent = function( elem ) { + this._bindStartEvent( elem, true ); +}; + +proto.unbindStartEvent = function( elem ) { + this._bindStartEvent( elem, false ); +}; + +/** + * Add or remove start event + * @param {Boolean} isAdd - remove if falsey + */ +proto._bindStartEvent = function( elem, isAdd ) { + // munge isAdd, default to true + isAdd = isAdd === undefined ? true : isAdd; + var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener'; + + // default to mouse events + var startEvent = 'mousedown'; + if ( window.PointerEvent ) { + // Pointer Events + startEvent = 'pointerdown'; + } else if ( 'ontouchstart' in window ) { + // Touch Events. iOS Safari + startEvent = 'touchstart'; + } + elem[ bindMethod ]( startEvent, this ); +}; + +// trigger handler methods for events +proto.handleEvent = function( event ) { + var method = 'on' + event.type; + if ( this[ method ] ) { + this[ method ]( event ); + } +}; + +// returns the touch that we're keeping track of +proto.getTouch = function( touches ) { + for ( var i=0; i < touches.length; i++ ) { + var touch = touches[i]; + if ( touch.identifier == this.pointerIdentifier ) { + return touch; + } + } +}; + +// ----- start event ----- // + +proto.onmousedown = function( event ) { + // dismiss clicks from right or middle buttons + var button = event.button; + if ( button && ( button !== 0 && button !== 1 ) ) { + return; + } + this._pointerDown( event, event ); +}; + +proto.ontouchstart = function( event ) { + this._pointerDown( event, event.changedTouches[0] ); +}; + +proto.onpointerdown = function( event ) { + this._pointerDown( event, event ); +}; + +/** + * pointer start + * @param {Event} event + * @param {Event or Touch} pointer + */ +proto._pointerDown = function( event, pointer ) { + // dismiss right click and other pointers + // button = 0 is okay, 1-4 not + if ( event.button || this.isPointerDown ) { + return; + } + + this.isPointerDown = true; + // save pointer identifier to match up touch events + this.pointerIdentifier = pointer.pointerId !== undefined ? + // pointerId for pointer events, touch.indentifier for touch events + pointer.pointerId : pointer.identifier; + + this.pointerDown( event, pointer ); +}; + +proto.pointerDown = function( event, pointer ) { + this._bindPostStartEvents( event ); + this.emitEvent( 'pointerDown', [ event, pointer ] ); +}; + +// hash of events to be bound after start event +var postStartEvents = { + mousedown: [ 'mousemove', 'mouseup' ], + touchstart: [ 'touchmove', 'touchend', 'touchcancel' ], + pointerdown: [ 'pointermove', 'pointerup', 'pointercancel' ], +}; + +proto._bindPostStartEvents = function( event ) { + if ( !event ) { + return; + } + // get proper events to match start event + var events = postStartEvents[ event.type ]; + // bind events to node + events.forEach( function( eventName ) { + window.addEventListener( eventName, this ); + }, this ); + // save these arguments + this._boundPointerEvents = events; +}; + +proto._unbindPostStartEvents = function() { + // check for _boundEvents, in case dragEnd triggered twice (old IE8 bug) + if ( !this._boundPointerEvents ) { + return; + } + this._boundPointerEvents.forEach( function( eventName ) { + window.removeEventListener( eventName, this ); + }, this ); + + delete this._boundPointerEvents; +}; + +// ----- move event ----- // + +proto.onmousemove = function( event ) { + this._pointerMove( event, event ); +}; + +proto.onpointermove = function( event ) { + if ( event.pointerId == this.pointerIdentifier ) { + this._pointerMove( event, event ); + } +}; + +proto.ontouchmove = function( event ) { + var touch = this.getTouch( event.changedTouches ); + if ( touch ) { + this._pointerMove( event, touch ); + } +}; + +/** + * pointer move + * @param {Event} event + * @param {Event or Touch} pointer + * @private + */ +proto._pointerMove = function( event, pointer ) { + this.pointerMove( event, pointer ); +}; + +// public +proto.pointerMove = function( event, pointer ) { + this.emitEvent( 'pointerMove', [ event, pointer ] ); +}; + +// ----- end event ----- // + + +proto.onmouseup = function( event ) { + this._pointerUp( event, event ); +}; + +proto.onpointerup = function( event ) { + if ( event.pointerId == this.pointerIdentifier ) { + this._pointerUp( event, event ); + } +}; + +proto.ontouchend = function( event ) { + var touch = this.getTouch( event.changedTouches ); + if ( touch ) { + this._pointerUp( event, touch ); + } +}; + +/** + * pointer up + * @param {Event} event + * @param {Event or Touch} pointer + * @private + */ +proto._pointerUp = function( event, pointer ) { + this._pointerDone(); + this.pointerUp( event, pointer ); +}; + +// public +proto.pointerUp = function( event, pointer ) { + this.emitEvent( 'pointerUp', [ event, pointer ] ); +}; + +// ----- pointer done ----- // + +// triggered on pointer up & pointer cancel +proto._pointerDone = function() { + this._pointerReset(); + this._unbindPostStartEvents(); + this.pointerDone(); +}; + +proto._pointerReset = function() { + // reset properties + this.isPointerDown = false; + delete this.pointerIdentifier; +}; + +proto.pointerDone = noop; + +// ----- pointer cancel ----- // + +proto.onpointercancel = function( event ) { + if ( event.pointerId == this.pointerIdentifier ) { + this._pointerCancel( event, event ); + } +}; + +proto.ontouchcancel = function( event ) { + var touch = this.getTouch( event.changedTouches ); + if ( touch ) { + this._pointerCancel( event, touch ); + } +}; + +/** + * pointer cancel + * @param {Event} event + * @param {Event or Touch} pointer + * @private + */ +proto._pointerCancel = function( event, pointer ) { + this._pointerDone(); + this.pointerCancel( event, pointer ); +}; + +// public +proto.pointerCancel = function( event, pointer ) { + this.emitEvent( 'pointerCancel', [ event, pointer ] ); +}; + +// ----- ----- // + +// utility function for getting x/y coords from event +Unipointer.getPointerPoint = function( pointer ) { + return { + x: pointer.pageX, + y: pointer.pageY + }; +}; + +// ----- ----- // + +return Unipointer; + +})); +/*! + * Huebee v2.1.0 + * 1-click color picker + * MIT license + * https://huebee.buzz + * Copyright 2020 Metafizzy + */ + +/* jshint browser: true, unused: true, undef: true */ + +( function( window, factory ) { + // universal module definition + if ( typeof define == 'function' && define.amd ) { + /* globals define */ // AMD + define( [ + 'ev-emitter/ev-emitter', + 'unipointer/unipointer', + ], function( EvEmitter, Unipointer ) { + return factory( window, EvEmitter, Unipointer ); + } ); + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS + module.exports = factory( + window, + require('ev-emitter'), + require('unipointer') + ); + } else { + // browser global + window.Huebee = factory( + window, + window.EvEmitter, + window.Unipointer + ); + } + +}( window, function factory( window, EvEmitter, Unipointer ) { + +function Huebee( anchor, options ) { + // anchor + anchor = getQueryElement( anchor ); + if ( !anchor ) { + throw new Error( 'Bad element for Huebee: ' + anchor ); + } + this.anchor = anchor; + // options + this.options = {}; + this.option( Huebee.defaults ); + this.option( options ); + // kick things off + this.create(); +} + +Huebee.defaults = { + hues: 12, + hue0: 0, + shades: 5, + saturations: 3, + notation: 'shortHex', + setText: true, + setBGColor: true, +}; + +var proto = Huebee.prototype = Object.create( EvEmitter.prototype ); + +proto.option = function( options ) { + this.options = extend( this.options, options ); +}; + +// globally unique identifiers +var GUID = 0; +// internal store of all Colcade intances +var instances = {}; + +proto.create = function() { + // add guid for Colcade.data + var guid = this.guid = ++GUID; + this.anchor.huebeeGUID = guid; + instances[ guid ] = this; // associate via id + // properties + this.setBGElems = this.getSetElems( this.options.setBGColor ); + this.setTextElems = this.getSetElems( this.options.setText ); + // events + // HACK: this is getting ugly + this.outsideCloseIt = this.outsideClose.bind( this ); + this.onDocKeydown = this.docKeydown.bind( this ); + this.closeIt = this.close.bind( this ); + this.openIt = this.open.bind( this ); + this.onElemTransitionend = this.elemTransitionend.bind( this ); + // open events + this.isInputAnchor = this.anchor.nodeName == 'INPUT'; + if ( !this.options.staticOpen ) { + this.anchor.addEventListener( 'click', this.openIt ); + this.anchor.addEventListener( 'focus', this.openIt ); + } + // change event + if ( this.isInputAnchor ) { + this.anchor.addEventListener( 'input', this.inputInput.bind( this ) ); + } + // create element + var element = this.element = document.createElement('div'); + element.className = 'huebee '; + element.className += this.options.staticOpen ? 'is-static-open ' : + 'is-hidden '; + element.className += this.options.className || ''; + // create container + var container = this.container = document.createElement('div'); + container.className = 'huebee__container'; + // do not blur if padding clicked + function onContainerPointerStart( event ) { + if ( event.target == container ) { + event.preventDefault(); + } + } + container.addEventListener( 'mousedown', onContainerPointerStart ); + container.addEventListener( 'touchstart', onContainerPointerStart ); + // create canvas + this.createCanvas(); + // create cursor + this.cursor = document.createElement('div'); + this.cursor.className = 'huebee__cursor is-hidden'; + container.appendChild( this.cursor ); + // create close button + this.createCloseButton(); + + element.appendChild( container ); + // set relative position on parent + if ( !this.options.staticOpen ) { + var parentStyle = getComputedStyle( this.anchor.parentNode ); + if ( parentStyle.position != 'relative' && parentStyle.position != 'absolute' ) { + this.anchor.parentNode.style.position = 'relative'; + } + } + + // satY, y position where saturation grid starts + var customLength = this.getCustomLength(); + this.satY = customLength ? Math.ceil( customLength / this.options.hues ) + 1 : 0; + // colors + this.updateColors(); + this.setAnchorColor(); + if ( this.options.staticOpen ) { + this.open(); + } +}; + +proto.getSetElems = function( option ) { + if ( option === true ) { + return [ this.anchor ]; + } else if ( typeof option == 'string' ) { + return document.querySelectorAll( option ); + } +}; + +proto.getCustomLength = function() { + var customColors = this.options.customColors; + return customColors && customColors.length || 0; +}; + +proto.createCanvas = function() { + var canvas = this.canvas = document.createElement('canvas'); + canvas.className = 'huebee__canvas'; + this.ctx = canvas.getContext('2d'); + // canvas pointer events + var canvasPointer = this.canvasPointer = new Unipointer(); + canvasPointer._bindStartEvent( canvas ); + canvasPointer.on( 'pointerDown', this.canvasPointerDown.bind( this ) ); + canvasPointer.on( 'pointerMove', this.canvasPointerMove.bind( this ) ); + this.container.appendChild( canvas ); +}; + +var svgURI = 'http://www.w3.org/2000/svg'; + +proto.createCloseButton = function() { + if ( this.options.staticOpen ) { + return; + } + var svg = document.createElementNS( svgURI, 'svg' ); + svg.setAttribute( 'class', 'huebee__close-button' ); + svg.setAttribute( 'viewBox', '0 0 24 24' ); + svg.setAttribute( 'width', '24' ); + svg.setAttribute( 'height', '24' ); + var path = document.createElementNS( svgURI, 'path' ); + path.setAttribute( 'd', 'M 7,7 L 17,17 M 17,7 L 7,17' ); + path.setAttribute( 'class', 'huebee__close-button__x' ); + svg.appendChild( path ); + svg.addEventListener( 'click', this.closeIt ); + this.container.appendChild( svg ); +}; + +proto.updateColors = function() { + // hash of color, h, s, l according to x,y grid position + // [x,y] = { color, h, s, l } + this.swatches = {}; + // hash of gridX,gridY position according to color + // [#09F] = { x, y } + this.colorGrid = {}; + this.updateColorModer(); + + var shades = this.options.shades; + var sats = this.options.saturations; + var hues = this.options.hues; + + // render custom colors + if ( this.getCustomLength() ) { + var customI = 0; + this.options.customColors.forEach( function( color ) { + var x = customI % hues; + var y = Math.floor( customI/hues ); + var swatch = getSwatch( color ); + if ( swatch ) { + this.addSwatch( swatch, x, y ); + customI++; + } + }.bind( this ) ); + } + + // render saturation grids + var i; + for ( i = 0; i < sats; i++ ) { + var sat = 1 - i/sats; + var yOffset = shades * i + this.satY; + this.updateSaturationGrid( i, sat, yOffset ); + } + + // render grays + var grayCount = this.getGrayCount(); + for ( i = 0; i < grayCount; i++ ) { + var lum = 1 - i / ( shades + 1 ); + var color = this.colorModer( 0, 0, lum ); + var swatch = getSwatch( color ); + this.addSwatch( swatch, hues + 1, i ); + } +}; + +// get shades + black & white; else 0 +proto.getGrayCount = function() { + return this.options.shades ? this.options.shades + 2 : 0; +}; + +proto.updateSaturationGrid = function( i, sat, yOffset ) { + var shades = this.options.shades; + var hues = this.options.hues; + var hue0 = this.options.hue0; + for ( var row = 0; row < shades; row++ ) { + for ( var col = 0; col < hues; col++ ) { + var hue = Math.round( col * 360/hues + hue0 ) % 360; + var lum = 1 - ( row + 1 ) / ( shades + 1 ); + var color = this.colorModer( hue, sat, lum ); + var swatch = getSwatch( color ); + var gridY = row + yOffset; + this.addSwatch( swatch, col, gridY ); + } + } +}; + +proto.addSwatch = function( swatch, gridX, gridY ) { + // add swatch color to hash + this.swatches[ gridX + ',' + gridY ] = swatch; + // add color to colorGrid + this.colorGrid[ swatch.color.toUpperCase() ] = { + x: gridX, + y: gridY, + }; +}; + +var colorModers = { + hsl: function( h, s, l ) { + s = Math.round( s * 100 ); + l = Math.round( l * 100 ); + return 'hsl(' + h + ', ' + s + '%, ' + l + '%)'; + }, + hex: hsl2hex, + shortHex: function( h, s, l ) { + var hex = hsl2hex( h, s, l ); + return roundHex( hex ); + }, +}; + +proto.updateColorModer = function() { + this.colorModer = colorModers[ this.options.notation ] || colorModers.shortHex; +}; + +proto.renderColors = function() { + var gridSize = this.gridSize * 2; + for ( var position in this.swatches ) { + var swatch = this.swatches[ position ]; + var duple = position.split(','); + var gridX = duple[0]; + var gridY = duple[1]; + this.ctx.fillStyle = swatch.color; + this.ctx.fillRect( gridX * gridSize, gridY * gridSize, gridSize, gridSize ); + } +}; + +proto.setAnchorColor = function() { + if ( this.isInputAnchor ) { + this.setColor( this.anchor.value ); + } +}; + +// ----- events ----- // + +var docElem = document.documentElement; + +proto.open = function() { + /* jshint unused: false */ + if ( this.isOpen ) { + return; + } + var anchor = this.anchor; + var elem = this.element; + if ( !this.options.staticOpen ) { + elem.style.left = anchor.offsetLeft + 'px'; + elem.style.top = anchor.offsetTop + anchor.offsetHeight + 'px'; + } + this.bindOpenEvents( true ); + elem.removeEventListener( 'transitionend', this.onElemTransitionend ); + // add huebee to DOM + anchor.parentNode.insertBefore( elem, anchor.nextSibling ); + // measurements + var duration = getComputedStyle( elem ).transitionDuration; + this.hasTransition = duration && duration != 'none' && parseFloat( duration ); + + this.isOpen = true; + this.updateSizes(); + this.renderColors(); + this.setAnchorColor(); + + // trigger reflow for transition + /* eslint-disable-next-line no-unused-vars */ + var h = elem.offsetHeight; + elem.classList.remove('is-hidden'); +}; + +proto.bindOpenEvents = function( isAdd ) { + if ( this.options.staticOpen ) { + return; + } + var method = ( isAdd ? 'add' : 'remove' ) + 'EventListener'; + docElem[ method ]( 'mousedown', this.outsideCloseIt ); + docElem[ method ]( 'touchstart', this.outsideCloseIt ); + document[ method ]( 'focusin', this.outsideCloseIt ); + document[ method ]( 'keydown', this.onDocKeydown ); + this.anchor[ method ]( 'blur', this.closeIt ); +}; + +proto.updateSizes = function() { + var hues = this.options.hues; + var shades = this.options.shades; + var sats = this.options.saturations; + var grayCount = this.getGrayCount(); + var customLength = this.getCustomLength(); + + this.cursorBorder = parseInt( getComputedStyle( this.cursor ).borderTopWidth, 10 ); + this.gridSize = Math.round( this.cursor.offsetWidth - this.cursorBorder * 2 ); + this.canvasOffset = { + x: this.canvas.offsetLeft, + y: this.canvas.offsetTop, + }; + var cols, rows; + if ( customLength && !grayCount ) { + // custom colors only + cols = Math.min( customLength, hues ); + rows = Math.ceil( customLength/hues ); + } else { + cols = hues + 2; + rows = Math.max( shades * sats + this.satY, grayCount ); + } + var width = this.canvas.width = cols * this.gridSize * 2; + this.canvas.height = rows * this.gridSize * 2; + this.canvas.style.width = width/2 + 'px'; +}; + +// close if target is not anchor or element +proto.outsideClose = function( event ) { + var isAnchor = this.anchor.contains( event.target ); + var isElement = this.element.contains( event.target ); + if ( !isAnchor && !isElement ) { + this.close(); + } +}; + +var closeKeydowns = { + 13: true, // enter + 27: true, // esc +}; + +proto.docKeydown = function( event ) { + if ( closeKeydowns[ event.keyCode ] ) { + this.close(); + } +}; + +var supportsTransitions = typeof docElem.style.transform == 'string'; + +proto.close = function() { + if ( !this.isOpen ) { + return; + } + + if ( supportsTransitions && this.hasTransition ) { + this.element.addEventListener( 'transitionend', this.onElemTransitionend ); + } else { + this.remove(); + } + this.element.classList.add('is-hidden'); + + this.bindOpenEvents( false ); + this.isOpen = false; +}; + +proto.remove = function() { + var parent = this.element.parentNode; + if ( parent.contains( this.element ) ) { + parent.removeChild( this.element ); + } +}; + +proto.elemTransitionend = function( event ) { + if ( event.target != this.element ) { + return; + } + this.element.removeEventListener( 'transitionend', this.onElemTransitionend ); + this.remove(); +}; + +proto.inputInput = function() { + this.setColor( this.anchor.value ); +}; + +// ----- canvas pointer ----- // + +proto.canvasPointerDown = function( event, pointer ) { + event.preventDefault(); + this.updateOffset(); + this.canvasPointerChange( pointer ); +}; + +proto.updateOffset = function() { + var boundingRect = this.canvas.getBoundingClientRect(); + this.offset = { + x: boundingRect.left + window.pageXOffset, + y: boundingRect.top + window.pageYOffset, + }; +}; + +proto.canvasPointerMove = function( event, pointer ) { + this.canvasPointerChange( pointer ); +}; + +proto.canvasPointerChange = function( pointer ) { + var x = Math.round( pointer.pageX - this.offset.x ); + var y = Math.round( pointer.pageY - this.offset.y ); + var gridSize = this.gridSize; + var sx = Math.floor( x/gridSize ); + var sy = Math.floor( y/gridSize ); + + var swatch = this.swatches[ sx + ',' + sy ]; + this.setSwatch( swatch ); +}; + +// ----- select ----- // + +proto.setColor = function( color ) { + var swatch = getSwatch( color ); + this.setSwatch( swatch ); +}; + +proto.setSwatch = function( swatch ) { + var color = swatch && swatch.color; + if ( !swatch ) { + return; + } + var wasSameColor = color == this.color; + // color properties + this.color = color; + this.hue = swatch.hue; + this.sat = swatch.sat; + this.lum = swatch.lum; + // estimate if color can have dark or white text + var lightness = this.lum - Math.cos( ( this.hue + 70 )/180 * Math.PI ) * 0.15; + this.isLight = lightness > 0.5; + // cursor + var gridPosition = this.colorGrid[ color.toUpperCase() ]; + this.updateCursor( gridPosition ); + // set texts & backgrounds + this.setTexts(); + this.setBackgrounds(); + // event + if ( !wasSameColor ) { + this.emitEvent( 'change', [ color, swatch.hue, swatch.sat, swatch.lum ] ); + } +}; + +proto.setTexts = function() { + if ( !this.setTextElems ) { + return; + } + for ( var i = 0; i < this.setTextElems.length; i++ ) { + var elem = this.setTextElems[i]; + var property = elem.nodeName == 'INPUT' ? 'value' : 'textContent'; + elem[ property ] = this.color; + } +}; + +proto.setBackgrounds = function() { + if ( !this.setBGElems ) { + return; + } + var textColor = this.isLight ? '#222' : 'white'; + for ( var i = 0; i < this.setBGElems.length; i++ ) { + var elem = this.setBGElems[i]; + elem.style.backgroundColor = this.color; + elem.style.color = textColor; + } +}; + +proto.updateCursor = function( position ) { + if ( !this.isOpen ) { + return; + } + // show cursor if color is on the grid + var classMethod = position ? 'remove' : 'add'; + this.cursor.classList[ classMethod ]('is-hidden'); + + if ( !position ) { + return; + } + var gridSize = this.gridSize; + var offset = this.canvasOffset; + var border = this.cursorBorder; + this.cursor.style.left = position.x * gridSize + offset.x - border + 'px'; + this.cursor.style.top = position.y * gridSize + offset.y - border + 'px'; +}; + +// -------------------------- htmlInit -------------------------- // + +var console = window.console; + +function htmlInit() { + var elems = document.querySelectorAll('[data-huebee]'); + for ( var i = 0; i < elems.length; i++ ) { + var elem = elems[i]; + var attr = elem.getAttribute('data-huebee'); + var options; + try { + options = attr && JSON.parse( attr ); + } catch ( error ) { + // log error, do not initialize + if ( console ) { + console.error( 'Error parsing data-huebee on ' + elem.className + + ': ' + error ); + } + continue; + } + // initialize + new Huebee( elem, options ); + } +} + +var readyState = document.readyState; +if ( readyState == 'complete' || readyState == 'interactive' ) { + htmlInit(); +} else { + document.addEventListener( 'DOMContentLoaded', htmlInit ); +} + +// -------------------------- Huebee.data -------------------------- // + +Huebee.data = function( elem ) { + elem = getQueryElement( elem ); + var id = elem && elem.huebeeGUID; + return id && instances[ id ]; +}; + +// -------------------------- getSwatch -------------------------- // + +// proxy canvas used to check colors +var proxyCanvas = document.createElement('canvas'); +proxyCanvas.width = proxyCanvas.height = 1; +var proxyCtx = proxyCanvas.getContext('2d'); + +function getSwatch( color ) { + // check that color value is valid + proxyCtx.clearRect( 0, 0, 1, 1 ); + proxyCtx.fillStyle = '#010203'; // reset value + proxyCtx.fillStyle = color; + proxyCtx.fillRect( 0, 0, 1, 1 ); + var data = proxyCtx.getImageData( 0, 0, 1, 1 ).data; + // convert to array, imageData not array, #10 + data = [ data[0], data[1], data[2], data[3] ]; + if ( data.join(',') == '1,2,3,255' ) { + // invalid color + return; + } + // convert rgb to hsl + var hsl = rgb2hsl.apply( this, data ); + return { + color: color.trim(), + hue: hsl[0], + sat: hsl[1], + lum: hsl[2], + }; +} + +// -------------------------- utils -------------------------- // + +function extend( a, b ) { + for ( var prop in b ) { + a[ prop ] = b[ prop ]; + } + return a; +} + +function getQueryElement( elem ) { + if ( typeof elem == 'string' ) { + elem = document.querySelector( elem ); + } + return elem; +} + +function hsl2hex( h, s, l ) { + var rgb = hsl2rgb( h, s, l ); + return rgb2hex( rgb ); +} + +// thx jfsiii +// https://github.com/jfsiii/chromath/blob/master/src/static.js#L312 +/* eslint-disable max-statements-per-line */ +function hsl2rgb( h, s, l ) { + + var C = ( 1 - Math.abs( 2 * l - 1 ) ) * s; + var hp = h/60; + var X = C * ( 1 - Math.abs( hp % 2 - 1 ) ); + var rgb, m; + + switch ( Math.floor( hp ) ) { + case 0: rgb = [ C, X, 0 ]; break; + case 1: rgb = [ X, C, 0 ]; break; + case 2: rgb = [ 0, C, X ]; break; + case 3: rgb = [ 0, X, C ]; break; + case 4: rgb = [ X, 0, C ]; break; + case 5: rgb = [ C, 0, X ]; break; + default: rgb = [ 0, 0, 0 ]; + } + + m = l - ( C/2 ); + rgb = rgb.map( function( v ) { + return v + m; + } ); + + return rgb; +} + +function rgb2hsl( r, g, b ) { + r /= 255; g /= 255; b /= 255; + + var M = Math.max( r, g, b ); + var m = Math.min( r, g, b ); + var C = M - m; + var L = 0.5 * ( M + m ); + var S = C === 0 ? 0 : C / ( 1 - Math.abs( 2 * L - 1 ) ); + + var h; + if ( C === 0 ) { + h = 0; // spec'd as undefined, but usually set to 0 + } else if ( M === r ) { + h = ( ( g - b )/C ) % 6; + } else if ( M === g ) { + h = ( ( b - r )/C ) + 2; + } else if ( M === b ) { + h = ( ( r - g )/C ) + 4; + } + + var H = 60 * h; + + return [ H, parseFloat( S ), parseFloat( L ) ]; +} +/* eslint-enable max-statements-per-line */ + +function rgb2hex( rgb ) { + var hex = rgb.map( function( value ) { + value = Math.round( value * 255 ); + var hexNum = value.toString( 16 ).toUpperCase(); + // left pad 0 + hexNum = hexNum.length < 2 ? '0' + hexNum : hexNum; + return hexNum; + } ); + + return '#' + hex.join(''); +} + +// #123456 -> #135 +// grab first digit from hex +// not mathematically accurate, but makes for better palette +function roundHex( hex ) { + return '#' + hex[1] + hex[3] + hex[5]; +} + +// -------------------------- -------------------------- // + +return Huebee; + +} ) ); diff --git a/dist/huebee/huebee.pkgd.min.js b/dist/huebee/huebee.pkgd.min.js new file mode 100644 index 00000000..fdd8c3ac --- /dev/null +++ b/dist/huebee/huebee.pkgd.min.js @@ -0,0 +1,22 @@ +/*! + * Huebee PACKAGED v2.1.0 + * 1-click color picker + * MIT license + * https://huebee.buzz + * Copyright 2020 Metafizzy + */ +(function(t,e){if(typeof define=="function"&&define.amd){define("ev-emitter/ev-emitter",e)}else if(typeof module=="object"&&module.exports){module.exports=e()}else{t.EvEmitter=e()}})(typeof window!="undefined"?window:this,function(){"use strict";function t(){}var e=t.prototype;e.on=function(t,e){if(!t||!e){return}var i=this._events=this._events||{};var n=i[t]=i[t]||[];if(n.indexOf(e)==-1){n.push(e)}return this};e.once=function(t,e){if(!t||!e){return}this.on(t,e);var i=this._onceEvents=this._onceEvents||{};var n=i[t]=i[t]||{};n[e]=true;return this};e.off=function(t,e){var i=this._events&&this._events[t];if(!i||!i.length){return}var n=i.indexOf(e);if(n!=-1){i.splice(n,1)}return this};e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(!i||!i.length){return}i=i.slice(0);e=e||[];var n=this._onceEvents&&this._onceEvents[t];for(var o=0;o.5;var o=this.colorGrid[e.toUpperCase()];this.updateCursor(o);this.setTexts();this.setBackgrounds();if(!i){this.emitEvent("change",[e,t.hue,t.sat,t.lum])}};o.setTexts=function(){if(!this.setTextElems){return}for(var t=0;t Date: Tue, 30 Jun 2020 00:28:39 +0100 Subject: [PATCH 080/128] Replace CDN links w/ dist --- index.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 7bdfe307..4345c58b 100755 --- a/index.php +++ b/index.php @@ -82,6 +82,9 @@ $bridgedEnabled = $arrHostapdConf['BridgedEnable']; + + + @@ -318,9 +321,8 @@ $bridgedEnabled = $arrHostapdConf['BridgedEnable']; - - - + + From 8132296d4cdfd33a740da1c5af9e1b588f0bb339 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 00:29:27 +0100 Subject: [PATCH 081/128] Update dependencies --- package.json | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index a96a30c8..2d0f1236 100644 --- a/package.json +++ b/package.json @@ -30,20 +30,22 @@ "url": "https://github.com/billz/raspap-webgui.git" }, "dependencies": { - "startbootstrap-sb-admin-2": "4.0.7", - "jquery": "^3.5.0" - }, - "devDependencies": { "browser-sync": "^2.26.7", "del": "^5.1.0", "gulp": "^4.0.2", "gulp-autoprefixer": "^7.0.1", - "gulp-clean-css": "^4.2.0", + "gulp-clean-css": "^4.3.0", "gulp-header": "^2.0.9", "gulp-plumber": "^1.2.1", - "gulp-rename": "1.4.0", - "gulp-sass": "^4.0.2", + "gulp-rename": "^2.0.0", "gulp-uglify": "^3.0.2", - "merge-stream": "^2.0.0" + "huebee": "^2.1.0", + "jquery": "^3.5.0", + "merge-stream": "^2.0.0", + "node-gyp": "^7.0.0", + "startbootstrap-sb-admin-2": "4.0.7" + }, + "devDependencies": { + "gulp-sass": "^4.0.2" } } From 4eb3d6b24ce0903af9b48940c6a9d40e3bb26ac2 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 16:46:04 +0100 Subject: [PATCH 082/128] Convert to dynamic css --- app/css/custom.php | 258 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 app/css/custom.php diff --git a/app/css/custom.php b/app/css/custom.php new file mode 100644 index 00000000..6b50cc58 --- /dev/null +++ b/app/css/custom.php @@ -0,0 +1,258 @@ + + + +/* +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; +} + +.page-header { + margin: 20px 0 20px; +} + +.navbar-logo { + margin-top: 0.5em; + margin-left: 0.5em; +} + +/* Small devices (portrait phones, up to 576px) */ +@media (max-width: 576px) { + .container-fluid, .card-body, .col-md-6 { padding-left: 0.5rem; padding-right: 0.5rem; } + .card .card-header { padding: .75rem .5rem; font-size: 1.0rem; } + .row { margin-left: 0rem; margin-right: 0rem; } + .col-lg-12 { padding-right: 0.25rem; padding-left: 0.25rem; } + .form-group.col-md-6 { margin-left: -0.5rem; } + .js-wifi-stations { margin-left: -0.5rem; margin-right: -0.5rem; } + h4.mt-3 { margin-left: 0.5rem; } +} + +.sidebar { + background-color: #f8f9fc; +} + +.sidebar-brand-text { + text-transform: none; + color: #212529; + font-size: 2.0rem; + font-weight: 500; + font-family: Helvetica, Arial, sans-serif; +} + +.sidebar .nav-item.active .nav-link { + font-weight: 500; +} + +.card .card-header { + border-color: ; + color: #fff; + background-color: ; +} + +.btn-primary { + color: ; + border-color: ; + background-color: #fff; +} + +.card-footer { + background-color: #f2f1f0; +} + +.nav-item { + font-size: 0.85rem; +} + +.nav-tabs .nav-link.active, +.nav-tabs .nav-link { + font-size: 1.0rem; +} + +.nav-tabs a.nav-link { + color: #6e707e; +} + +a.nav-link.active { + font-weight: bolder; +} + +.sidebar .nav-item .nav-link { + padding: 0.6rem 0.6rem 0.6rem 1.0rem; +} + +.alert-success { + background-color: #d4edda; +} + +.btn-primary { + background-color: #fff; +} + +.btn-warning { + color: #333; +} + +.btn-primary:hover { + background-color: ; + border-color: ; +} + +i.fa.fa-bars { + color: #d1d3e2; +} + +i.fa.fa-bars:hover{ + color: #6e707e; +} + +.info-item { + width: 10rem; + float: left; +} + +.info-item-xs { + font-size: 0.7rem; + margin-left: 0.3rem; +} + +.info-item-wifi { + width: 6rem; + float: left; +} + +.webconsole { + width:100%; + height:100%; + border:1px solid; +} + +#console { + height:500px; +} + +.systemtabcontent { + height:100%; + min-height:500px; +} + +.service-status { + border-width: 0; +} + +.service-status-up { + color: #a1ec38; +} + +.service-status-warn { + color: #f6f044; +} + +.service-status-down { + color: #f80107; + animation: flash 1s linear infinite; +} +@keyframes flash { + 50% { + opacity: 0; + } +} + +.logoutput { + width:100%; + height: 20rem; + border: 1px solid #d1d3e2; + border-radius: .35rem; +} + +pre.unstyled { + border-width: 0; + background-color: transparent; + padding: 0; +} + +.dhcp-static-leases { + margin-top: 1em; + margin-bottom: 1em; +} + +.dhcp-static-lease-row { + margin-top: 0.5em; + margin-bottom: 0.5em; +} + +.loading-spinner { + background: url("../../app/img/loading-spinner.gif") no-repeat scroll center center transparent; + min-height: 150px; + width: 100%; +} + +.js-reload-wifi-stations { + min-width: 10rem; +} + +.sidebar.toggled .nav-item .nav-link span { + display: none; +} .sidebar .nav-item .nav-link i, +.sidebar .nav-item .nav-link span { + font-size: 1.0rem; +} + +.btn-warning:hover { + color: #000; +} + +.toggle-off.btn { + padding-left: 1.2rem; + font-size: 0.9rem!important; +} + +.toggle-on.btn { + font-size: 0.9rem!important; +} + +canvas#divDBChartBandwidthhourly { + height: 350px!important; +} + +.chart-container { + height: 150px; + width: 200px; +} + +.table { + margin-bottom: 0rem; +} + +.check-hidden { + visibility: hidden; +} + +.check-updated { + opacity: 0; + color: #90ee90; +} + +.check-progress { + color: #999; +} + +.fa-check { + color: #90ee90; +} + +.fa-times { + color: #ff4500; +} + From 77d59c9788c518058a54518d977a62d9bc26d392 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 16:46:51 +0100 Subject: [PATCH 083/128] Initial commit --- app/js/huebee.js | 23 +++++++++++++++++++++++ app/lib/color.php | 21 +++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 app/js/huebee.js create mode 100644 app/lib/color.php diff --git a/app/js/huebee.js b/app/js/huebee.js new file mode 100644 index 00000000..1aa5f278 --- /dev/null +++ b/app/js/huebee.js @@ -0,0 +1,23 @@ +// Initialize Huebee color picker +var elem = document.querySelector('.color-input'); +var hueb = new Huebee( elem, { + notation: 'hex', + saturations: 2, + customColors: [ '#d8224c', '#dd4814', '#ea0', '#19f', '#333' ], + className: 'light-picker', + hue0: 210 +}); + +// Set custom color if defined +var color = getCookie('color'); +if (color == null || color == '') { + color = '#d8224c'; +} +hueb.setColor(color); + +// Change event +hueb.on( 'change', function( color, hue, sat, lum ) { + setCookie('color',color,90); + console.log(color) +}) + diff --git a/app/lib/color.php b/app/lib/color.php new file mode 100644 index 00000000..3adb2978 --- /dev/null +++ b/app/lib/color.php @@ -0,0 +1,21 @@ + + + + +.card .card-header { + border-color: ; + color: #fff; + background-color: ; +} + +.btn-primary { + color: ; + border-color: ; + background-color: #fff; +} From 3603e099fedc640ff5a5d7b3367d009b9f1d6bfa Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 16:50:21 +0100 Subject: [PATCH 084/128] Update extraFooterScripts --- includes/dashboard.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/dashboard.php b/includes/dashboard.php index ab26c934..60c3aa83 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -200,6 +200,7 @@ function DisplayDashboard(&$extraFooterScripts) ) ); $extraFooterScripts[] = array('src'=>'app/js/dashboardchart.js', 'defer'=>false); + $extraFooterScripts[] = array('src'=>'app/js/linkquality.js', 'defer'=>false); } From 2a1f531ffa32d265f9ee7788938ad086ccdce753 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 16:52:18 +0100 Subject: [PATCH 085/128] Cleanup --- index.php | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/index.php b/index.php index 4345c58b..45abcd92 100755 --- a/index.php +++ b/index.php @@ -45,12 +45,7 @@ require_once 'includes/torproxy.php'; $output = $return = 0; $page = $_GET['page']; -if (!isset($_COOKIE['theme'])) { - $theme = "custom.css"; -} else { - $theme = $_COOKIE['theme']; -} -$theme_url = 'app/css/'.htmlspecialchars($theme, ENT_QUOTES); +$theme_url = getThemeOpt(); if ($_COOKIE['sidebarToggled'] == 'true' ) { $toggleState = "toggled"; @@ -270,7 +265,7 @@ $bridgedEnabled = $arrHostapdConf['BridgedEnable']; SaveTORAndVPNConfig(); break; case "theme_conf": - DisplayThemeConfig(); + DisplayThemeConfig($extraFooterScripts); break; case "data_use": DisplayDataUsage($extraFooterScripts); @@ -321,17 +316,10 @@ $bridgedEnabled = $arrHostapdConf['BridgedEnable']; - - - - - - - Date: Tue, 30 Jun 2020 16:53:52 +0100 Subject: [PATCH 086/128] Create getThemeOpt --- includes/functions.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/includes/functions.php b/includes/functions.php index 55d1d1f7..a4945016 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -417,3 +417,14 @@ function formatDateAgo($datetime, $full = false) if (!$full) $string = array_slice($string, 0, 1); return $string ? implode(', ', $string) . ' ago' : 'just now'; } + +function getThemeOpt() +{ + if (!isset($_COOKIE['theme'])) { + $theme = "custom.php"; + } else { + $theme = $_COOKIE['theme']; + } + return 'app/css/'.htmlspecialchars($theme, ENT_QUOTES); +} + From 2916bd199827fa4aa19dc0ef865e19b75eced5aa Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 16:54:30 +0100 Subject: [PATCH 087/128] Dynamic theme color support --- app/css/custom.css | 245 ------------------------------------------- app/js/custom.js | 3 +- includes/themes.php | 7 +- templates/themes.php | 2 +- 4 files changed, 8 insertions(+), 249 deletions(-) delete mode 100644 app/css/custom.css diff --git a/app/css/custom.css b/app/css/custom.css deleted file mode 100644 index c8e6324d..00000000 --- a/app/css/custom.css +++ /dev/null @@ -1,245 +0,0 @@ -/* -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; -} - -.page-header { - margin: 20px 0 20px; -} - -.navbar-logo { - margin-top: 0.5em; - margin-left: 0.5em; -} - -/* Small devices (portrait phones, up to 576px) */ -@media (max-width: 576px) { - .container-fluid, .card-body, .col-md-6 { padding-left: 0.5rem; padding-right: 0.5rem; } - .card .card-header { padding: .75rem .5rem; font-size: 1.0rem; } - .row { margin-left: 0rem; margin-right: 0rem; } - .col-lg-12 { padding-right: 0.25rem; padding-left: 0.25rem; } - .form-group.col-md-6 { margin-left: -0.5rem; } - .js-wifi-stations { margin-left: -0.5rem; margin-right: -0.5rem; } - h4.mt-3 { margin-left: 0.5rem; } -} - -.sidebar { - background-color: #f8f9fc; -} - -.sidebar-brand-text { - text-transform: none; - color: #212529; - font-size: 2.0rem; - font-weight: 500; - font-family: Helvetica, Arial, sans-serif; -} - -.sidebar .nav-item.active .nav-link { - font-weight: 500; -} - -.card .card-header { - border-color: #d8224c; - background-color: #d8224c; - color: #fff; -} - -.card-footer { - background-color: #f2f1f0; -} - -.nav-item { - font-size: 0.85rem; -} - -.nav-tabs .nav-link.active, -.nav-tabs .nav-link { - font-size: 1.0rem; -} - -.nav-tabs a.nav-link { - color: #6e707e; -} - -a.nav-link.active { - font-weight: bolder; -} - -.sidebar .nav-item .nav-link { - padding: 0.6rem 0.6rem 0.6rem 1.0rem; -} - -.alert-success { - background-color: #d4edda; -} - -.btn-primary { - color: #d8224c; - background-color: #fff; - border-color: #d8224c; -} - -.btn-warning { - color: #333; -} - -.btn-primary:hover { - background-color: #c61931; - border-color: #c61931; -} - -i.fa.fa-bars { - color: #d1d3e2; -} - -i.fa.fa-bars:hover{ - color: #6e707e; -} - -.info-item { - width: 10rem; - float: left; -} - -.info-item-xs { - font-size: 0.7rem; - margin-left: 0.3rem; -} - -.info-item-wifi { - width: 6rem; - float: left; -} - -.webconsole { - width:100%; - height:100%; - border:1px solid; -} - -#console { - height:500px; -} - -.systemtabcontent { - height:100%; - min-height:500px; -} - -.service-status { - border-width: 0; -} - -.service-status-up { - color: #a1ec38; -} - -.service-status-warn { - color: #f6f044; -} - -.service-status-down { - color: #f80107; - animation: flash 1s linear infinite; -} -@keyframes flash { - 50% { - opacity: 0; - } -} - -.logoutput { - width:100%; - height: 20rem; - border: 1px solid #d1d3e2; - border-radius: .35rem; -} - -pre.unstyled { - border-width: 0; - background-color: transparent; - padding: 0; -} - -.dhcp-static-leases { - margin-top: 1em; - margin-bottom: 1em; -} - -.dhcp-static-lease-row { - margin-top: 0.5em; - margin-bottom: 0.5em; -} - -.loading-spinner { - background: url("../../app/img/loading-spinner.gif") no-repeat scroll center center transparent; - min-height: 150px; - width: 100%; -} - -.js-reload-wifi-stations { - min-width: 10rem; -} - -.sidebar.toggled .nav-item .nav-link span { - display: none; -} .sidebar .nav-item .nav-link i, -.sidebar .nav-item .nav-link span { - font-size: 1.0rem; -} - -.btn-warning:hover { - color: #000; -} - -.toggle-off.btn { - padding-left: 1.2rem; - font-size: 0.9rem!important; -} - -.toggle-on.btn { - font-size: 0.9rem!important; -} - -canvas#divDBChartBandwidthhourly { - height: 350px!important; -} - -.chart-container { - height: 150px; - width: 200px; -} - -.table { - margin-bottom: 0rem; -} - -.check-hidden { - visibility: hidden; -} - -.check-updated { - opacity: 0; - color: #90ee90; -} - -.check-progress { - color: #999; -} - -.fa-check { - color: #90ee90; -} - -.fa-times { - color: #ff4500; -} - diff --git a/app/js/custom.js b/app/js/custom.js index 3fe9ef47..0a35d917 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -375,8 +375,9 @@ function getCookie(cname) { return (value != null) ? unescape(value[1]) : null; } +// Define themes var themes = { - "default": "custom.css", + "default": "custom.php", "hackernews" : "hackernews.css", "lightsout" : "lightsout.css", } diff --git a/includes/themes.php b/includes/themes.php index 7dde1824..58afe68a 100755 --- a/includes/themes.php +++ b/includes/themes.php @@ -3,7 +3,7 @@ * * */ -function DisplayThemeConfig() +function DisplayThemeConfig(&$extraFooterScripts) { $themes = [ "default" => "RaspAP (default)", @@ -11,11 +11,14 @@ function DisplayThemeConfig() "lightsout" => "Lights Out" ]; $themeFiles = [ - "default" => "custom.css", + "default" => "custom.php", "hackernews" => "hackernews.css", "lightsout" => "lightsout.css" ]; $selectedTheme = array_search($_COOKIE['theme'], $themeFiles); echo renderTemplate("themes", compact("themes", "selectedTheme")); + + $extraFooterScripts[] = array('src'=>'dist/huebee/huebee.pkgd.min.js', 'defer'=>false); + $extraFooterScripts[] = array('src'=>'app/js/huebee.js', 'defer'=>false); } diff --git a/templates/themes.php b/templates/themes.php index 0e90a6d9..d5629823 100755 --- a/templates/themes.php +++ b/templates/themes.php @@ -17,7 +17,7 @@
- +
From 29be22a8d3ab1c785b1384de1fc24b64691a362b Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 23:35:46 +0100 Subject: [PATCH 088/128] Create dashboard functions --- includes/functions.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/includes/functions.php b/includes/functions.php index a4945016..4d299314 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -428,3 +428,27 @@ function getThemeOpt() return 'app/css/'.htmlspecialchars($theme, ENT_QUOTES); } +function getColorOpt() +{ + if (!isset($_COOKIE['color'])) { + $color = "#d8224c"; + } else { + $color = $_COOKIE['color']; + } + return $color; +} +function getSidebarState() +{ + if ($_COOKIE['sidebarToggled'] == 'true' ) { + return"toggled"; + } +} + +// Returns bridged AP mode status +function getBridgedState() +{ + $arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini'); + // defaults to false + return $arrHostapdConf['BridgedEnable']; +} + From a77bb2720d354d847dc59c8f8e52039f84f8d5a8 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 23:37:08 +0100 Subject: [PATCH 089/128] Dynamic sidebar logo --- index.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/index.php b/index.php index 45abcd92..d7306a62 100755 --- a/index.php +++ b/index.php @@ -46,15 +46,8 @@ $output = $return = 0; $page = $_GET['page']; $theme_url = getThemeOpt(); - -if ($_COOKIE['sidebarToggled'] == 'true' ) { - $toggleState = "toggled"; -} - -// Get Bridged AP mode status -$arrHostapdConf = parse_ini_file('/etc/raspap/hostapd.ini'); -// defaults to false -$bridgedEnabled = $arrHostapdConf['BridgedEnable']; +$toggleState = getSidebarState(); +$bridgedEnabled = getBridgedState(); ?> @@ -116,7 +109,7 @@ $bridgedEnabled = $arrHostapdConf['BridgedEnable'];
Status
From 7c939fdeaf5dc027823f40cc362b7565b930db47 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 23:37:43 +0100 Subject: [PATCH 090/128] Update messages --- locale/en_US/LC_MESSAGES/messages.po | 3 +++ 1 file changed, 3 insertions(+) diff --git a/locale/en_US/LC_MESSAGES/messages.po b/locale/en_US/LC_MESSAGES/messages.po index 1ce53d99..cf6dc3c9 100644 --- a/locale/en_US/LC_MESSAGES/messages.po +++ b/locale/en_US/LC_MESSAGES/messages.po @@ -540,6 +540,9 @@ msgstr "Theme settings" msgid "Select a theme" msgstr "Select a theme" +msgid "Color" +msgstr "Color" + #: includes/data_usage.php msgid "Data usage" msgstr "Data usage" From 4b77a0b1442d499cd9cfc940fa2d7e65b647e32c Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 23:38:02 +0100 Subject: [PATCH 091/128] Renamed svg > php --- app/img/raspAP-logo.svg | 46 ----------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 app/img/raspAP-logo.svg diff --git a/app/img/raspAP-logo.svg b/app/img/raspAP-logo.svg deleted file mode 100644 index 294fd2cb..00000000 --- a/app/img/raspAP-logo.svg +++ /dev/null @@ -1,46 +0,0 @@ - -image/svg+xml \ No newline at end of file From 7b92f56cda28f9e95807a490df16bbdc0554edc2 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 30 Jun 2020 23:38:32 +0100 Subject: [PATCH 092/128] Dynamic svg logo --- app/img/raspAP-logo.php | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 app/img/raspAP-logo.php diff --git a/app/img/raspAP-logo.php b/app/img/raspAP-logo.php new file mode 100644 index 00000000..c23399ab --- /dev/null +++ b/app/img/raspAP-logo.php @@ -0,0 +1,51 @@ + + + +image/svg+xml From ed7ed044753683ebdc0ed782dc893a4d42041da8 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 1 Jul 2020 09:13:38 +0100 Subject: [PATCH 093/128] Create RASPI_BRAND_TEXT --- config/config.php | 1 + includes/defaults.php | 1 + index.php | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/config.php b/config/config.php index bfe464f6..86ad87bf 100755 --- a/config/config.php +++ b/config/config.php @@ -1,5 +1,6 @@ 'RaspAP', 'RASPI_VERSION' => '2.4.1', 'RASPI_CONFIG_NETWORKING' => RASPI_CONFIG.'/networking', 'RASPI_ADMIN_DETAILS' => RASPI_CONFIG.'/raspap.auth', diff --git a/index.php b/index.php index d7306a62..80106b2d 100755 --- a/index.php +++ b/index.php @@ -103,7 +103,7 @@ $bridgedEnabled = getBridgedState(); From ec94706b321877542c44a01bea3059d649cca512 Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 11 Jul 2020 09:04:28 +0100 Subject: [PATCH 107/128] Standardize labels --- templates/hostapd/logging.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/hostapd/logging.php b/templates/hostapd/logging.php index 11229f8b..3c56e69c 100644 --- a/templates/hostapd/logging.php +++ b/templates/hostapd/logging.php @@ -1,6 +1,6 @@
-

+

Date: Tue, 14 Jul 2020 08:15:27 +0100 Subject: [PATCH 108/128] Apply defaults during upgrade. Resolves #629 --- installers/common.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 6b7eeede..61d08ebf 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -302,7 +302,6 @@ function _download_latest_files() { if [ "$upgrade" == 1 ]; then _install_log "Applying existing configuration to ${webroot_dir}/includes" sudo mv /tmp/config.php $webroot_dir/includes || _install_status 1 "Unable to move config.php to ${webroot_dir}/includes" - sudo mv /tmp/defaults.php $webroot_dir/includes || _install_status 1 "Unable to move defaults.php to ${webroot_dir}/includes" fi _install_status 0 @@ -323,7 +322,6 @@ function _check_for_old_configs() { if [ "$upgrade" == 1 ]; then _install_log "Moving existing configuration to /tmp" sudo mv $webroot_dir/includes/config.php /tmp || _install_status 1 "Unable to move config.php to /tmp" - sudo mv $webroot_dir/includes/defaults.php /tmp || _install_status 1 "Unable to move defaults.php to /tmp" else _install_log "Backing up existing configs to ${raspap_dir}/backups" if [ -f /etc/network/interfaces ]; then @@ -359,13 +357,15 @@ function _check_for_old_configs() { # Move configuration file to the correct location function _move_config_file() { - if [ ! -d "$raspap_dir" ]; then - _install_status 1 "'$raspap_dir' directory doesn't exist" - fi + if [ "$upgrade" == 0 ]; then + if [ ! -d "$raspap_dir" ]; then + _install_status 1 "'$raspap_dir' directory doesn't exist" + fi - _install_log "Moving configuration file to $raspap_dir" - sudo cp "$webroot_dir"/raspap.php "$raspap_dir" || _install_status 1 "Unable to move files to '$raspap_dir'" - sudo chown -R $raspap_user:$raspap_user "$raspap_dir" || _install_status 1 "Unable to change file ownership for '$raspap_dir'" + _install_log "Moving configuration file to $raspap_dir" + sudo cp "$webroot_dir"/raspap.php "$raspap_dir" || _install_status 1 "Unable to move files to '$raspap_dir'" + sudo chown -R $raspap_user:$raspap_user "$raspap_dir" || _install_status 1 "Unable to change file ownership for '$raspap_dir'" + fi } # Set up default configuration From 2df8f4fdce02be9b717cf56d1cee92c4dfd3c1e7 Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Fri, 17 Jul 2020 17:18:44 +0200 Subject: [PATCH 109/128] Update PayPal donors --- BACKERS.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BACKERS.md b/BACKERS.md index 0d622236..e8b2c13c 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -18,4 +18,6 @@ Recurring and one-time donors are vital to the continued development of this pro Ray E - "This project is awesome and just works; saved me and my client tons of work. Thank you!" - $20 Erin C - "Just got Raspap up and running, looks very cool, thanks!" -$20 CAD Ralf J - "Thanks for RaspAP including OpenVPN. It was a big help for me." -€15 -Olivier G -€15 EUR +Felipe C - "Thanks for the good work on RaspAP!" -$6 +Webagentur S - "Like what you and RaspAP are doing." -€20 + From fee8717e4dc8acf8b55b58ee0d443584924a6b6b Mon Sep 17 00:00:00 2001 From: billz Date: Fri, 17 Jul 2020 16:21:35 +0100 Subject: [PATCH 110/128] Get version from defaults.php --- BACKERS.md | 2 +- config/config.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/BACKERS.md b/BACKERS.md index e8b2c13c..011d9d98 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -18,6 +18,6 @@ Recurring and one-time donors are vital to the continued development of this pro Ray E - "This project is awesome and just works; saved me and my client tons of work. Thank you!" - $20 Erin C - "Just got Raspap up and running, looks very cool, thanks!" -$20 CAD Ralf J - "Thanks for RaspAP including OpenVPN. It was a big help for me." -€15 -Felipe C - "Thanks for the good work on RaspAP!" -$6 +Felipe C - "Thanks for the good work on RaspAP!" -$6 Webagentur S - "Like what you and RaspAP are doing." -€20 diff --git a/config/config.php b/config/config.php index b4330802..6a28b70e 100755 --- a/config/config.php +++ b/config/config.php @@ -1,7 +1,6 @@ Date: Sat, 18 Jul 2020 11:46:36 +0000 Subject: [PATCH 111/128] Bump lodash from 4.17.15 to 4.17.19 Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] --- yarn.lock | 206 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 186 insertions(+), 20 deletions(-) diff --git a/yarn.lock b/yarn.lock index d0c28296..a96d0fc3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -709,6 +709,11 @@ chownr@^1.1.1: resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw== +chownr@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" + integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== + class-utils@^0.3.5: version "0.3.6" resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" @@ -719,10 +724,10 @@ class-utils@^0.3.5: isobject "^3.0.0" static-extend "^0.1.1" -clean-css@4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.1.tgz#2d411ef76b8569b6d0c84068dabe85b0aa5e5c17" - integrity sha512-4ZxI6dy4lrY6FHzfiy1aEOXgu4LIsW2MhwG0VBKdcoGoH/XLFgaHSdLTGr4O8Be6A8r3MOphEiI8Gc1n0ecf3g== +clean-css@4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.3.tgz#507b5de7d97b48ee53d84adb0160ff6216380f78" + integrity sha512-VcMWDN54ZN/DS+g58HYL5/n4Zrqe8vHJpGA8KdgUXFU4fuP/aHNw8eld9SyEIyabIMJX/0RaY/fplOo5hYLSFA== dependencies: source-map "~0.6.0" @@ -1232,6 +1237,11 @@ engine.io@~3.2.0: engine.io-parser "~2.1.0" ws "~3.3.1" +env-paths@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.0.tgz#cdca557dc009152917d6166e2febe1f039685e43" + integrity sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA== + error-ex@^1.2.0: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" @@ -1290,6 +1300,11 @@ etag@1.8.1, etag@^1.8.1, etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= +ev-emitter@^1.0.1, ev-emitter@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/ev-emitter/-/ev-emitter-1.1.1.tgz#8f18b0ce5c76a5d18017f71c0a795c65b9138f2a" + integrity sha512-ipiDYhdQSCZ4hSbX4rMW+XzNKMD1prg/sTvoVmSLkuQ1MVlwjJQQA+sW8tMYR3BLUr9KjodFV4pvzunvRhd33Q== + eventemitter3@1.x.x: version "1.2.0" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-1.2.0.tgz#1c86991d816ad1e504750e73874224ecf3bec508" @@ -1547,6 +1562,13 @@ fs-minipass@^1.2.5: dependencies: minipass "^2.6.0" +fs-minipass@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb" + integrity sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg== + dependencies: + minipass "^3.0.0" + fs-mkdirp-stream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz#0b7815fc3201c6a69e14db98ce098c16935259eb" @@ -1681,6 +1703,18 @@ glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@~7.1.1: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.1.4: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + global-modules@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-1.0.0.tgz#6d770f0eb523ac78164d72b5e71a8877265cc3ea" @@ -1736,6 +1770,11 @@ graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.2.tgz#6f0952605d0140c1cfdb138ed005775b92d67b02" integrity sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q== +graceful-fs@^4.2.3: + version "4.2.4" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" + integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== + gulp-autoprefixer@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/gulp-autoprefixer/-/gulp-autoprefixer-7.0.1.tgz#3c0dc26afc802d317e7560a7f760a0399049075a" @@ -1748,12 +1787,12 @@ gulp-autoprefixer@^7.0.1: through2 "^3.0.1" vinyl-sourcemaps-apply "^0.2.1" -gulp-clean-css@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/gulp-clean-css/-/gulp-clean-css-4.2.0.tgz#915ec258dc6d3e6a50043f610066d5c2eac4f54e" - integrity sha512-r4zQsSOAK2UYUL/ipkAVCTRg/2CLZ2A+oPVORopBximRksJ6qy3EX1KGrIWT4ZrHxz3Hlobb1yyJtqiut7DNjA== +gulp-clean-css@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/gulp-clean-css/-/gulp-clean-css-4.3.0.tgz#5b1e73f2fca46703eb636014cdd4553cea65146d" + integrity sha512-mGyeT3qqFXTy61j0zOIciS4MkYziF2U594t2Vs9rUnpkEHqfu6aDITMp8xOvZcvdX61Uz3y1mVERRYmjzQF5fg== dependencies: - clean-css "4.2.1" + clean-css "4.2.3" plugin-error "1.0.1" through2 "3.0.1" vinyl-sourcemaps-apply "0.2.1" @@ -1802,10 +1841,10 @@ gulp-plumber@^1.2.1: plugin-error "^0.1.2" through2 "^2.0.3" -gulp-rename@1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/gulp-rename/-/gulp-rename-1.4.0.tgz#de1c718e7c4095ae861f7296ef4f3248648240bd" - integrity sha512-swzbIGb/arEoFK89tPY58vg3Ok1bw+d35PfUNwWqdo7KM4jkmuGA78JiDNqR+JeZFaeeHnRg9N7aihX3YPmsyg== +gulp-rename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/gulp-rename/-/gulp-rename-2.0.0.tgz#9bbc3962b0c0f52fc67cd5eaff6c223ec5b9cf6c" + integrity sha512-97Vba4KBzbYmR5VBs9mWmK+HwIf5mj+/zioxfZhOKeXtx5ZjBk57KFlePf5nxq9QsTtFl0ejnHE3zTC9MHXqyQ== gulp-sass@^4.0.2: version "4.0.2" @@ -1859,7 +1898,7 @@ har-schema@^2.0.0: resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= -har-validator@~5.1.0: +har-validator@~5.1.0, har-validator@~5.1.3: version "5.1.3" resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== @@ -1989,6 +2028,14 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" +huebee@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/huebee/-/huebee-2.1.0.tgz#bd266f66f08250dd4774435d0e8738ce64423766" + integrity sha512-2im03Zw7MosL/h389ZwyMFv71JTglM4XvoahPRApajVthqBDS9Ro00zgTv6VKW5AXwZ83pNMDhCXC4TMluCSlg== + dependencies: + ev-emitter "^1.1.1" + unipointer "^2.3.0" + iconv-lite@0.4.24, iconv-lite@^0.4.4: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -2507,9 +2554,9 @@ lodash.templatesettings@^4.0.0: lodash._reinterpolate "^3.0.0" lodash@^4.0.0, lodash@^4.17.10, lodash@^4.17.11, lodash@~4.17.10: - version "4.17.15" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" - integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + version "4.17.19" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" + integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== loud-rejection@^1.0.0: version "1.6.0" @@ -2673,6 +2720,13 @@ minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: safe-buffer "^5.1.2" yallist "^3.0.0" +minipass@^3.0.0: + version "3.1.3" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.3.tgz#7d42ff1f39635482e15f9cdb53184deebd5815fd" + integrity sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg== + dependencies: + yallist "^4.0.0" + minizlib@^1.2.1: version "1.3.3" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" @@ -2680,6 +2734,14 @@ minizlib@^1.2.1: dependencies: minipass "^2.9.0" +minizlib@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.0.tgz#fd52c645301ef09a63a2c209697c294c6ce02cf3" + integrity sha512-EzTZN/fjSvifSX0SlqUERCN39o6T40AMarPbv0MrarSFtIITCBh7bi+dU8nxGFHuqs9jdIAeoYoKuQAAASsPPA== + dependencies: + minipass "^3.0.0" + yallist "^4.0.0" + mitt@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/mitt/-/mitt-1.1.3.tgz#528c506238a05dce11cd914a741ea2cc332da9b8" @@ -2700,6 +2762,11 @@ mixin-deep@^1.2.0: dependencies: minimist "0.0.8" +mkdirp@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== + moment@^2.10.2: version "2.24.0" resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" @@ -2779,6 +2846,22 @@ node-gyp@^3.8.0: tar "^2.0.0" which "1" +node-gyp@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-7.0.0.tgz#2e88425ce84e9b1a4433958ed55d74c70fffb6be" + integrity sha512-ZW34qA3CJSPKDz2SJBHKRvyNQN0yWO5EGKKksJc+jElu9VA468gwJTyTArC1iOXU7rN3Wtfg/CMt/dBAOFIjvg== + dependencies: + env-paths "^2.2.0" + glob "^7.1.4" + graceful-fs "^4.2.3" + nopt "^4.0.3" + npmlog "^4.1.2" + request "^2.88.2" + rimraf "^2.6.3" + semver "^7.3.2" + tar "^6.0.1" + which "^2.0.2" + node-pre-gyp@^0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz#39ba4bb1439da030295f899e3b520b7785766149" @@ -2840,6 +2923,14 @@ nopt@^4.0.1: abbrev "1" osenv "^0.1.4" +nopt@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.3.tgz#a375cad9d02fd921278d954c2254d5aa57e15e48" + integrity sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg== + dependencies: + abbrev "1" + osenv "^0.1.4" + normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -2887,7 +2978,7 @@ npm-packlist@^1.1.6: ignore-walk "^3.0.1" npm-bundled "^1.0.1" -"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0, npmlog@^4.0.2: +"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0, npmlog@^4.0.2, npmlog@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== @@ -3249,6 +3340,11 @@ psl@^1.1.24: resolved "https://registry.yarnpkg.com/psl/-/psl-1.4.0.tgz#5dd26156cdb69fa1fdb8ab1991667d3f80ced7c2" integrity sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw== +psl@^1.1.28: + version "1.8.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" + integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== + pump@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pump/-/pump-2.0.1.tgz#12399add6e4cf7526d973cbc8b5ce2e2908b3909" @@ -3271,7 +3367,7 @@ punycode@^1.4.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= -punycode@^2.1.0: +punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== @@ -3461,6 +3557,32 @@ request@^2.87.0, request@^2.88.0: tunnel-agent "^0.6.0" uuid "^3.3.2" +request@^2.88.2: + version "2.88.2" + resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" + integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + har-validator "~5.1.3" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + oauth-sign "~0.9.0" + performance-now "^2.1.0" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.5.0" + tunnel-agent "^0.6.0" + uuid "^3.3.2" + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -3521,7 +3643,7 @@ reusify@^1.0.0: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -rimraf@2, rimraf@^2.6.1: +rimraf@2, rimraf@^2.6.1, rimraf@^2.6.3: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== @@ -3614,6 +3736,11 @@ semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^7.3.2: + version "7.3.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" + integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== + semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -4075,6 +4202,18 @@ tar@^4: safe-buffer "^5.1.2" yallist "^3.0.3" +tar@^6.0.1: + version "6.0.2" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.0.2.tgz#5df17813468a6264ff14f766886c622b84ae2f39" + integrity sha512-Glo3jkRtPcvpDlAs/0+hozav78yoXKFr+c4wgw62NNMO3oo4AaJdCo21Uu7lcwr55h39W2XD1LMERc64wtbItg== + dependencies: + chownr "^2.0.0" + fs-minipass "^2.0.0" + minipass "^3.0.0" + minizlib "^2.1.0" + mkdirp "^1.0.3" + yallist "^4.0.0" + tfunk@^3.0.1: version "3.1.0" resolved "https://registry.yarnpkg.com/tfunk/-/tfunk-3.1.0.tgz#38e4414fc64977d87afdaa72facb6d29f82f7b5b" @@ -4176,6 +4315,14 @@ tough-cookie@~2.4.3: psl "^1.1.24" punycode "^1.4.1" +tough-cookie@~2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + trim-newlines@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" @@ -4263,6 +4410,13 @@ union-value@^1.0.0: is-extendable "^0.1.1" set-value "^2.0.1" +unipointer@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/unipointer/-/unipointer-2.3.0.tgz#ba0dc462ce31c2a88e80810e19c3bae0ce47ed9f" + integrity sha512-m85sAoELCZhogI1owtJV3Dva7GxkHk2lI7A0otw3o0OwCuC/Q9gi7ehddigEYIAYbhkqNdri+dU1QQkrcBvirQ== + dependencies: + ev-emitter "^1.0.1" + unique-stream@^2.0.2: version "2.3.1" resolved "https://registry.yarnpkg.com/unique-stream/-/unique-stream-2.3.1.tgz#c65d110e9a4adf9a6c5948b28053d9a8d04cbeac" @@ -4422,6 +4576,13 @@ which@1, which@^1.2.14, which@^1.2.9: dependencies: isexe "^2.0.0" +which@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + wide-align@^1.1.0: version "1.1.3" resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" @@ -4488,6 +4649,11 @@ yallist@^3.0.0, yallist@^3.0.3: resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + yargs-parser@^4.1.0, yargs-parser@^4.2.0: version "4.2.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c" From 5c592ccadcb1f40534f6c23ea9efa5f900ad7ce7 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 21 Jul 2020 22:42:39 +0100 Subject: [PATCH 112/128] Bugfix. Resolves #638 --- installers/common.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 61d08ebf..714cff94 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -357,15 +357,13 @@ function _check_for_old_configs() { # Move configuration file to the correct location function _move_config_file() { - if [ "$upgrade" == 0 ]; then - if [ ! -d "$raspap_dir" ]; then - _install_status 1 "'$raspap_dir' directory doesn't exist" - fi - - _install_log "Moving configuration file to $raspap_dir" - sudo cp "$webroot_dir"/raspap.php "$raspap_dir" || _install_status 1 "Unable to move files to '$raspap_dir'" - sudo chown -R $raspap_user:$raspap_user "$raspap_dir" || _install_status 1 "Unable to change file ownership for '$raspap_dir'" + if [ ! -d "$raspap_dir" ]; then + _install_status 1 "'$raspap_dir' directory doesn't exist" fi + + _install_log "Moving configuration file to $raspap_dir" + sudo cp "$webroot_dir"/raspap.php "$raspap_dir" || _install_status 1 "Unable to move files to '$raspap_dir'" + sudo chown -R $raspap_user:$raspap_user "$raspap_dir" || _install_status 1 "Unable to change file ownership for '$raspap_dir'" } # Set up default configuration From 5c2b42b7fe0e3315c5a859898c3bdc654b60cf1f Mon Sep 17 00:00:00 2001 From: billz Date: Fri, 24 Jul 2020 19:12:43 +0100 Subject: [PATCH 113/128] Update fr_FR locale --- locale/fr_FR/LC_MESSAGES/messages.mo | Bin 14494 -> 16494 bytes locale/fr_FR/LC_MESSAGES/messages.po | 110 ++++++++++++++++++++------- 2 files changed, 83 insertions(+), 27 deletions(-) diff --git a/locale/fr_FR/LC_MESSAGES/messages.mo b/locale/fr_FR/LC_MESSAGES/messages.mo index 86cfe5a596e06fb2579503f27239a1467dc088b0..d515c27ac4de7f21e4a4920822426576f464c9ac 100644 GIT binary patch literal 16494 zcmb7~d7K?pmB$MS8UxA>0)oXT>453(B!rL&A<*egprO0d<|Twt$58!Vb$5~XsvfWE z^+Lo!LBwrD#T6G^fJ8=zLEI6AMjW@nWdPA}XW%p9{4t6%gZi1ze1G@edaqum+vR<7 z`djzbty_0F_uO+&<;O=Yd56dE3FP_6j%Rt^*#~*vo1Uv&&zn5j^I{l5WqltW2A_aO z!KdJ%@L9)r-bwIicrfgR$HFt=@o*4QwHLtSU<8-KtKpIG^^kwwP5jY&?tpskOHlPb z;`ke==MSgy6X9~lKB(tj4)xp~cnG}4<-Z>4{qKfq_s#Hd_(?bd=b+ki6qT!gCqb28 z0rmb>kbm9~f1VA?a2c#Y^?wGczH4Cv-U!vNXVDndcLG#>%U!w$t|Wa9JOWNa)iVp} zqW4;;`rixHk6T>+?NIOkvb+CvNYlNCpx*x^d?x%oJOMuAdA48Ahi8yJ4bn7k6lxqM zpbxKvYVS=@nB7r=+$De$*Y z?K+0RRQpeYOWybtQVkHF`^$D!(Z3aXt4F^DVS$x!uN z1ohtSQ1cZ*t^Zd-wc~22cD@m6zTXAaj`u+y-U9X915oq&DAaR5g=)u>Q0wD&Q13g` zx9j0(sQV{CJ+}g?KfNy9@6s1Rjpr*|I)-Y;Yv2m_I;ei$0oAU1pyuhTQ2CF-)8P|P z`A42=-}^$S_N;+w{|2ab4@150QmFS#LjHL*{;2-9K#k|Sq3XK@>OG%<(wnci^n;E+ zf*QXkq5AhfP~{H&EBpMhP|tTkz5gtz`p<`Y->^$x;#h_%SBI*1FGRJy*ExO^s$cg) zjqBH-`uA<9_3#TQ{d?NwAN@i*9?PNHb(Tw?2LsY0a0|Qxs=xp3xb#J~KPN)XV-Mt? zcP@WaZVc-E8B}}sLh0#sF8?N|{(Trqzi)?Y-~&+odKzlH4mr*0?Fo=3duPFI@KTrF z2Q_}*fa>?7a0&bwls$Xg@&8=@am#H#Pl76cnqxP72I;flg9mxudUylrr7LXz-UHR1 zeNg&*H&j2r1^MUwgg>fpDayuD_l|&?mmaA6i=ozE$)yvhd6|Ywx?}2L1t?=3K6Yxy< zS*Z5?3LXl*ZaY4QL8Vu~WpFLjd(MMemoI_pcK~U+cO}&L-2(NVyP?MKes~!C36x&_ z3ZlB+3wrE&?uT8ZL#T0ov*T^>Jm&vi_zm(8T4nY0TTtzN7^*$LgqpuUKvcy$e6_82 z9aR4=g}l;x6MQE8JXC+~b^Iojemnxz->0D3qsC$)ycJOS7eV#w6317-=aL?W>R;3G zHBfr^7O3Yx>-Yo5Kftx*pF-nwzXYXMP3Xh7L(R`!P~&?KJPJPI(!Ycnr-P|P_fLiz z_jOSH8iq%}OQHH3K_Awk^y97YIq){9a-V`4p9i4y_9>|L9DSA@-_=n4?|0k=_5PPZ zwW|p=F4sei#|&6Og3_PgK#V+=0x>n-2B>;=L$x!8N5fY_ zwd)4B34Q|Vz5fX{U%!PK&y&x#`{sF2@9Bq{pAwWkx(sT3L#X#9Q1#yk)z5uU&)o&} z{`;ZY^IfRteg@T#C*iU1*KjFZy57G3NT_)@6E26FpxPZmRLi>tsvVz#EIIGh)R0zhZ@K4LACR7$KSgAB`BZjIUZ`W_Z!N3KP_fLw>@_ci2W$TyKIkPjmVBkPdu$i>JF z$OjPpZbUSGXCl3bbi0P+zaMg;@mJeFl4rs2v8u&d# zbNhAVKICr@{q9BHhdfgWeu0Jg`=-M6Tix{}yv$vH3EqU9h^$3ULC!?quUtaRzR<2CR~UyBK$G=Z+7>71}{Qb=H5Gy z3Zmchk=v0MBbZXN#vg?GEk~Y%Oe5bwzK?tn(eEY59P%n;FOnfuzn(;Kmij@x z9tI6RNd2yD^)T-0@wW$Qy>Ha7Bw^~uN#>WEjYb$})mcAn*6T@woFtCJau&rCewL_C zkMhGo+3%}V8r1FejU~;@Rpj+iaw_x(F6a1 zr7%T=jj6DqeA|LbEsFhmkfzf~qvAK~l^_dM z*;Ejh3l}_>zpF|sVoI6nO0K$kUHxvA$+ECk&pS@57>pg;wtIaGwYtVJi%t|#%v%;-L zRGA1XK2uyvDirBV`%&tLaWGa5D?R?!q~Twfq*)x)LO+NrOzKK%3jNun+3*`EMcC*< z=iKB>aGdEM-RTb{LB;Ez4C0B<-!U21LX(KYDom1;s{Apji)mQBkxWGurn+@+k~h*o zrvd%dh*9td2RwH*luYE8svy5^O=^DQ8Gq7s zx=8!{N;n=gtC{H`#iLrYreRpKYSr02{@}PT9hvnRi&ZO4m96q&Pn1dcwI)+E7BVbByhm@!rW3zB88m`2Lrisc&9-OJ ztUjmI=Gu-{p#W45seYKVpnMAR4h7lzepEzk;Wpev@$15s+!$Qy{$T995LGh-&k=ySe= zF+#?EjW?@mq$|qk%TzU*acth*&d#&87#;Pu2G#0VP~IcMRkBuPo0(+K6=*41n&(uL zi3wHe3S^VK%qd1RF3t9*0~F4gP3qk^w#n3D3`rxrq8X+b+HqznsHA8FlO)S$)F(mZ z8vaz&$eKabp9mUbjOfPRu}wYJLP}#6t(UqnvwdhKo(t_0zmnEq9=zZWcx!c8wM$!b%ZtXsYBKGIGv#VCH9c|NpKYx(H?%=DO;9;1ix`u( z_1DH?>&3Ph)8pQfH@QO7%Z*vPn0L(9L(&z^Kzq;ew#?KcMmdYHK3nNE4Wr4{#8<33 zb>w4s56rgPOv}F6&8P5~yFVR`N9~n|(PVzStwvMg@~n3u=FR-^OQpd9pM7ksfrTsw z7%y2@(?@gFH_Gi!)mH(RovXgGG%P$~x1zAB5y8)6e}$|&a-xt{rHFooYUKRfk?D zX;ao3*}Lj0e+<(w9aXYPv&UrIo3PGUZryB7d$}t;&LZ;J^6Sma8}93GsZr5U9Co`W z8}1l(kd3x%w(ry%4r>Wp-_Ddq4<~UpiNZS0*VvJe-LGMs$&qln<@9;QghtS85$JDu z(i@4&d(4s;Nqp^O9&8%}{Fr83QC^|l?aWeh3_Zu;P4~1ijZFkQl!avFHwtU*s zWHRmPPricL%l59mN(*f7nyYZwGi}P0XlBN;l%k0k|6>U4t9tlFoNI~$Yjbjyvnic> z>{Y%G+EhOHHZ@JZR@rj%HeBxOOgA{HyY`9!)8<0EY>qKaE@e$+DP!Mlw}XUjMqxKL zMcR$vj%!1E)q16Z4{7&!w)<8$I&UT%kc&5KwV;6p*qz0~FIs$;wcRWT^?4+jKGl`? zHQ?s>IDmz>cj&WEBb-v}7nf2bo3){|a;SF)p&Du?>Q-5YHc+l(xaWEC(#meC9XasRO z9uio{?L#pqHxVYU7G?fuG95O&oz{hyTc%}cyeK!(?J?OI?};_G_`+^u-f7PMo&|fr zG?xbi4pK6W@5hEi6o7@7UsyY#(*@@(bF%YxjrJLfZY}8nhGe}N@O5Vv4au%(YvlGe zuW;QuRU2b_q4m#NopF1%xtA|(f4t?K(jMzjR;aSzQRcb+7(p0pr8yZnbGgE$!x?ND zv5v0kda#>4*KdTml?uB~U!=Z{qt`Cn<*EWn!#bVj&YQw4Uam~JJCiH&{QQ*F%;NHl z32IMRUOc~zr^DWKITp2hu+n`A=UY^0gU>Ej59-Uxp9wcV@N`m5G& zIBWH?p&-q=jV@LLT*AMg^4#0%-a(jZgO7_JmnW&un)(eK<#un~zHE4KcuTumt9w>0 zW7o~F(cL<$Z1A&iChM(NgD5`7s1&Mj?#>-syVtkNx#iT&IVX|Vw!vRN7G=vutIbAG z?bZn+-QdS{lT6QDbB=E>&s`DwoBY+MpR?@J?*2wH&7<9Js9WRPzEf;>;eoAKnhkz0 zM|M_RFL9cn8uo_q?wzIHq5j>&TS}$A3$~PcYv>A&Y1&gymbJo@?DIi`BVr*$ImG$S z#U?9V#46|Zr3x`BP)V#HN;z4|yJBYjuB3^#l%?&UWgKEDwPSKBZW3a^TvEDDbdwEU z@ev|S)j(D*4rkCJPTqlPZwD~3YdA-9SIgqo6Wqqoo$LvjHD|2Xt0VV#YJz3-NJXf# z-WQn803`+5?@dJsW z=}1j1hEPnOtsSR0Q}y&wfie?W;}DNMnA`95DcT9Q&+VV6YViHQ=CG;CdB`htq0eaC z>r;qIXLdrh%tO0B-WH}W(wi!C`$&#d9Skx}#wO3Z-E74z7ks)aadA+0w~K1$ zK4!WzuiDm~18QvDX;qd7K8?et&1T-LxVUKR_5fkDKn`)cv+9S*8<^YAI`YS&IKbR> z6d~plbz^~Q%mBp+kJgzM278F`Tt|+N?X_W=x&1xtWsJIZL!vm9uF1K(u)>@ss$Ghe zqL?X>o$yMdQD%ry8$#KHfe6b;V|mw9f`-{}YO_H!(du=jDViP;Coxf z73XMlw7WB!>#a-iM>kHlV93HHu5@|Lo)Z4-VNCp@$jd^4G8MwmU>K4rWVy!K&wWQ{k2>gyU zM*C|AcnO}-tFo~LuDsQDGu-G*%ahST%WFlc=k}um7!khYFkom>*zgF2k!iLy6S8Jq z;(?44&u2M~v^Tm|(7I!RFR+9avQ`v(@kQQQYaZ9eL1YJWW^yvI$@WxCt#4&wD8M zt`>i>ysX9VE)e1_3|FPAePT0{As4ruWkNUvZO{uTef!2>elVA^UygaQPM;j7b}8#J z8EN{jH2b%A!k*Gt^FIbV$4gylF1El z9u(I0fZHP_uf*BbSipQEYAG;b^p0!hU<`L8_m5~n?t%?tRJ5=8*3`*j4Tt!dg!sS`eY1h0d!ga>i zWqA}^rQ*5MBlm#QckV~cFJ^)X@~2EJ!Rv2*4A4+;D#x=SsBf2d`%8h2TGm~%pA3dV z`!&{h{(%_}6rDx2S|(Xv4X`A+>%S$pFm6p3c2ln;Kh?a@tf;~*qt@-axmST-l|R6< z`mkV}VUCEQ&uL(iV}PE_mC*YBxh}Q7Gju$u1?Ws&XO$fIvPpAd+=A;ht8*xW%cK`a zt>q2nwyWSEbsE%mNqxF&Fok{k-z1YRb|A~i2A~fUn#26dggi&D&lrC`)EPr056pa` z&<9K=>5onSfc2p$*}KIwIjh)~9iem>q?!efV1e6w zJMWf=yBQZtUpb7Pbhr0-?0BrC5+|qp6dE;6v#c;d7laUlXg>O7Izeh zXU@!;&qSSjz5chCdcfJgc$Nz|?r^eOuwG>g9FfUhYF zR+ZPYIY`TLy7jig7Zqofi4yT)#T>udwz)I2iQle8B(*SiI4c-OeXvHrGmQu+pt~(6 zNpE7Wa}h+%RQ}CnSJb^VvR;@X17_olIX>cDWU`EOLubeN$&!sc+Jmr-Wezl{-!!Ow z*ypHkef&I5p{UkS9ycpwaul`k7{v?PF&Qj{?>^9&v$XlYk$KS1*C!lf%84ZF`vJYQ z=6t=(`MNVZ%z3~0KMB6R+q8mx*158Ior={SpTX{}gGFysaior*Dv$HsChpRy-L!tc z_95n@HFgU=U{3jkQd%aXLJl|%*r<)%>C|f<9~Q17w^m;M&?MWs F_y5!pPmllr delta 5106 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 diff --git a/locale/fr_FR/LC_MESSAGES/messages.po b/locale/fr_FR/LC_MESSAGES/messages.po index 7a4f01fa..1aaf0e12 100644 --- a/locale/fr_FR/LC_MESSAGES/messages.po +++ b/locale/fr_FR/LC_MESSAGES/messages.po @@ -1,22 +1,19 @@ -# RaspAP Portable Object file -# Project home: https://github.com/billz/raspap-webgui -# Licensed under the GNU General Public License v3.0 -# This file is distributed under the same license as the RaspAP package -# FIRST AUTHOR billzimmerman@gmail.com, 2017 -# -#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 1.2.1\n" +"Project-Id-Version: raspap\n" "Report-Msgid-Bugs-To: Bill Zimmerman \n" "POT-Creation-Date: 2017-10-19 08:56+0000\n" -"PO-Revision-Date: 2019-10-21 23:15+0000\n" +"PO-Revision-Date: 2020-04-14 08:51\n" "Last-Translator: Bill Zimmerman \n" -"Language-Team: Bastien STEVENOOT\n" +"Language-Team: French\n" "Language: fr_FR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Crowdin-Project: raspap\n" +"X-Crowdin-Language: fr\n" +"X-Crowdin-File: /master/locale/en_US/LC_MESSAGES/messages.po\n" #: index.php msgid "RaspAP Wifi Configuration Portal" @@ -37,6 +34,12 @@ msgstr "Client WiFi" msgid "Hotspot" msgstr "Hotspot" +msgid "Memory Use" +msgstr "" + +msgid "CPU Temp" +msgstr "" + msgid "Networking" msgstr "Réseau" @@ -117,8 +120,8 @@ msgstr "Les paramètres Wifi sont mis à jour mais ne peuvent pas redémarrer (i msgid "Wifi settings failed to be updated" msgstr "Les paramètres Wifi n'ont pas été mis à jour" -msgid "Failed to updated wifi settings" -msgstr "Erreur durant la mise à jour des paramètres Wifi" +msgid "Failed to update wifi settings" +msgstr "échec de la mise a jour des paramètres wifi" msgid "Rescan" msgstr "Actualiser" @@ -178,8 +181,8 @@ msgstr "Paquets transférés" msgid "Transferred Bytes" msgstr "Octets transférés" -msgid "Wireless Information" -msgstr "Informations sans fil" +msgid "Wireless Client" +msgstr "" msgid "Connected To" msgstr "Connecté à" @@ -188,7 +191,7 @@ msgid "AP Mac Address" msgstr "AP Mac Adresse" msgid "Bitrate" -msgstr "Bitrate" +msgstr "Débit binaire" msgid "Signal Level" msgstr "Niveau du signal" @@ -248,6 +251,9 @@ msgstr "Liste des clients" msgid "Interface" msgstr "Interface" +msgid "DNS Server" +msgstr "Serveur DNS" + msgid "Starting IP Address" msgstr "Adresse IP de départ" @@ -290,6 +296,9 @@ msgstr "Arrêtez dnsmasq" msgid "Start dnsmasq" msgstr "Démarrer dnsmasq" +msgid "Dnsmasq configuration updated successfully" +msgstr "Configuration de Dnsmasq mise à jour avec succès" + msgid "dnsmasq already running" msgstr "Dnsmasq est déjà en cours d'exécution" @@ -315,31 +324,31 @@ msgid "Dnsmasq is not running" msgstr "Dnsmasq n'est pas en fonctionnement" msgid "Upstream DNS servers" -msgstr "Upstream DNS servers" +msgstr "Serveurs DNS amont" msgid "Only ever query DNS servers configured below" -msgstr "Only ever query DNS servers configured below" +msgstr "Uniquement les serveurs DNS de requête configurés ci-dessous" msgid "Enable this option if you want RaspAP to send DNS queries to the servers configured below exclusively. By default RaspAP also uses its upstream DHCP server's name servers." -msgstr "Enable this option if you want RaspAP to send DNS queries to the servers configured below exclusively. By default RaspAP also uses its upstream DHCP server's name servers." +msgstr "Activer cette option si tu veux que RaspAP envoie des requêtes DNS aux serveurs configurés ci-dessous exclusivement. Par défaut, RaspAP utilise aussi les serveurs de noms du serveur DHCP amont." msgid "This option adds no-resolv to the dnsmasq configuration." -msgstr "This option adds no-resolv to the dnsmasq configuration." +msgstr "Cette option ajoute no-resolv à la configuration dnsmasq." msgid "Add upstream DNS server" -msgstr "Add upstream DNS server" +msgstr "Ajouter un serveur DNS amont" msgid "Format" msgstr "Format" msgid "Choose a hosted server" -msgstr "Choose a hosted server" +msgstr "Choisissez un serveur hébergé" msgid "Log DHCP requests" -msgstr "Log DHCP requests" +msgstr "Journaliser les requêtes DHCP" msgid "Log DNS queries" -msgstr "Log DNS queries" +msgstr "Journaliser les requêtes DNS" #: includes/hostapd.php msgid "Basic" @@ -423,6 +432,9 @@ msgstr "Sortie de journal" msgid "WiFi client AP mode" msgstr "Mode AP client WiFi" +msgid "Bridged AP mode" +msgstr "Mode AP ponté" + msgid "Hide SSID in broadcast" msgstr "Masquer le SSID en diffusion" @@ -442,9 +454,6 @@ msgstr "Paramètres actuels" msgid "Default Gateway" msgstr "Passerelle par défaut" -msgid "DNS Server" -msgstr "Serveur DNS" - msgid "Alternate DNS Server" msgstr "Serveur DNS alternatif" @@ -603,7 +612,7 @@ msgid "Diffie Hellman parameters" msgstr "Paramètres Diffie Hellman" msgid "KeepAlive" -msgstr "KeepAlive" +msgstr "Maintenir en vie" msgid "Server log" msgstr "Journal du serveur" @@ -657,6 +666,10 @@ msgstr "Essai de démarrage de TOR" msgid "Attempting to stop TOR" msgstr "Essai d'arrêt de TOR" +#: template/dashboard.php +msgid "Bridged AP mode is enabled. For Hostname and IP, see your router's admin page." +msgstr "Le mode AP ponté est activé. Pour le nom d'hôte et l'IP, consultez la page d'administration de votre routeur." + #: common form controls msgid "Save settings" msgstr "Enregistrer les paramètres" @@ -678,3 +691,46 @@ msgstr "vers le haut" msgid "down" msgstr "vers le bas" + +msgid "adblock" +msgstr "AdBlock" + +msgid "Ad Blocking" +msgstr "Blocage de la pub" + +msgid "Start Ad Blocking" +msgstr "Lancer le blocage des publicités" + +msgid "Restart Ad Blocking" +msgstr "Redémarrer le blocage des publicités" + +msgid "Blocklist settings" +msgstr "Paramètres anti-spam" + +msgid "Enable blocklists" +msgstr "Activer les listes noires" + +msgid "Enable this option if you want RaspAP to block DNS requests for ads, tracking and other virtual garbage. Blocklists are gathered from multiple, actively maintained sources and automatically updated, cleaned, optimized and moderated on a daily basis." +msgstr "Activer cette option si tu veux que RaspAP bloque les requêtes DNS pour les publicités, le suivi et d'autres déchets virtuels. Les listes de blocage sont rassemblées à partir de sources multiples, activement maintenues et mises à jour automatiquement, nettoyées, optimisées et modérées quotidiennement." + +msgid "This option adds conf-file and addn-hosts to the dnsmasq configuration." +msgstr "Cette option ajoute conf-file et addn-hosts à la configuration de dnsmasq." + +msgid "Choose a blocklist provider" +msgstr "Choisir un fournisseur de liste noire" + +msgid "Hostnames blocklist last updated" +msgstr "" + +msgid "Domains blocklist last updated" +msgstr "" + +msgid "Update now" +msgstr "Mettre à jour" + +msgid "Statistics" +msgstr "Statistiques" + +msgid "Information provided by adblock" +msgstr "Informations fournies par adblock" + From b69d7f28a35a8c827f465f0634e3a7310319df07 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 29 Jul 2020 08:35:57 +0100 Subject: [PATCH 114/128] Create system subtemplates --- templates/system/advanced.php | 18 +++++++++++++ templates/system/basic.php | 48 +++++++++++++++++++++++++++++++++++ templates/system/console.php | 11 ++++++++ templates/system/language.php | 13 ++++++++++ 4 files changed, 90 insertions(+) create mode 100644 templates/system/advanced.php create mode 100644 templates/system/basic.php create mode 100644 templates/system/console.php create mode 100644 templates/system/language.php diff --git a/templates/system/advanced.php b/templates/system/advanced.php new file mode 100644 index 00000000..bf81af2c --- /dev/null +++ b/templates/system/advanced.php @@ -0,0 +1,18 @@ + +
+

+
+
+ +
+ + + + +
+
+ " /> + " /> +
+ + diff --git a/templates/system/basic.php b/templates/system/basic.php new file mode 100644 index 00000000..49fb2ff3 --- /dev/null +++ b/templates/system/basic.php @@ -0,0 +1,48 @@ + + +
+
+
+

+
+
+
+
+
+
% +
+
+
+
+
% +
+
+
+
+
°C +
+
+ + + + + + + " /> + " /> + + +
+
+
+ diff --git a/templates/system/console.php b/templates/system/console.php new file mode 100644 index 00000000..009af68d --- /dev/null +++ b/templates/system/console.php @@ -0,0 +1,11 @@ + +
+
+
+ + + +
+
+
+ diff --git a/templates/system/language.php b/templates/system/language.php new file mode 100644 index 00000000..a92b7979 --- /dev/null +++ b/templates/system/language.php @@ -0,0 +1,13 @@ + +
+

+
+
+ + +
+
+ " /> + +
+ From 04f62b9f0d2963ac184a79f4a7130847b885cdd0 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 29 Jul 2020 08:37:27 +0100 Subject: [PATCH 115/128] Templatize system --- includes/system.php | 2 +- templates/system.php | 95 +++++--------------------------------------- 2 files changed, 10 insertions(+), 87 deletions(-) diff --git a/includes/system.php b/includes/system.php index 1d885b1e..e8e340f8 100755 --- a/includes/system.php +++ b/includes/system.php @@ -132,5 +132,5 @@ function DisplaySystem() 'vi_VN.UTF-8' => 'Tiếng Việt (Vietnamese)' ); - echo renderTemplate("system", compact("arrLocales", "status", "system", "ServerPort")); + echo renderTemplate("system", compact("arrLocales", "status", "ServerPort")); } diff --git a/templates/system.php b/templates/system.php index 56f21423..902b6953 100755 --- a/templates/system.php +++ b/templates/system.php @@ -1,8 +1,3 @@ -
@@ -18,94 +13,22 @@ include('includes/sysstats.php');
-
-
-
-

-
-
-
-
-
-
% -
-
-
-
-
% -
-
-
-
-
°C -
-
+ +
+ + + + +
+
- - - - - - " /> - " /> - - -
-
-
- -
-

-
-
- - -
-
- " /> - -
- -
-

-
-
- -
- - - - -
-
- " /> - " /> - -
- -
-
-
- - - -
-
-
-
From eeccb19b35e078a33ba68b1be3830e699dec941d Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 29 Jul 2020 15:52:31 +0100 Subject: [PATCH 116/128] WIP: enable bind-addr control --- includes/system.php | 21 ++++++++++++++--- installers/configport.sh | 14 ++++++++--- locale/en_US/LC_MESSAGES/messages.po | 6 +++++ templates/system/advanced.php | 35 +++++++++++++++++----------- 4 files changed, 56 insertions(+), 20 deletions(-) diff --git a/includes/system.php b/includes/system.php index e8e340f8..4919b5ff 100755 --- a/includes/system.php +++ b/includes/system.php @@ -77,7 +77,8 @@ function DisplaySystem() } if (!RASPI_MONITOR_ENABLED) { - if (isset($_POST['SaveServerPort'])) { + if (isset($_POST['SaveServerSettings'])) { + // Save server port if (isset($_POST['serverPort'])) { if (strlen($_POST['serverPort']) > 4 || !is_numeric($_POST['serverPort'])) { $status->addMessage('Invalid value for port number', 'danger'); @@ -89,6 +90,19 @@ function DisplaySystem() } } } + // Save server bind address + if (isset($_POST['serverBind'])) { + if (!filter_var($_POST['serverBind'], FILTER_VALIDATE_IP)) { + $status->addMessage('Invalid value for bind address', 'danger'); + } else { + $serverBind = escapeshellarg($_POST['serverBind']); + //exec("sudo /etc/raspap/lighttpd/configport.sh $serverPort " .RASPI_LIGHTTPD_CONFIG. " ".$_SERVER['SERVER_NAME'], $return); + //foreach ($return as $line) { + // $status->addMessage($line, 'info'); + //} + } + } + } if (isset($_POST['system_reboot'])) { $status->addMessage("System Rebooting Now!", "warning", false); @@ -106,7 +120,8 @@ function DisplaySystem() } exec('cat '. RASPI_LIGHTTPD_CONFIG, $return); $conf = ParseConfig($return); - $ServerPort = $conf['server.port']; + $serverPort = $conf['server.port']; + $serverBind = str_replace('"', '',$conf['server.bind']); // define locales $arrLocales = array( @@ -132,5 +147,5 @@ function DisplaySystem() 'vi_VN.UTF-8' => 'Tiếng Việt (Vietnamese)' ); - echo renderTemplate("system", compact("arrLocales", "status", "ServerPort")); + echo renderTemplate("system", compact("arrLocales", "status", "serverPort", "serverBind")); } diff --git a/installers/configport.sh b/installers/configport.sh index 999726ce..a1350875 100755 --- a/installers/configport.sh +++ b/installers/configport.sh @@ -1,12 +1,20 @@ #!/bin/bash # -# Updates lighttpd server.port and restarts the service +# Updates lighttpd config settings and restarts the service # @author billz # license: GNU General Public License v3.0 +# Exit on error +set -o errexit +# Exit on error inside functions +set -o errtrace +# Turn on traces, disabled by default +#set -o xtrace + server_port=$1 -lighttpd_conf=$2 -host=$3 +server_bind=$2 +lighttpd_conf=$3 +host=$4 restart_service=0 while :; do diff --git a/locale/en_US/LC_MESSAGES/messages.po b/locale/en_US/LC_MESSAGES/messages.po index cf6dc3c9..39a7dd54 100644 --- a/locale/en_US/LC_MESSAGES/messages.po +++ b/locale/en_US/LC_MESSAGES/messages.po @@ -533,6 +533,12 @@ msgstr "System Rebooting Now!" msgid "System Shutting Down Now!" msgstr "System Shutting Down Now!" +msgid "Web server port" +msgstr "Web server port" + +msgid "Web server bind address" +msgstr "Web server bind address" + #: includes/themes.php msgid "Theme settings" msgstr "Theme settings" diff --git a/templates/system/advanced.php b/templates/system/advanced.php index bf81af2c..62303200 100644 --- a/templates/system/advanced.php +++ b/templates/system/advanced.php @@ -1,18 +1,25 @@ -
-

-
-
- -
- - - - +
+

+ + + +
+
+ + +
-
- " /> - " /> -
+
+
+ + +
+
+ " /> + " /> + + +
From dd978e9f869fe88a334a2c2f6ee1ae0ce9579caa Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 29 Jul 2020 17:12:04 +0100 Subject: [PATCH 117/128] Update docblock --- index.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index 1f26516a..be0b4af0 100755 --- a/index.php +++ b/index.php @@ -3,19 +3,24 @@ /** * Raspbian WiFi Configuration Portal (RaspAP) * - * Enables use of simple web interface rather than SSH to control wifi and hostapd on the Raspberry Pi. - * Recommended distribution is Raspbian Buster Lite. Specific instructions to install the supported software are + * Simple AP setup & WiFi management for Debian-based devices. + * Enables use of simple web interface rather than SSH to control WiFi and related services on the Raspberry Pi. + * Recommended distribution is Raspberry Pi OS (32-bit) Lite. Specific instructions to install the supported software are * in the README and original post by @SirLagz. For a quick run through, the packages required for the WebGUI are: * lighttpd (version 1.4.53 installed via apt) - * php-cgi (version 7.3.14-1 installed via apt) + * php-cgi (version 7.3.19-1 installed via apt) * along with their supporting packages, php7.3 will also need to be enabled. * * @author Lawrence Yau * @author Bill Zimmerman * @license GNU General Public License, version 3 (GPL-3.0) * @version 2.5 - * @link https://github.com/billz/raspap-webgui + * @link https://github.com/billz/raspap-webgui/ + * @link https://raspap.com/ * @see http://sirlagz.net/2013/02/08/raspap-webgui/ + * + * You are not obligated to bundle the LICENSE file with your RaspAP projects as long + * as you leave these references intact in the header comments of your source files. */ require 'includes/csrf.php'; From b0ebd7bf00eb9f25be8d6c85f69e2fd959100dc1 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 5 Aug 2020 18:57:42 +0100 Subject: [PATCH 118/128] Add validate serverBind, save settings --- includes/system.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/includes/system.php b/includes/system.php index 4919b5ff..a66ec9e0 100755 --- a/includes/system.php +++ b/includes/system.php @@ -78,32 +78,35 @@ function DisplaySystem() if (!RASPI_MONITOR_ENABLED) { if (isset($_POST['SaveServerSettings'])) { - // Save server port + $good_input = true; + // Validate server port if (isset($_POST['serverPort'])) { if (strlen($_POST['serverPort']) > 4 || !is_numeric($_POST['serverPort'])) { $status->addMessage('Invalid value for port number', 'danger'); + $good_input = false; } else { $serverPort = escapeshellarg($_POST['serverPort']); - exec("sudo /etc/raspap/lighttpd/configport.sh $serverPort " .RASPI_LIGHTTPD_CONFIG. " ".$_SERVER['SERVER_NAME'], $return); - foreach ($return as $line) { - $status->addMessage($line, 'info'); - } - } + } } - // Save server bind address - if (isset($_POST['serverBind'])) { + // Validate server bind address + $serverBind = escapeshellarg(''); + if ($_POST['serverBind'] && $_POST['serverBind'] !== null ) { if (!filter_var($_POST['serverBind'], FILTER_VALIDATE_IP)) { $status->addMessage('Invalid value for bind address', 'danger'); + $good_input = false; } else { $serverBind = escapeshellarg($_POST['serverBind']); - //exec("sudo /etc/raspap/lighttpd/configport.sh $serverPort " .RASPI_LIGHTTPD_CONFIG. " ".$_SERVER['SERVER_NAME'], $return); - //foreach ($return as $line) { - // $status->addMessage($line, 'info'); - //} } } - + // Save settings + if ($good_input) { + exec("sudo /etc/raspap/lighttpd/configport.sh $serverPort $serverBind " .RASPI_LIGHTTPD_CONFIG. " ".$_SERVER['SERVER_NAME'], $return); + foreach ($return as $line) { + $status->addMessage($line, 'info'); + } + } } + if (isset($_POST['system_reboot'])) { $status->addMessage("System Rebooting Now!", "warning", false); $result = shell_exec("sudo /sbin/reboot"); From 08011100cd5329c3dcbb349772f98185069b3154 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 5 Aug 2020 18:58:29 +0100 Subject: [PATCH 119/128] Add/update save server.bind option --- installers/configport.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/installers/configport.sh b/installers/configport.sh index a1350875..27182159 100755 --- a/installers/configport.sh +++ b/installers/configport.sh @@ -33,11 +33,20 @@ if [ "$restart_service" = 1 ]; then echo "Restarting lighttpd in 3 seconds..." sleep 3 systemctl restart lighttpd.service -else - echo "Changing lighttpd server.port to $server_port..." +fi +if [ -n "$server_port" ]; then + echo "Changing lighttpd server.port to $server_port ..." sed -i "s/^\(server\.port *= *\)[0-9]*/\1$server_port/g" "$lighttpd_conf" - echo "RaspAP will now be available at $host:$server_port" echo "Restart lighttpd for new setting to take effect" fi +if [ -n "$server_bind" ]; then + echo "Changing lighttpd server.bind to $server_bind ..." + grep -q 'server.bind' "$lighttpd_conf" && \ + sed -i "s/^\(server\.bind.*= \)\".*\"*/\1\"$server_bind\"/g" "$lighttpd_conf" || \ + printf "server.bind \t\t\t\t = \"$server_bind\"" >> "$lighttpd_conf" + echo "RaspAP will now be available at $server_bind" + echo "Restart lighttpd for new setting to take effect" +fi + From 83ff3198aabb1084e4eff772fb453e38959b86d5 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 5 Aug 2020 23:07:55 +0100 Subject: [PATCH 120/128] Modify return message --- installers/configport.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/installers/configport.sh b/installers/configport.sh index 27182159..ee78080d 100755 --- a/installers/configport.sh +++ b/installers/configport.sh @@ -37,16 +37,18 @@ fi if [ -n "$server_port" ]; then echo "Changing lighttpd server.port to $server_port ..." sed -i "s/^\(server\.port *= *\)[0-9]*/\1$server_port/g" "$lighttpd_conf" - echo "RaspAP will now be available at $host:$server_port" - echo "Restart lighttpd for new setting to take effect" + echo "RaspAP will now be available at port $server_port" + conf_change=1 fi if [ -n "$server_bind" ]; then echo "Changing lighttpd server.bind to $server_bind ..." grep -q 'server.bind' "$lighttpd_conf" && \ sed -i "s/^\(server\.bind.*= \)\".*\"*/\1\"$server_bind\"/g" "$lighttpd_conf" || \ printf "server.bind \t\t\t\t = \"$server_bind\"" >> "$lighttpd_conf" - echo "RaspAP will now be available at $server_bind" - echo "Restart lighttpd for new setting to take effect" + echo "RaspAP will now be available at address $server_bind" + conf_change=1 +fi +if [ "$conf_change" == 1 ]; then + echo "Restart lighttpd for new settings to take effect" fi - From cfd26ae2bd28c03e1c810b503b63c095a14f2947 Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 6 Aug 2020 08:34:14 +0100 Subject: [PATCH 121/128] Add newline --- installers/configport.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installers/configport.sh b/installers/configport.sh index ee78080d..b4f44e33 100755 --- a/installers/configport.sh +++ b/installers/configport.sh @@ -44,7 +44,7 @@ if [ -n "$server_bind" ]; then echo "Changing lighttpd server.bind to $server_bind ..." grep -q 'server.bind' "$lighttpd_conf" && \ sed -i "s/^\(server\.bind.*= \)\".*\"*/\1\"$server_bind\"/g" "$lighttpd_conf" || \ - printf "server.bind \t\t\t\t = \"$server_bind\"" >> "$lighttpd_conf" + printf "server.bind \t\t\t\t = \"$server_bind\"\n" >> "$lighttpd_conf" echo "RaspAP will now be available at address $server_bind" conf_change=1 fi From 7bf29ca6c4665367d00ad3c68f015266b983cd2e Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Wed, 12 Aug 2020 08:27:29 +0200 Subject: [PATCH 122/128] Update BACKERS.md --- BACKERS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BACKERS.md b/BACKERS.md index 011d9d98..929760a8 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -20,4 +20,4 @@ Erin C - "Just got Raspap up and running, looks very cool, thanks!" -$20 CAD Ralf J - "Thanks for RaspAP including OpenVPN. It was a big help for me." -€15 Felipe C - "Thanks for the good work on RaspAP!" -$6 Webagentur S - "Like what you and RaspAP are doing." -€20 - +Matthew B - "Great project, easy to set up." -£15 From c5a747463be664dcbd1f8bf7ee29ca1b2ebe0047 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 12 Aug 2020 07:29:51 +0100 Subject: [PATCH 123/128] Formatting --- BACKERS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BACKERS.md b/BACKERS.md index 929760a8..62820084 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -19,5 +19,5 @@ Ray E - "This project is awesome and just works; saved me and my client tons of Erin C - "Just got Raspap up and running, looks very cool, thanks!" -$20 CAD Ralf J - "Thanks for RaspAP including OpenVPN. It was a big help for me." -€15 Felipe C - "Thanks for the good work on RaspAP!" -$6 -Webagentur S - "Like what you and RaspAP are doing." -€20 +Webagentur S - "Like what you and RaspAP are doing." -€20 Matthew B - "Great project, easy to set up." -£15 From 617f2232cc36a0b89fc3fd2e0091432c2f0ae07d Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Wed, 12 Aug 2020 16:28:18 +0200 Subject: [PATCH 124/128] Update w/ crowdin badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 63ee7815..b9dd39ff 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![](https://i.imgur.com/xeKD93p.png) -[![Release 2.5](https://img.shields.io/badge/Release-2.5-green.svg)](https://github.com/billz/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/billz/raspap-webgui/](https://img.shields.io/travis/com/billz/raspap-webgui/master) [![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.5](https://img.shields.io/badge/Release-2.5-green.svg)](https://github.com/billz/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/billz/raspap-webgui/](https://img.shields.io/travis/com/billz/raspap-webgui/master) [![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 WiFi 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. From 396ea23458a01122e842b9ef863ccf4b1236c2dc Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 17 Aug 2020 15:43:11 +0100 Subject: [PATCH 125/128] Update Italian translation --- locale/it_IT/LC_MESSAGES/messages.mo | Bin 16461 -> 16364 bytes locale/it_IT/LC_MESSAGES/messages.po | 56 +++++++++++++-------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/locale/it_IT/LC_MESSAGES/messages.mo b/locale/it_IT/LC_MESSAGES/messages.mo index dbbf0f92f6b4fc5c6c8e0931a1cee01da0ce9bcd..55e7c9491e2a22298e6d766120b131f5d070068c 100644 GIT binary patch delta 5413 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 RDJ}KR3WN`4b&Pe2=09bik`4d> diff --git a/locale/it_IT/LC_MESSAGES/messages.po b/locale/it_IT/LC_MESSAGES/messages.po index a551362b..92938cac 100644 --- a/locale/it_IT/LC_MESSAGES/messages.po +++ b/locale/it_IT/LC_MESSAGES/messages.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: raspap\n" "Report-Msgid-Bugs-To: Bill Zimmerman \n" "POT-Creation-Date: 2017-10-19 08:56+0000\n" -"PO-Revision-Date: 2020-04-12 10:21\n" +"PO-Revision-Date: 2020-04-14 08:51\n" "Last-Translator: Marco Fantauzzo \n" "Language-Team: Italian\n" "Language: it_IT\n" @@ -112,19 +112,19 @@ msgid "Passphrase" msgstr "Chiave di sicurezza" msgid "Wifi settings updated successfully" -msgstr "Impostazioni WiFi aggiornate con successo" +msgstr "Impostazioni Wifi aggiornate con successo" msgid "Wifi settings updated but cannot restart (cannot execute 'wpa_cli reconfigure')" msgstr "Impostazioni WiFi aggiornate, ma non è stato possibile riavviare (impossibile eseguire 'wpa_cli reconfigure')" msgid "Wifi settings failed to be updated" -msgstr "Non è stato possibile aggiornare le impostazioni WiFi" +msgstr "Non è stato possibile aggiornare le impostazioni Wifi" msgid "Failed to update wifi settings" -msgstr "Impossibile aggiornare le impostazioni WiFi" +msgstr "Impossibile aggiornare le impostazioni Wifi" msgid "Rescan" -msgstr "Riscansiona" +msgstr "Ripeti la scan" msgid "Update" msgstr "Aggiorna" @@ -181,8 +181,8 @@ msgstr "Pacchetti trasmessi" msgid "Transferred Bytes" msgstr "Bytes trasmessi" -msgid "Wireless Information" -msgstr "Informazioni wireless" +msgid "Wireless Client" +msgstr "" msgid "Connected To" msgstr "Connesso a" @@ -206,13 +206,13 @@ msgid "Link Quality" msgstr "Qualità collegamento" msgid "Information provided by ip and iw and from system" -msgstr "Informazioni fornite da ip, iw e dal sistema" +msgstr "Informazioni fornite dall'ip e iw a dal sistema" msgid "No MAC Address Found" msgstr "Indirizzo MAC non trovato" msgid "No IP Address Found" -msgstr "Indirizzo IP non trovato" +msgstr "Indirizzo IP no trovato" msgid "No Subnet Mask Found" msgstr "Subnet mask non trovata" @@ -288,7 +288,7 @@ msgid "Client ID" msgstr "ID client" msgid "Information provided by Dnsmasq" -msgstr "Informazioni fornite da dnsmasq" +msgstr "Informazioni fornite da Dnsmasq" msgid "Stop dnsmasq" msgstr "Ferma dnsmasq" @@ -300,22 +300,22 @@ msgid "Dnsmasq configuration updated successfully" msgstr "Configurazione Dnsmasq aggiornata con successo" msgid "dnsmasq already running" -msgstr "Dnsmasq è già in esecuzione" +msgstr "dnsmasq è già in esecuzione" msgid "Successfully started dnsmasq" -msgstr "Dnsmasq è stato avviato con successo" +msgstr "dnsmasq avviato con successo" msgid "Failed to start dnsmasq" msgstr "Impossibile avviare dnsmasq" msgid "Successfully stopped dnsmasq" -msgstr "Dnsmasq è stato fermato con successo" +msgstr "dnsmasq fermato con successo" msgid "Failed to stop dnsmasq" msgstr "Impossibile fermare dnsmasq" msgid "dnsmasq already stopped" -msgstr "Dnsmasq è già stoppato" +msgstr "dnsmasq è già stoppato" msgid "Dnsmasq is running" msgstr "Dnsmasq è in esecuzione" @@ -406,13 +406,13 @@ msgid "Unknown interface" msgstr "Interfaccia sconosciuta" msgid "Country code must be blank or two characters" -msgstr "Il codice paese deve essere vuoto o di due caratteri" +msgstr "Il codice paese deve essere o vuoto o di due caratteri" msgid "Wifi Hotspot settings saved" -msgstr "Impostazioni hotspot WiFi salvate" +msgstr "Impostazioni hotspot Wifi salvate" msgid "Unable to save wifi hotspot settings" -msgstr "Impossibile salvare le impostazioni dell'hotspot WiFi" +msgstr "Impossibile salvare le impostazioni dell'hotspot Wifi" msgid "Start hotspot" msgstr "Avvia l'hotspot" @@ -436,7 +436,7 @@ msgid "Bridged AP mode" msgstr "Modalità AP Bridged" msgid "Hide SSID in broadcast" -msgstr "Nascondi la trasmissione del SSID" +msgstr "Nascondere la trasmissione del SSID" msgid "Maximum number of clients" msgstr "Numero massimo di client" @@ -461,7 +461,7 @@ msgid "Adapter IP Address Settings" msgstr "Impostazioni dell'indirizzo IP dell'adattatore" msgid "Enable Fallback to Static Option" -msgstr "Abilita il fallback alle Opzioni IP statiche" +msgstr "Abilita l'opzione statica di fallback" msgid "Static IP" msgstr "IP statico" @@ -504,7 +504,7 @@ msgid "Hostname" msgstr "Nome host" msgid "Pi Revision" -msgstr "Modello Pi" +msgstr "Revisione Pi" msgid "Uptime" msgstr "Tempo di attività" @@ -566,10 +566,10 @@ msgid "date" msgstr "data" msgid "Send MB" -msgstr "MB inviati" +msgstr "Invia MB" msgid "Receive MB" -msgstr "MB ricevuti" +msgstr "Ricevi MB" msgid "Information provided by vnstat" msgstr "Informazioni fornite da vnstat" @@ -624,13 +624,13 @@ msgid "Stop OpenVPN" msgstr "Arresta OpenVPN" msgid "Information provided by openvpn" -msgstr "Informazioni fornite da OpenVPN" +msgstr "Informazioni fornite da openvpn" msgid "Attempting to start openvpn" -msgstr "Tentativo di avviare OpenVPN in corso" +msgstr "Tentativo di avviare openvpn in corso" msgid "Attempting to stop openvpn" -msgstr "Tentativo di arrestare OpenVPN in corso" +msgstr "Tentativo di arrestare openvpn in corso" #: includes/torproxy.php msgid "TOR is not running" @@ -658,7 +658,7 @@ msgid "Stop TOR" msgstr "Arresta TOR" msgid "Information provided by tor" -msgstr "Informazioni fornite da TOR" +msgstr "Informazioni fornite da tor" msgid "Attempting to start TOR" msgstr "Tentativo di avviare TOR in corso" @@ -687,10 +687,10 @@ msgid "Remove" msgstr "Rimuovi" msgid "up" -msgstr "attivo" +msgstr "su" msgid "down" -msgstr "disattivo" +msgstr "giù" msgid "adblock" msgstr "AdBlock" From 447dfcfc4edb6a74c33754be4c4cae2e7c578d76 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 17 Aug 2020 17:22:04 +0100 Subject: [PATCH 126/128] Bump version, add publishConfig --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2d0f1236..a7a054bd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "title": "RaspAP WiFi Configuration Portal", "name": "raspap-webgui", - "version": "2.1", + "version": "2.5", "scripts": { "start": "node_modules/.bin/gulp watch" }, @@ -29,6 +29,9 @@ "type": "git", "url": "https://github.com/billz/raspap-webgui.git" }, + "publishConfig": { + "registry": "https://npm.pkg.github.com/" + }, "dependencies": { "browser-sync": "^2.26.7", "del": "^5.1.0", From 267f31785ae601fc12e06787bbc2143ce2bc9c57 Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 22 Aug 2020 11:37:31 +0100 Subject: [PATCH 127/128] Semantic version, update license --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a7a054bd..13f06c66 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "title": "RaspAP WiFi Configuration Portal", "name": "raspap-webgui", - "version": "2.5", + "version": "2.5.0", "scripts": { "start": "node_modules/.bin/gulp watch" }, @@ -20,7 +20,7 @@ "bugs": { "url": "https://github.com/billz/raspap-webgui/issues" }, - "license": "MIT", + "license": "GPL-3.0", "author": "RaspAP Developers", "contributors": [ "Bill Zimmerman (https://github.com/billz)" From 44e9ae75aee88b4e85f9b1d15f85f96c1ba16931 Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 22 Aug 2020 11:41:33 +0100 Subject: [PATCH 128/128] Remove webconsole, fixes RCE via json-rpc. Thanks @lunchb0x --- app/css/custom.php | 15 - app/css/lightsout.css | 10 - includes/adblock.php | 0 includes/internetRoute.php | 0 includes/webconsole.php | 938 ----------------------------------- templates/system.php | 6 - templates/system/console.php | 11 - 7 files changed, 980 deletions(-) mode change 100644 => 100755 includes/adblock.php mode change 100644 => 100755 includes/internetRoute.php delete mode 100755 includes/webconsole.php delete mode 100644 templates/system/console.php diff --git a/app/css/custom.php b/app/css/custom.php index 38415372..f6b18318 100644 --- a/app/css/custom.php +++ b/app/css/custom.php @@ -129,21 +129,6 @@ i.fa.fa-bars:hover{ float: left; } -.webconsole { - width:100%; - height:100%; - border:1px solid; -} - -#console { - height:500px; -} - -.systemtabcontent { - height:100%; - min-height:500px; -} - .service-status { border-width: 0; } diff --git a/app/css/lightsout.css b/app/css/lightsout.css index e70c4fd7..55eb4b54 100644 --- a/app/css/lightsout.css +++ b/app/css/lightsout.css @@ -357,16 +357,6 @@ color: #d2d2d2 !important border-color: #404040; } -.webconsole { - width: 100%; - height: 20rem; - border: 1px solid #404040; -} - -#console { - height: 500px; -} - tspan, rect { fill: #d2d2d2; } diff --git a/includes/adblock.php b/includes/adblock.php old mode 100644 new mode 100755 diff --git a/includes/internetRoute.php b/includes/internetRoute.php old mode 100644 new mode 100755 diff --git a/includes/webconsole.php b/includes/webconsole.php deleted file mode 100755 index 8ea74be2..00000000 --- a/includes/webconsole.php +++ /dev/null @@ -1,938 +0,0 @@ - 'password1', 'user2' => 'password2'); -$ACCOUNTS = array(); - -// Password hash algorithm (password must be hashed) -// Example: $PASSWORD_HASH_ALGORITHM = 'md5'; -// $PASSWORD_HASH_ALGORITHM = 'sha256'; -$PASSWORD_HASH_ALGORITHM = ''; - -// Home directory (multi-user mode supported) -// Example: $HOME_DIRECTORY = '/tmp'; -// $HOME_DIRECTORY = array('user1' => '/home/user1', 'user2' => '/home/user2'); -$HOME_DIRECTORY = ''; - -// Code below is automatically generated from different components -// For more information see: https://github.com/nickola/web-console -// -// Used components: -// - jQuery JavaScript Library: https://github.com/jquery/jquery -// - jQuery Terminal Emulator: https://github.com/jcubic/jquery.terminal -// - jQuery Mouse Wheel Plugin: https://github.com/brandonaaron/jquery-mousewheel -// - PHP JSON-RPC 2.0 Server/Client Implementation: https://github.com/sergeyfast/eazy-jsonrpc -// - Normalize.css: https://github.com/necolas/normalize.css -?> - method - */ - protected $instances = array(); - - /** - * Decoded Json Request - * - * @var object|array - */ - protected $request; - - /** - * Array of Received Calls - * - * @var array - */ - protected $calls = array(); - - /** - * Array of Responses for Calls - * - * @var array - */ - protected $response = array(); - - /** - * Has Calls Flag (not notifications) - * - * @var bool - */ - protected $hasCalls = false; - - /** - * Is Batch Call in using - * - * @var bool - */ - private $isBatchCall = false; - - /** - * Hidden Methods - * - * @var array - */ - protected $hiddenMethods = array( - 'execute', '__construct', 'registerinstance' - ); - - /** - * Content Type - * - * @var string - */ - public $ContentType = 'application/json'; - - /** - * Allow Cross-Domain Requests - * - * @var bool - */ - public $IsXDR = true; - - /** - * Max Batch Calls - * - * @var int - */ - public $MaxBatchCalls = 10; - - /** - * Error Messages - * - * @var array - */ - protected $errorMessages = array( - self::ParseError => 'Parse error', - self::InvalidRequest => 'Invalid Request', - self::MethodNotFound => 'Method not found', - self::InvalidParams => 'Invalid params', - self::InternalError => 'Internal error', - ); - - - /** - * Cached Reflection Methods - * - * @var ReflectionMethod[] - */ - private $reflectionMethods = array(); - - - /** - * Validate Request - * - * @return int error - */ - private function getRequest() - { - $error = null; - - do { - if (array_key_exists('REQUEST_METHOD', $_SERVER) && $_SERVER['REQUEST_METHOD'] != 'POST' ) { - $error = self::InvalidRequest; - break; - }; - - $request = !empty($_GET['rawRequest']) ? $_GET['rawRequest'] : file_get_contents('php://input'); - $this->request = json_decode($request, false); - if ($this->request === null ) { - $error = self::ParseError; - break; - } - - if ($this->request === array() ) { - $error = self::InvalidRequest; - break; - } - - // check for batch call - if (is_array($this->request) ) { - if(count($this->request) > $this->MaxBatchCalls ) { - $error = self::InvalidRequest; - break; - } - - $this->calls = $this->request; - $this->isBatchCall = true; - } else { - $this->calls[] = $this->request; - } - } while ( false ); - - return $error; - } - - - /** - * Get Error Response - * - * @param int $code - * @param mixed $id - * @param null $data - * @return array - */ - private function getError( $code, $id = null, $data = null ) - { - return array( - 'jsonrpc' => '2.0', - 'id' => $id, - 'error' => array( - 'code' => $code, - 'message' => isset($this->errorMessages[$code]) ? $this->errorMessages[$code] : $this->errorMessages[self::InternalError], - 'data' => $data, - ), - ); - } - - - /** - * Check for jsonrpc version and correct method - * - * @param object $call - * @return array|null - */ - private function validateCall( $call ) - { - $result = null; - $error = null; - $data = null; - $id = is_object($call) && property_exists($call, 'id') ? $call->id : null; - do { - if (!is_object($call) ) { - $error = self::InvalidRequest; - break; - } - - // hack for inputEx smd tester - if (property_exists($call, 'version') ) { - if ($call->version == 'json-rpc-2.0' ) { - $call->jsonrpc = '2.0'; - } - } - - if (!property_exists($call, 'jsonrpc') || $call->jsonrpc != '2.0' ) { - $error = self::InvalidRequest; - break; - } - - $fullMethod = property_exists($call, 'method') ? $call->method : ''; - $methodInfo = explode('.', $fullMethod, 2); - $namespace = array_key_exists(1, $methodInfo) ? $methodInfo[0] : ''; - $method = $namespace ? $methodInfo[1] : $fullMethod; - if (!$method || !array_key_exists($namespace, $this->instances) || !method_exists($this->instances[$namespace], $method) || in_array(strtolower($method), $this->hiddenMethods) ) { - $error = self::MethodNotFound; - break; - } - - if (!array_key_exists($fullMethod, $this->reflectionMethods) ) { - $this->reflectionMethods[$fullMethod] = new ReflectionMethod($this->instances[$namespace], $method); - } - - /** - * @var $params array -*/ - $params = property_exists($call, 'params') ? $call->params : null; - $paramsType = gettype($params); - if ($params !== null && $paramsType != 'array' && $paramsType != 'object' ) { - $error = self::InvalidParams; - break; - } - - // check parameters - switch ( $paramsType ) { - case 'array': - $totalRequired = 0; - // doesn't hold required, null, required sequence of params - foreach ( $this->reflectionMethods[$fullMethod]->getParameters() as $param ) { - if (!$param->isDefaultValueAvailable() ) { - $totalRequired++; - } - } - - if (count($params) < $totalRequired ) { - $error = self::InvalidParams; - $data = sprintf('Check numbers of required params (got %d, expected %d)', count($params), $totalRequired); - } - break; - case 'object': - foreach ( $this->reflectionMethods[$fullMethod]->getParameters() as $param ) { - if (!$param->isDefaultValueAvailable() && !array_key_exists($param->getName(), $params) ) { - $error = self::InvalidParams; - $data = $param->getName() . ' not found'; - - break 3; - } - } - break; - case 'NULL': - if ($this->reflectionMethods[$fullMethod]->getNumberOfRequiredParameters() > 0 ) { - $error = self::InvalidParams; - $data = 'Empty required params'; - break 2; - } - break; - } - - } while ( false ); - - if ($error ) { - $result = array( $error, $id, $data ); - } - - return $result; - } - - - /** - * Process Call - * - * @param $call - * @return array|null - */ - private function processCall( $call ) - { - $id = property_exists($call, 'id') ? $call->id : null; - $params = property_exists($call, 'params') ? $call->params : array(); - $result = null; - $namespace = substr($call->method, 0, strpos($call->method, '.')); - - try { - // set named parameters - if (is_object($params) ) { - $newParams = array(); - foreach ( $this->reflectionMethods[$call->method]->getParameters() as $param ) { - $paramName = $param->getName(); - $defaultValue = $param->isDefaultValueAvailable() ? $param->getDefaultValue() : null; - $newParams[] = property_exists($params, $paramName) ? $params->$paramName : $defaultValue; - } - - $params = $newParams; - } - - // invoke - $result = $this->reflectionMethods[$call->method]->invokeArgs($this->instances[$namespace], $params); - } catch ( Exception $e ) { - return $this->getError($e->getCode(), $id, $e->getMessage()); - } - - if (!$id && $id !== 0 ) { - return null; - } - - return array( - 'jsonrpc' => '2.0', - 'result' => $result, - 'id' => $id, - ); - } - - - /** - * Create new Instance - * - * @param object $instance - */ - public function __construct( $instance = null ) - { - if (get_parent_class($this) ) { - $this->RegisterInstance($this, ''); - } else if ($instance ) { - $this->RegisterInstance($instance, ''); - } - } - - - /** - * Register Instance - * - * @param object $instance - * @param string $namespace default is empty string - * @return $this - */ - public function RegisterInstance( $instance, $namespace = '' ) - { - $this->instances[$namespace] = $instance; - $this->instances[$namespace]->errorMessages = $this->errorMessages; - - return $this; - } - - - /** - * Handle Requests - */ - public function Execute() - { - do { - // check for SMD Discovery request - if (array_key_exists('smd', $_GET) ) { - $this->response[] = $this->getServiceMap(); - $this->hasCalls = true; - break; - } - - $error = $this->getRequest(); - if ($error ) { - $this->response[] = $this->getError($error); - $this->hasCalls = true; - break; - } - - foreach ( $this->calls as $call ) { - $error = $this->validateCall($call); - if ($error ) { - $this->response[] = $this->getError($error[0], $error[1], $error[2]); - $this->hasCalls = true; - } else { - $result = $this->processCall($call); - if ($result ) { - $this->response[] = $result; - $this->hasCalls = true; - } - } - } - } while ( false ); - - // flush response - if ($this->hasCalls ) { - if (!$this->isBatchCall ) { - $this->response = reset($this->response); - } - - if (!headers_sent() ) { - // Set Content Type - if ($this->ContentType ) { - header('Content-Type: ' . $this->ContentType); - } - - // Allow Cross Domain Requests - if ($this->IsXDR ) { - header('Access-Control-Allow-Origin: *'); - header('Access-Control-Allow-Headers: x-requested-with, content-type'); - } - } - - echo json_encode($this->response); - $this->resetVars(); - } - } - - - /** - * Get Doc Comment - * - * @param $comment - * @return string|null - */ - private function getDocDescription( $comment ) - { - $result = null; - if (preg_match('/\*\s+([^@]*)\s+/s', $comment, $matches) ) { - $result = str_replace('*', "\n", trim(trim($matches[1], '*'))); - } - - return $result; - } - - - /** - * Get Service Map - * Maybe not so good realization of auto-discover via doc blocks - * - * @return array - */ - private function getServiceMap() - { - $result = array( - 'transport' => 'POST', - 'envelope' => 'JSON-RPC-2.0', - 'SMDVersion' => '2.0', - 'contentType' => 'application/json', - 'target' => !empty($_SERVER['REQUEST_URI']) ? substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) : '', - 'services' => array(), - 'description' => '', - ); - - foreach( $this->instances as $namespace => $instance ) { - $rc = new ReflectionClass($instance); - - // Get Class Description - if ($rcDocComment = $this->getDocDescription($rc->getDocComment()) ) { - $result['description'] .= $rcDocComment . PHP_EOL; - } - - foreach ( $rc->getMethods() as $method ) { - /** - * @var ReflectionMethod $method -*/ - if (!$method->isPublic() || in_array(strtolower($method->getName()), $this->hiddenMethods) ) { - continue; - } - - $methodName = ( $namespace ? $namespace . '.' : '' ) . $method->getName(); - $docComment = $method->getDocComment(); - - $result['services'][$methodName] = array( 'parameters' => array() ); - - // set description - if ($rmDocComment = $this->getDocDescription($docComment) ) { - $result['services'][$methodName]['description'] = $rmDocComment; - } - - // @param\s+([^\s]*)\s+([^\s]*)\s*([^\s\*]*) - $parsedParams = array(); - if (preg_match_all('/@param\s+([^\s]*)\s+([^\s]*)\s*([^\n\*]*)/', $docComment, $matches) ) { - foreach ( $matches[2] as $number => $name ) { - $type = $matches[1][$number]; - $desc = $matches[3][$number]; - $name = trim($name, '$'); - - $param = array( 'type' => $type, 'description' => $desc ); - $parsedParams[$name] = array_filter($param); - } - }; - - // process params - foreach ( $method->getParameters() as $parameter ) { - $name = $parameter->getName(); - $param = array( 'name' => $name, 'optional' => $parameter->isDefaultValueAvailable() ); - if (array_key_exists($name, $parsedParams) ) { - $param += $parsedParams[$name]; - } - - if ($param['optional'] ) { - $param['default'] = $parameter->getDefaultValue(); - } - - $result['services'][$methodName]['parameters'][] = $param; - } - - // set return type - if (preg_match('/@return\s+([^\s]+)\s*([^\n\*]+)/', $docComment, $matches) ) { - $returns = array( 'type' => $matches[1], 'description' => trim($matches[2]) ); - $result['services'][$methodName]['returns'] = array_filter($returns); - } - } - } - - return $result; - } - - - /** - * Reset Local Class Vars after Execute - */ - private function resetVars() - { - $this->response = $this->calls = array(); - $this->hasCalls = $this->isBatchCall = false; - } - -} -?> -= 1) ? true : false; - -// Utilities -function is_empty_string($string) -{ - return strlen($string) <= 0; -} - -function is_equal_strings($string1, $string2) -{ - return strcmp($string1, $string2) == 0; -} - -function get_hash($algorithm, $string) -{ - return hash($algorithm, trim((string) $string)); -} - -// Command execution -function execute_command($command) -{ - $descriptors = array( - 0 => array('pipe', 'r'), // STDIN - 1 => array('pipe', 'w'), // STDOUT - 2 => array('pipe', 'w') // STDERR - ); - - $process = proc_open($command . ' 2>&1', $descriptors, $pipes); - if (!is_resource($process)) { die("Can't execute command."); - } - - // Nothing to push to STDIN - fclose($pipes[0]); - - $output = stream_get_contents($pipes[1]); - fclose($pipes[1]); - - $error = stream_get_contents($pipes[2]); - fclose($pipes[2]); - - // All pipes must be closed before "proc_close" - $code = proc_close($process); - - return $output; -} - -// Command parsing -function parse_command($command) -{ - $value = ltrim((string) $command); - - if (!is_empty_string($value)) { - $values = explode(' ', $value); - $values_total = count($values); - - if ($values_total > 1) { - $value = $values[$values_total - 1]; - - for ($index = $values_total - 2; $index >= 0; $index--) { - $value_item = $values[$index]; - - if (substr($value_item, -1) == '\\') { $value = $value_item . ' ' . $value; - } else { break; - } - } - } - } - - return $value; -} - -// RPC Server -class WebConsoleRPCServer extends BaseJsonRpcServer -{ - protected $home_directory = ''; - - private function error($message) - { - throw new Exception($message); - } - - // Authentication - private function authenticate_user($user, $password) - { - $user = trim((string) $user); - $password = trim((string) $password); - - if ($user && $password) { - global $ACCOUNTS, $PASSWORD_HASH_ALGORITHM; - - if (isset($ACCOUNTS[$user]) && !is_empty_string($ACCOUNTS[$user])) { - if ($PASSWORD_HASH_ALGORITHM) { $password = get_hash($PASSWORD_HASH_ALGORITHM, $password); - } - - if (is_equal_strings($password, $ACCOUNTS[$user])) { - return $user . ':' . get_hash('sha256', $password); - } - } - } - - throw new Exception("Incorrect user or password"); - } - - private function authenticate_token($token) - { - global $NO_LOGIN; - if ($NO_LOGIN) { return true; - } - - $token = trim((string) $token); - $token_parts = explode(':', $token, 2); - - if (count($token_parts) == 2) { - $user = trim((string) $token_parts[0]); - $password_hash = trim((string) $token_parts[1]); - - if ($user && $password_hash) { - global $ACCOUNTS; - - if (isset($ACCOUNTS[$user]) && !is_empty_string($ACCOUNTS[$user])) { - $real_password_hash = get_hash('sha256', $ACCOUNTS[$user]); - if (is_equal_strings($password_hash, $real_password_hash)) { return $user; - } - } - } - } - - throw new Exception("Incorrect user or password"); - } - - private function get_home_directory($user) - { - global $HOME_DIRECTORY; - - if (is_string($HOME_DIRECTORY)) { - if (!is_empty_string($HOME_DIRECTORY)) { return $HOME_DIRECTORY; - } - } - else if (is_string($user) && !is_empty_string($user) && isset($HOME_DIRECTORY[$user]) && !is_empty_string($HOME_DIRECTORY[$user])) { - return $HOME_DIRECTORY[$user]; - } - - return getcwd(); - } - - // Environment - private function get_environment() - { - $hostname = function_exists('gethostname') ? gethostname() : null; - return array('path' => getcwd(), 'hostname' => $hostname); - } - - private function set_environment($environment) - { - $environment = !empty($environment) ? (array) $environment : array(); - $path = (isset($environment['path']) && !is_empty_string($environment['path'])) ? $environment['path'] : $this->home_directory; - - if (!is_empty_string($path)) { - if (is_dir($path)) { - if (!@chdir($path)) { return array('output' => "Unable to change directory to current working directory, updating current directory", - 'environment' => $this->get_environment()); - } - } - else { return array('output' => "Current working directory not found, updating current directory", - 'environment' => $this->get_environment()); - } - } - } - - // Initialization - private function initialize($token, $environment) - { - $user = $this->authenticate_token($token); - $this->home_directory = $this->get_home_directory($user); - $result = $this->set_environment($environment); - - if ($result) { return $result; - } - } - - // Methods - public function login($user, $password) - { - $result = array('token' => $this->authenticate_user($user, $password), - 'environment' => $this->get_environment()); - - $home_directory = $this->get_home_directory($user); - if (!is_empty_string($home_directory)) { - if (is_dir($home_directory)) { $result['environment']['path'] = $home_directory; - } else { $result['output'] = "Home directory not found: ". $home_directory; - } - } - - return $result; - } - - public function cd($token, $environment, $path) - { - $result = $this->initialize($token, $environment); - if ($result) { return $result; - } - - $path = trim((string) $path); - if (is_empty_string($path)) { $path = $this->home_directory; - } - - if (!is_empty_string($path)) { - if (is_dir($path)) { - if (!@chdir($path)) { return array('output' => "cd: ". $path . ": Unable to change directory"); - } - } - else { return array('output' => "cd: ". $path . ": No such directory"); - } - } - - return array('environment' => $this->get_environment()); - } - - public function completion($token, $environment, $pattern, $command) - { - $result = $this->initialize($token, $environment); - if ($result) { return $result; - } - - $scan_path = ''; - $completion_prefix = ''; - $completion = array(); - - if (!empty($pattern)) { - if (!is_dir($pattern)) { - $pattern = dirname($pattern); - if ($pattern == '.') { $pattern = ''; - } - } - - if (!empty($pattern)) { - if (is_dir($pattern)) { - $scan_path = $completion_prefix = $pattern; - if (substr($completion_prefix, -1) != '/') { $completion_prefix .= '/'; - } - } - } - else { $scan_path = getcwd(); - } - } - else { $scan_path = getcwd(); - } - - if (!empty($scan_path)) { - // Loading directory listing - $completion = array_values(array_diff(scandir($scan_path), array('..', '.'))); - natsort($completion); - - // Prefix - if (!empty($completion_prefix) && !empty($completion)) { - foreach ($completion as &$value) { $value = $completion_prefix . $value; - } - } - - // Pattern - if (!empty($pattern) && !empty($completion)) { - // For PHP version that does not support anonymous functions (available since PHP 5.3.0) - function filter_pattern($value) - { - global $pattern; - return !strncmp($pattern, $value, strlen($pattern)); - } - - $completion = array_values(array_filter($completion, 'filter_pattern')); - } - } - - return array('completion' => $completion); - } - - public function run($token, $environment, $command) - { - $result = $this->initialize($token, $environment); - if ($result) { return $result; - } - - $output = ($command && !is_empty_string($command)) ? execute_command($command) : ''; - if ($output && substr($output, -1) == "\n") { $output = substr($output, 0, -1); - } - - return array('output' => $output); - } -} - -// Processing request -if (array_key_exists('REQUEST_METHOD', $_SERVER) && $_SERVER['REQUEST_METHOD'] == 'POST') { - $rpc_server = new WebConsoleRPCServer(); - $rpc_server->Execute(); -} -else if (!$IS_CONFIGURED) { - ?> - - - - - - Web Console - - - - - - - -
-

Web Console must be configured before use:

-
    -
  • Open Web Console PHP file in your favorite text editor.
  • -
  • At the beginning of the file enter your $USER and $PASSWORD credentials, edit any other settings that you like (see description in the comments).
  • -
  • Upload changed file to the web server and open it in the browser.
  • -
-

For more information visit Web Console website: http://web-console.org

-
- - - - - - - - - Web Console - - - - - - - - - - diff --git a/templates/system.php b/templates/system.php index 902b6953..0e983186 100755 --- a/templates/system.php +++ b/templates/system.php @@ -16,19 +16,13 @@ - - -
-
-
-
diff --git a/templates/system/console.php b/templates/system/console.php deleted file mode 100644 index 009af68d..00000000 --- a/templates/system/console.php +++ /dev/null @@ -1,11 +0,0 @@ - -
-
-
- - - -
-
-
-