diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..a49d3714 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,10 @@ +## How to contribute + +1. File an issue in the repository, using the bug tracker, describing the + contribution you'd like to make. This will help us to get you started on the + right foot. +2. Fork the project in your account and create a new branch: + `your-great-feature`. +3. Commit your changes in that branch. +4. Open a pull request, and reference the initial issue in the pull request + message. diff --git a/README.md b/README.md index 0c6ed044..56ef18ef 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ ![](http://i.imgur.com/xeKD93p.png) -# `$ raspap-webgui` [![Release 1.2.1](https://img.shields.io/badge/Release-1.2.1-green.svg)](https://github.com/billz/raspap-webgui/releases) -A simple, responsive web interface t:o control wifi, hostapd and related services on the Raspberry Pi. +# `$ raspap-webgui` [![Release 1.3.0](https://img.shields.io/badge/Release-1.3.0-green.svg)](https://github.com/billz/raspap-webgui/releases) +A simple, responsive web interface to control wifi, hostapd and related services on the Raspberry Pi. -This project was inspired by a [**blog post**](http://sirlagz.net/2013/02/06/script-web-configuration-page-for-raspberry-pi/) by SirLagz about using a web page rather than ssh to configure wifi and hostapd settings on the Raspberry Pi. I mostly just prettified the UI by wrapping it in [**SB Admin 2**](https://github.com/BlackrockDigital/startbootstrap-sb-admin-2), a Bootstrap based admin theme. +This project was inspired by a [**blog post**](http://sirlagz.net/2013/02/06/script-web-configuration-page-for-raspberry-pi/) by SirLagz about using a web page rather than ssh to configure wifi and hostapd settings on the Raspberry Pi. I mostly just prettified the UI by wrapping it in [**SB Admin 2**](https://github.com/BlackrockDigital/startbootstrap-sb-admin-2), a Bootstrap based admin theme. Since then, the project has evolved to include greater control over many aspects of a networked RPi, better security, authentication, support for themes and more. We'd be curious to hear about how you use this with your own Pi-powered access points. Ping us on Twitter ([**@billzimmerman**](https://twitter.com/billzimmerman), [**@jrmhaig**](https://twitter.com/jrmhaig) and [**@SirLagz**](https://twitter.com/SirLagz)). Until then, here are some screenshots: -![](https://i.imgur.com/l4Vgd5G.png) -![](https://i.imgur.com/mRPtEnC.png) -![](https://i.imgur.com/FFdKoML.png) +![](https://i.imgur.com/0f27nen.png) +![](https://i.imgur.com/jFDMEy6.png) +![](https://i.imgur.com/ck0XS8P.png) +![](https://i.imgur.com/Vaej8Xv.png) +![](https://i.imgur.com/iNuMMip.png) ## Contents - [Prerequisites](#prerequisites) @@ -78,7 +80,7 @@ www-data ALL=(ALL) NOPASSWD:/sbin/reboot ``` Once those modifications are done, git clone the files to `/var/www/html`. -**Note,** for older versions of Raspbian (before Jessie, May 2016) use +**Note:** for older versions of Raspbian (before Jessie, May 2016) use `/var/www` instead. ```sh sudo rm -rf /var/www/html @@ -124,3 +126,4 @@ Please note that these are only UI's for now. If there's enough interest I'll co ## License See the [LICENSE](./LICENSE) file. + diff --git a/ajax/networking/gen_int_config.php b/ajax/networking/gen_int_config.php new file mode 100644 index 00000000..2cfdd4c5 --- /dev/null +++ b/ajax/networking/gen_int_config.php @@ -0,0 +1,42 @@ +$file) { + if($index != "defaults") { + $cnfFile = parse_ini_file(RASPI_CONFIG_NETWORKING.'/'.$file); + if($cnfFile['static'] === 'true') { + $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"; + } elseif($cnfFile['static'] === 'false' && $cnfFile['failover'] === 'true') { + $strConfFile .= "profile static_".$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\n"; + $strConfFile .= "interface ".$cnfFile['interface']."\n"; + $strConfFile .= "fallback static_".$cnfFile['interface']."\n\n"; + } 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'); + $output = ['return'=>0,'output'=>'Settings successfully applied']; + } else { + $output = ['return'=>2,'output'=>'Unable to write to apply settings']; + } + echo json_encode($output); +} + +?> diff --git a/ajax/networking/get_all_interfaces.php b/ajax/networking/get_all_interfaces.php new file mode 100644 index 00000000..432d0a5d --- /dev/null +++ b/ajax/networking/get_all_interfaces.php @@ -0,0 +1,4 @@ + diff --git a/ajax/networking/get_int_config.php b/ajax/networking/get_int_config.php new file mode 100644 index 00000000..59b3a762 --- /dev/null +++ b/ajax/networking/get_int_config.php @@ -0,0 +1,24 @@ +1,'output'=>['intConfig'=>$intConfig]]; + echo json_encode($jsonData); + + // Todo - get dhcp lease information from `dhcpcd -U eth0` ? maybe ? + +} else { + $jsonData = ['return'=>2,'output'=>['Error getting data']]; + echo json_encode($jsonData); +} + +?> diff --git a/ajax/networking/get_ip_summary.php b/ajax/networking/get_ip_summary.php new file mode 100644 index 00000000..cd42f575 --- /dev/null +++ b/ajax/networking/get_ip_summary.php @@ -0,0 +1,15 @@ +$intResult,'output'=>$intOutput]; + echo json_encode($jsonData); +} else { + $jsonData = ['return'=>2,'output'=>['Error getting data']]; + echo json_encode($jsonData); +} + +?> diff --git a/ajax/networking/save_int_config.php b/ajax/networking/save_int_config.php new file mode 100644 index 00000000..77fcd865 --- /dev/null +++ b/ajax/networking/save_int_config.php @@ -0,0 +1,31 @@ +0,'output'=>['Successfully Updated Network Configuration']]; + } else { + $jsonData = ['return'=>1,'output'=>['Error saving network configuration to file']]; + } + } else { + $jsonData = ['return'=>2,'output'=>'Unable to detect interface']; + } + echo json_encode($jsonData); +?> diff --git a/config/rc.local b/config/rc.local deleted file mode 100755 index 9abe1ac9..00000000 --- a/config/rc.local +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -e -# -# rc.local -# -# This script is executed at the end of each multiuser runlevel. -# Make sure that the script will "exit 0" on success or any other -# value on error. -# -# In order to enable or disable this script just change the execution -# bits. -# -# By default this script does nothing. - -# Print the IP address -_IP=$(hostname -I) || true -if [ "$_IP" ]; then - printf "My IP address is %s\n" "$_IP" -fi - -# Set up IP forwarding and NAT routing -echo 1 > /proc/sys/net/ipv4/ip_forward -iptables -t nat -A POSTROUTING -j MASQUERADE - -exit 0 diff --git a/dist/css/custom.css b/dist/css/custom.css index 4b020f29..17126ae5 100644 --- a/dist/css/custom.css +++ b/dist/css/custom.css @@ -37,6 +37,7 @@ .webconsole { width:100%; height:100%; + border:1px solid; } #console { @@ -47,3 +48,8 @@ height:100%; min-height:500px; } + +.logoutput { + width:100%; + height:300px; +} diff --git a/dist/css/hackernews.css b/dist/css/hackernews.css index d6bb7b4d..19836947 100644 --- a/dist/css/hackernews.css +++ b/dist/css/hackernews.css @@ -76,3 +76,8 @@ h4 { width: 140px; float: left; } + +.logoutput { + width: 100%; + height: 300px; +} diff --git a/dist/css/terminal.css b/dist/css/terminal.css index d7896dd8..ace1fc60 100644 --- a/dist/css/terminal.css +++ b/dist/css/terminal.css @@ -66,7 +66,7 @@ a:focus, a:hover { border-color: #33ff00; } -.panel-primary>.panel-heading { +.panel-primary>.panel-heading, .panel-default>.panel-heading { border-color: #33ff00; background-color: #33ff00; color: #000; @@ -81,6 +81,11 @@ a:focus, a:hover { margin-bottom: 20px; border: 1px solid #33ff00; border-radius: 0px; + background-color: #000; +} + +hr { + border-top: 1px solid #33ff00; } .page-header { @@ -135,6 +140,28 @@ a:focus, a:hover { color: #33ff00; } +label.btn.btn-primary { + color: #33ff00; +} + +label.btn.btn-primary.active, label.btn.btn-warning.active { + background-color: #33ff00; + border-color: #33ff00; + color: #000; +} + +.label-warning { + background-color: #33ff00; +} + +span.label.label-warning { + color: #000; +} + +.btn.btn-primary { + border-color: #33ff00; +} + .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th { background-color: #000; border-top: 1px solid #000; @@ -160,7 +187,7 @@ a:focus, a:hover { border-radius: 0px; } -.alert-success,.alert-warning,.alert-ifo,.alert-dismissable { +.alert-success,.alert-warning,.alert-ifo,.alert-dismissable,.alert-danger { color: #33ff00; background-color: #000; border-color: #33ff00; @@ -182,6 +209,16 @@ a:focus, a:hover { transition: unset; } +input[type="text"]{ + color: #33ff00 !important +} + +.form-control::-webkit-input-placeholder { color: #33ff00; } +.form-control:-moz-placeholder { color: #33ff00; } +.form-control::-moz-placeholder { color: #33ff00; } +.form-control:-ms-input-placeholder { color: #33ff00; } +.form-control::-ms-input-placeholder { color: #33ff00; } + .progress { background-color: #000; border-radius: 0px; @@ -196,4 +233,28 @@ a:focus, a:hover { float: left; } +.logoutput { + width: 100%; + height: 300px; + background-color: #000; + border-color: #33ff00; +} +.webconsole { + width: 100%; + height: 100%; + border-color: #33ff00; + border-bottom: 1px solid; + border-left: 1px solid; + border-top: 0px; + border-right: 1px solid; +} + +#console { + height: 500px; +} + +.systemtabcontent { + height: 100%; + min-height: 500px; +} diff --git a/includes/config.php b/includes/config.php new file mode 100644 index 00000000..58033aa4 --- /dev/null +++ b/includes/config.php @@ -0,0 +1,23 @@ + diff --git a/includes/dhcp.php b/includes/dhcp.php index 465d56e4..8e9b17fb 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -149,11 +149,11 @@ function DisplayDHCPConfig() {