diff --git a/app/img/devices/compute.php b/app/img/devices/compute.php new file mode 100644 index 00000000..bf744a3a --- /dev/null +++ b/app/img/devices/compute.php @@ -0,0 +1,1083 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/img/device.php b/app/img/devices/default.php similarity index 99% rename from app/img/device.php rename to app/img/devices/default.php index 193e0130..9311b504 100644 --- a/app/img/device.php +++ b/app/img/devices/default.php @@ -1,6 +1,6 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/includes/dashboard.php b/includes/dashboard.php index c6857b21..099fbb2a 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -22,6 +22,7 @@ function DisplayDashboard(&$extraFooterScripts): void $clientInterface = $_SESSION['wifi_client_interface']; $hostname = $system->hostname(); $revision = $system->rpiRevision(); + $deviceImage = $dashboard->getDeviceImage($revision); $hostapd = $system->hostapdStatus(); $adblock = $system->adBlockStatus(); $vpn = $system->getActiveVpnInterface(); @@ -88,6 +89,7 @@ function DisplayDashboard(&$extraFooterScripts): void echo renderTemplate( "dashboard", compact( "revision", + "deviceImage", "interface", "clientInterface", "state", diff --git a/includes/system.php b/includes/system.php index 6ef6b74e..d37a5450 100755 --- a/includes/system.php +++ b/includes/system.php @@ -9,6 +9,7 @@ require_once 'config.php'; function DisplaySystem(&$extraFooterScripts) { $status = new \RaspAP\Messages\StatusMessage; + $dashboard = new \RaspAP\UI\Dashboard; $pluginInstaller = \RaspAP\Plugins\PluginInstaller::getInstance(); if (isset($_POST['SaveLanguage'])) { @@ -86,6 +87,7 @@ function DisplaySystem(&$extraFooterScripts) $kernel = $system->kernelVersion(); $systime = $system->systime(); $revision = $system->rpiRevision(); + $deviceImage = $dashboard->getDeviceImage($revision); // memory use $memused = $system->usedMemory(); @@ -129,6 +131,7 @@ function DisplaySystem(&$extraFooterScripts) "uptime", "systime", "revision", + "deviceImage", "cores", "os", "kernel", diff --git a/src/RaspAP/System/Sysinfo.php b/src/RaspAP/System/Sysinfo.php index cfb641d3..d8391944 100755 --- a/src/RaspAP/System/Sysinfo.php +++ b/src/RaspAP/System/Sysinfo.php @@ -95,7 +95,7 @@ class Sysinfo /* * Returns RPi Model and PCB Revision from Pi Revision Code (cpuinfo) - * @see http://www.raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board-version/ + * @see https://github.com/raspberrypi/documentation/blob/develop/documentation/asciidoc/computers/raspberry-pi/revision-codes.adoc */ public function rpiRevision() { @@ -113,24 +113,26 @@ class Sysinfo '000f' => 'Raspberry Pi Model B Rev 2.0', '0010' => 'Raspberry Pi Model B+', '0013' => 'Raspberry Pi Model B+', - '0011' => 'Compute Module', + '0011' => 'Compute Module 1', '0012' => 'Raspberry Pi Model A+', - 'a01041' => 'a01041', - 'a21041' => 'a21041', + 'a01041' => 'Raspberry Pi 2 Model B', + 'a21041' => 'Raspberry Pi 2 Model B', '900092' => 'Raspberry Pi Zero 1.2', '900093' => 'Raspberry Pi Zero 1.3', '9000c1' => 'Raspberry Pi Zero W', 'a02082' => 'Raspberry Pi 3 Model B', 'a22082' => 'Raspberry Pi 3 Model B', 'a32082' => 'Raspberry Pi 3 Model B', - 'a52082' => 'Raspberry Pi 3 Model B', - 'a020d3' => 'Raspberry Pi 3 Model B+', - 'a220a0' => 'Compute Module 3', - 'a020a0' => 'Compute Module 3', + 'a52082' => 'Raspberry Pi 3 Model B+', + '9020e0' => 'Raspberry Pi 3 Model A+', 'a02100' => 'Compute Module 3+', - 'a03111' => 'Raspberry Pi 4B Rev 1.1 (1 GB)', - 'b03111' => 'Raspberry Pi 4B Rev 1.1 (2 GB)', - 'c03111' => 'Raspberry Pi 4B Rev 1.1 (4 GB)', + 'a03111' => 'Raspberry Pi 4 Model B (1 GB)', + 'b03111' => 'Raspberry Pi 4 Model B (2 GB)', + 'c03111' => 'Raspberry Pi 4 Model B (4 GB)', + 'b03112' => 'Raspberry Pi 4 Model B (2 GB)', + 'c03112' => 'Raspberry Pi 4 Model B (4 GB)', + 'd03114' => 'Raspberry Pi 4 Model B (8 GB)', + '902120' => 'Raspberry Pi Zero 2 W', 'a03140' => 'Compute Module 4 (1 GB)', 'b03140' => 'Compute Module 4 (2 GB)', 'c03140' => 'Compute Module 4 (4 GB)', diff --git a/src/RaspAP/UI/Dashboard.php b/src/RaspAP/UI/Dashboard.php index a08f6a49..e28b00bd 100644 --- a/src/RaspAP/UI/Dashboard.php +++ b/src/RaspAP/UI/Dashboard.php @@ -305,6 +305,23 @@ class Dashboard { return false; } + /* + * Returns an SVG resource associated with a Pi revision + * + * @param string $deviceName + * @return string + */ + public function getDeviceImage($deviceName): string + { + if (stripos($deviceName, 'zero') !== false) { + return 'zero.php'; + } + if (stripos($deviceName, 'compute') !== false) { + return 'compute.php'; + } + return 'default.php'; + } + /** * Handles dashboard page actions * diff --git a/templates/dashboard/status.php b/templates/dashboard/status.php index 93400643..76701f8f 100644 --- a/templates/dashboard/status.php +++ b/templates/dashboard/status.php @@ -25,7 +25,7 @@ - + : : diff --git a/templates/system/basic.php b/templates/system/basic.php index 35a4509c..4474e3d9 100644 --- a/templates/system/basic.php +++ b/templates/system/basic.php @@ -10,7 +10,7 @@ include('includes/sysstats.php'); - +