Merge pull request #1 from billz/master

Pull in upstream changes
pull/2/head
necro-nemesis 5 years ago committed by GitHub
commit 45b9846c1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,10 +1,10 @@
### Before submitting an issue
RaspAP is a project currently led by one developer (Billz) in his limited spare time. As a result, I'm not able to respond to every troubleshooting request in a timely manner. If your issue is of a general nature (for example, "Is it possible to do 'x' with my RPi?") and not directly related to a defect with this project, try searching the official [Raspberry Pi forums](https://www.raspberrypi.org/forums/) or [Raspberry Pi on Stack Exchange](https://raspberrypi.stackexchange.com/). Chances are your question has been discussed and answered on one of these forums.
RaspAP is a project currently led by one developer (@billz) in his limited spare time. As a result, I'm not able to respond to every troubleshooting request in a timely manner. If your issue is of a general nature (for example, "Is it possible to do 'x' with my RPi?") and not directly related to a defect with this project, try searching the official Raspberry Pi forums (https://www.raspberrypi.org/forums/) or Raspberry Pi on Stack Exchange (https://raspberrypi.stackexchange.com/). Chances are your question has been discussed and answered before.
In most cases, RaspAP functions very well "out of the box" on fresh installs of the latest Raspbian distribtion (currently Stretch; the Lite version is recommended) on recent hardware like the RPi 3 Model B. Alternate hardware platforms such as the Banana Pi and operating systems other than Raspbian are not supported. If you have installed other software packages on top of RaspAP, particularly those related to networking such as TOR or OpenVPN, please test RaspAP first on a fresh install before reporting an issue.
In most cases, RaspAP functions very well "out of the box" on fresh installs of the latest Raspbian distribution (currently Stretch; the Lite version is recommended) on recent hardware like the RPi 3 Model B. Alternate hardware platforms such as the Banana Pi and operating systems other than Raspbian are not supported. If you have installed other software packages on top of RaspAP, particularly those related to networking such as TOR or OpenVPN, please test RaspAP first on a fresh install before reporting an issue.
The [FAQs](https://github.com/billz/raspap-webgui/wiki/FAQs) have answers to many common issues. Kindly refer to this before creating a new issue.
The FAQs have answers to many common issues. Kindly check this before creating a new issue https://github.com/billz/raspap-webgui/wiki/FAQs
If, after searching these community forums and consulting the FAQ, your issue still persists please provide as much detailed information as possible. Incomplete issue reports will not be considered.
@ -13,15 +13,15 @@ Describe your issue here.
### Your environment
* Raspberry Pi hardware (examples: Pi 3 Model B, Pi 2 Model B, Pi 1 Model B+, Pi Zero)
* Raspbian version (examples: Stretch, Jessie)
* Raspbian version (examples: Stretch Lite, Jessie)
* RaspAP Quick Install or Manual setup?
* Other software or services running with RaspAP?
### Steps to reproduce
Tell us how to reproduce this issue.
### Expected behaviour
### Expected behavior
Tell us what should happen.
### Actual behaviour
### Actual behavior
Tell us what happens instead.

@ -7,7 +7,7 @@ This project was inspired by a [**blog post**](http://sirlagz.net/2013/02/06/scr
We'd be curious to hear about how you use this with your own RPi-powered projects. Until then, here are some screenshots:
![](https://i.imgur.com/5E3SnEW.png)
![](https://i.imgur.com/gPbaM56.png)
![](https://i.imgur.com/jFDMEy6.png)
![](https://i.imgur.com/ck0XS8P.png)
![](https://i.imgur.com/Vaej8Xv.png)
@ -16,11 +16,11 @@ We'd be curious to hear about how you use this with your own RPi-powered project
- [Prerequisites](#prerequisites)
- [Quick installer](#quick-installer)
- [Support us](#support-us)
- [Manual installation](#manual-installation)
- [Multilingual support](#multilingual-support)
- [Optional services](#optional-services)
- [How to contribute](#how-to-contribute)
- [Support us](#support-us)
- [License](#license)
## Prerequisites
@ -54,6 +54,12 @@ configured as an access point as follows:
* SSID: `raspi-webgui`
* Password: ChangeMe
## Support us
RaspAP is free software, but powered by your support. If you find RaspAP useful for your personal projects, please consider making a small donation. We feel strongly about creating high quality, easy-to-use software, as well as the importance of keeping it maintained.
[![Beerpay](https://beerpay.io/billz/raspap-webgui/badge.svg?style=flat)](https://beerpay.io/billz/raspap-webgui)
## Manual installation
These steps apply to the latest release of Raspbian (currently [Stretch](https://www.raspberrypi.org/downloads/raspbian/)). Notes for previously released versions are provided, where applicable. Start off by installing git, lighttpd, php7, hostapd and dnsmasq.
```sh
@ -161,12 +167,6 @@ Please note that these are only UI's for now. If there's enough interest I'll co
4. Open a pull request, and reference the initial issue in the pull request
message.
## Support us
If you find RaspAP useful for your personal or commerical projects, please consider buying the founders a beer!
[![Beerpay](https://beerpay.io/billz/raspap-webgui/badge.svg?style=beer-square)](https://beerpay.io/billz/raspap-webgui)
## License
See the [LICENSE](./LICENSE) file.

@ -26,6 +26,8 @@ if (strlen($interface) > IFNAMSIZ) {
exit('Invalid interface name.');
}
require_once './get_bandwidth_hourly.php';
exec(sprintf('vnstat -i %s --json ', escapeshellarg($interface)), $jsonstdoutvnstat,
$exitcodedaily);
if ($exitcodedaily !== 0) {

@ -0,0 +1,63 @@
<?php
if (filter_input(INPUT_GET, 'tu') == 'h') {
header('X-Content-Type-Options: nosniff');
header('Content-Type: application/json');
$data_template = array(
0 => array('date' => '00:00', 'rx' => 0, 'tx' => 0),
1 => array('date' => '01:00', 'rx' => 0, 'tx' => 0),
2 => array('date' => '02:00', 'rx' => 0, 'tx' => 0),
3 => array('date' => '03:00', 'rx' => 0, 'tx' => 0),
4 => array('date' => '04:00', 'rx' => 0, 'tx' => 0),
5 => array('date' => '05:00', 'rx' => 0, 'tx' => 0),
6 => array('date' => '06:00', 'rx' => 0, 'tx' => 0),
7 => array('date' => '07:00', 'rx' => 0, 'tx' => 0),
8 => array('date' => '08:00', 'rx' => 0, 'tx' => 0),
9 => array('date' => '09:00', 'rx' => 0, 'tx' => 0),
10 => array('date' => '10:00', 'rx' => 0, 'tx' => 0),
11 => array('date' => '11:00', 'rx' => 0, 'tx' => 0),
12 => array('date' => '12:00', 'rx' => 0, 'tx' => 0),
13 => array('date' => '13:00', 'rx' => 0, 'tx' => 0),
14 => array('date' => '14:00', 'rx' => 0, 'tx' => 0),
15 => array('date' => '15:00', 'rx' => 0, 'tx' => 0),
16 => array('date' => '16:00', 'rx' => 0, 'tx' => 0),
17 => array('date' => '17:00', 'rx' => 0, 'tx' => 0),
18 => array('date' => '18:00', 'rx' => 0, 'tx' => 0),
19 => array('date' => '19:00', 'rx' => 0, 'tx' => 0),
20 => array('date' => '20:00', 'rx' => 0, 'tx' => 0),
21 => array('date' => '21:00', 'rx' => 0, 'tx' => 0),
22 => array('date' => '22:00', 'rx' => 0, 'tx' => 0),
23 => array('date' => '23:00', 'rx' => 0, 'tx' => 0)
);
exec(sprintf('vnstat -i %s --json h', escapeshellarg($interface)), $jsonstdoutvnstat, $exitcodedaily);
if ($exitcodedaily !== 0) {
exit('vnstat error');
}
$jsonobj = json_decode($jsonstdoutvnstat[0], true)['interfaces'][0];
$jsonData = $jsonobj['traffic']['hours'];
for ($i = count($jsonData) - 1; $i >= 0; --$i) {
$data_template[$jsonData[$i]['id']]['rx'] = round($jsonData[$i]['rx'] / 1024, 0);
$data_template[$jsonData[$i]['id']]['tx'] = round($jsonData[$i]['tx'] / 1024, 0);
}
$data = array();
$hour = $jsonobj['updated']['time']['hour'];
foreach ($data_template as $key => $value) {
if ($key > $hour) {
array_push($data, $value);
}
}
foreach ($data_template as $key => $value) {
if ($key <= $hour) {
array_push($data, $value);
}
}
echo json_encode($data);
exit(0);
}

@ -5,6 +5,7 @@
*/
function DisplayDataUsage(&$extraFooterScripts)
{
exec("ip -o link show | awk -F ': ' '{print $2}' | grep -v lo ", $interfacesWlo);
?>
<div class="row">
<div class="col-lg-12">
@ -16,27 +17,48 @@ function DisplayDataUsage(&$extraFooterScripts)
<div class="panel panel-default">
<div class="panel-body">
<ul id="tabbarBandwidth" class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#daily" aria-controls="daily" role="tab" data-toggle="tab"><?php echo _("Daily"); ?></a></li>
<li role="presentation" class="active"><a href="#hourly" aria-controls="hourly" role="tab" data-toggle="tab"><?php echo _("Hourly"); ?></a></li>
<li role="presentation" class=""><a href="#daily" aria-controls="daily" role="tab" data-toggle="tab"><?php echo _("Daily"); ?></a></li>
<li role="presentation" class=""><a href="#monthly" aria-controls="monthly" role="tab" data-toggle="tab"><?php echo _("Monthly"); ?></a></li>
</ul>
<div id="tabsBandwidth" class="tabcontenttraffic tab-content">
<div role="tabpanel" class="tab-pane active fade in" id="daily">
<div role="tabpanel" class="tab-pane active fade in" id="hourly">
<div class="row">
<div class="col-lg-12">
<h4><?php echo _('Hourly traffic amount'); ?></h4>
<label for="cbxInterfacehourly"><?php echo _('interface'); ?></label>
<select id="cbxInterfacehourly" class="form-control" name="interfacehourly">
<?php
foreach ($interfacesWlo as $interface) {
echo ' <option value="' , htmlentities($interface, ENT_QUOTES) , '">' ,
htmlentities($interface, ENT_QUOTES) , '</option>' , PHP_EOL;
}
?>
</select>
<div class="hidden alert alert-info" id="divLoaderBandwidthhourly">
<?php echo sprintf(_("Loading %s bandwidth chart"), _('hourly')); ?>
</div>
<div id="divChartBandwidthhourly"></div>
<div id="divTableBandwidthhourly"></div>
</div>
</div>
</div><!-- /.tab-pane -->
<div role="tabpanel" class="tab-pane fade" id="daily">
<div class="row">
<div class="col-lg-12">
<h4><?php echo _('Daily traffic amount'); ?></h4>
<label for="cbxInterfacedaily"><?php echo _('interface'); ?></label>
<select id="cbxInterfacedaily" class="form-control" name="interfacedaily">
<?php
exec("ip -o link show | awk -F ': ' '{print $2}' | grep -v lo ", $interfacesWlo);
foreach ($interfacesWlo as $interface) {
echo ' <option value="' , htmlentities($interface, ENT_QUOTES) , '">' ,
htmlentities($interface, ENT_QUOTES) , '</option>' , PHP_EOL;
}
?>
</select>
<div class="hidden alert alert-info" id="divLoaderBandwidthdaily"><?php
echo sprintf(_("Loading %s bandwidth chart"), _('daily')); ?></div>
<div class="hidden alert alert-info" id="divLoaderBandwidthdaily">
<?php echo sprintf(_("Loading %s bandwidth chart"), _('daily')); ?>
</div>
<div id="divChartBandwidthdaily"></div>
<div id="divTableBandwidthdaily"></div>
</div>
@ -53,7 +75,6 @@ foreach ($interfacesWlo as $interface) {
echo ' <option value="' , htmlentities($interface, ENT_QUOTES) , '">' ,
htmlentities($interface, ENT_QUOTES) , '</option>' , PHP_EOL;
}
?>
</select>
<div class="hidden alert alert-info" id="divLoaderBandwidthmonthly">

@ -272,6 +272,10 @@ function patch_system_files() {
else
install_log "Sudoers file already patched"
fi
# Unmask and enable hostapd.service
sudo systemctl unmask hostapd.service
sudo systemctl enable hostapd.service
}

@ -9,8 +9,8 @@
element: placeholder,
xkey: 'date',
ykeys: ['rx', 'tx'],
labels: [_t['send']+' '+datasizeunits.toUpperCase(),
_t['receive']+' '+datasizeunits.toUpperCase()]
labels: [_t['receive']+' '+datasizeunits.toUpperCase(),
_t['send']+' '+datasizeunits.toUpperCase()]
});
return barchart;
@ -31,9 +31,11 @@
*/
function ShowBandwidthChartHandler(e) {
// Remove all morrisjs charts
$('#divChartBandwidthhourly').empty();
$('#divChartBandwidthdaily').empty();
$('#divChartBandwidthmonthly').empty();
// Remove all datatables
$('#divTableBandwidthhourly').empty();
$('#divTableBandwidthdaily').empty();
$('#divTableBandwidthmonthly').empty();
// Construct ajax uri for getting the proper data.
@ -66,8 +68,8 @@
'order': [[ 0, 'ASC' ]],
'columns': [
{ 'data': 'date' },
{ 'data': 'rx', "title": _t['send']+' '+datasizeunits.toUpperCase() },
{ 'data': 'tx', "title": _t['receive']+' '+datasizeunits.toUpperCase() }]
{ 'data': 'rx', "title": _t['receive']+' '+datasizeunits.toUpperCase() },
{ 'data': 'tx', "title": _t['send']+' '+datasizeunits.toUpperCase() }]
});
}).fail(function(xhr, textStatus) {
if (window.console) {
@ -80,8 +82,8 @@
$(document).ready(function() {
$('#tabbarBandwidth a[data-toggle="tab"]').on('shown.bs.tab', ShowBandwidthChartHandler);
$('#cbxInterfacehourly').on('change', ShowBandwidthChartHandler);
$('#cbxInterfacedaily').on('change', ShowBandwidthChartHandler);
$('#cbxInterfaceweekly').on('change', ShowBandwidthChartHandler);
$('#cbxInterfacemonthly').on('change', ShowBandwidthChartHandler);
ShowBandwidthChartHandler();
});

Loading…
Cancel
Save