mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Merge with upstream master
This commit is contained in:
@@ -54,16 +54,19 @@ $(document).on("click", ".js-add-dhcp-static-lease", function(e) {
|
||||
var container = $(".js-new-dhcp-static-lease");
|
||||
var mac = $("input[name=mac]", container).val().trim();
|
||||
var ip = $("input[name=ip]", container).val().trim();
|
||||
var comment = $("input[name=comment]", container).val().trim();
|
||||
if (mac == "" || ip == "") {
|
||||
return;
|
||||
}
|
||||
var row = $("#js-dhcp-static-lease-row").html()
|
||||
.replace("{{ mac }}", mac)
|
||||
.replace("{{ ip }}", ip);
|
||||
.replace("{{ ip }}", ip)
|
||||
.replace("{{ comment }}", comment);
|
||||
$(".js-dhcp-static-lease-container").append(row);
|
||||
|
||||
$("input[name=mac]", container).val("");
|
||||
$("input[name=ip]", container).val("");
|
||||
$("input[name=comment]", container).val("");
|
||||
});
|
||||
|
||||
$(document).on("click", ".js-remove-dhcp-static-lease", function(e) {
|
||||
|
@@ -1,11 +1,24 @@
|
||||
<?php
|
||||
|
||||
class System {
|
||||
public function hostname() {
|
||||
/**
|
||||
* Sytem info class
|
||||
*
|
||||
* @description System info class for RaspAP
|
||||
* @author Bill Zimmerman <billzimmerman@gmail.com>
|
||||
* @license https://github.com/raspap/raspap-webgui/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace RaspAP\System;
|
||||
|
||||
class Sysinfo
|
||||
{
|
||||
public function hostname()
|
||||
{
|
||||
return shell_exec("hostname -f");
|
||||
}
|
||||
|
||||
public function uptime() {
|
||||
public function uptime()
|
||||
{
|
||||
$uparray = explode(" ", exec("cat /proc/uptime"));
|
||||
$seconds = round($uparray[0], 0);
|
||||
$minutes = $seconds / 60;
|
||||
@@ -15,10 +28,10 @@ class System {
|
||||
$minutes = floor($minutes - ($days * 24 * 60) - ($hours * 60));
|
||||
$uptime= '';
|
||||
if ($days != 0) {
|
||||
$uptime .= $days . ' day' . (($days > 1)? 's ':' ');
|
||||
$uptime .= $days . ' day' . (($days > 1)? 's ':' ');
|
||||
}
|
||||
if ($hours != 0) {
|
||||
$uptime .= $hours . ' hour' . (($hours > 1)? 's ':' ');
|
||||
$uptime .= $hours . ' hour' . (($hours > 1)? 's ':' ');
|
||||
}
|
||||
if ($minutes != 0) {
|
||||
$uptime .= $minutes . ' minute' . (($minutes > 1)? 's ':' ');
|
||||
@@ -27,33 +40,40 @@ class System {
|
||||
return $uptime;
|
||||
}
|
||||
|
||||
public function usedMemory() {
|
||||
public function usedMemory()
|
||||
{
|
||||
$used = shell_exec("free -m | awk '/Mem:/ { total=$2 ; used=$3 } END { print used/total*100}'");
|
||||
return floor($used);
|
||||
}
|
||||
|
||||
public function processorCount() {
|
||||
public function processorCount()
|
||||
{
|
||||
$procs = shell_exec("nproc --all");
|
||||
return intval($procs);
|
||||
}
|
||||
|
||||
public function loadAvg1Min() {
|
||||
public function loadAvg1Min()
|
||||
{
|
||||
$load = exec("awk '{print $1}' /proc/loadavg");
|
||||
return floatval($load);
|
||||
}
|
||||
|
||||
public function systemLoadPercentage() {
|
||||
public function systemLoadPercentage()
|
||||
{
|
||||
return intval(($this->loadAvg1Min() * 100) / $this->processorCount());
|
||||
}
|
||||
|
||||
public function systemTemperature() {
|
||||
public function systemTemperature()
|
||||
{
|
||||
$cpuTemp = file_get_contents("/sys/class/thermal/thermal_zone0/temp");
|
||||
return number_format((float)$cpuTemp/1000, 1);
|
||||
}
|
||||
|
||||
public function hostapdStatus() {
|
||||
public function hostapdStatus()
|
||||
{
|
||||
exec('pidof hostapd | wc -l', $status);
|
||||
return $status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user