From c235a4ff1674e17079e0e8ef2c9ccf92c18ab251 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 23 Mar 2025 01:21:28 -0700 Subject: [PATCH 1/8] Create zero.php, move under /devices --- app/img/{device.php => devices/default.php} | 2 +- app/img/devices/zero.php | 1561 +++++++++++++++++++ 2 files changed, 1562 insertions(+), 1 deletion(-) rename app/img/{device.php => devices/default.php} (99%) create mode 100644 app/img/devices/zero.php 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 62b342cdbb2c0efe4bb3b81ba0506c5bbea9faaf Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 23 Mar 2025 01:22:26 -0700 Subject: [PATCH 2/8] Set device image w/ getDeviceImage($revision) --- includes/dashboard.php | 2 ++ includes/system.php | 3 +++ 2 files changed, 5 insertions(+) diff --git a/includes/dashboard.php b/includes/dashboard.php index 3e1b3e14..27595423 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -22,6 +22,7 @@ function DisplayDashboard(): 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(): 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", From 645ab894374cbd4831332f271dfa5f8bf639eba4 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 23 Mar 2025 01:22:54 -0700 Subject: [PATCH 3/8] Update w/ getDeviceImage() --- src/RaspAP/UI/Dashboard.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/RaspAP/UI/Dashboard.php b/src/RaspAP/UI/Dashboard.php index a08f6a49..445e604e 100644 --- a/src/RaspAP/UI/Dashboard.php +++ b/src/RaspAP/UI/Dashboard.php @@ -305,6 +305,24 @@ 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'; + return 'zero.php'; + } + /** * Handles dashboard page actions * From 5d33c79369a2acf3d99ac2d830dd95633c82f375 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 23 Mar 2025 01:25:45 -0700 Subject: [PATCH 4/8] Return default if revision type not matched --- src/RaspAP/UI/Dashboard.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/RaspAP/UI/Dashboard.php b/src/RaspAP/UI/Dashboard.php index 445e604e..e28b00bd 100644 --- a/src/RaspAP/UI/Dashboard.php +++ b/src/RaspAP/UI/Dashboard.php @@ -319,8 +319,7 @@ class Dashboard { if (stripos($deviceName, 'compute') !== false) { return 'compute.php'; } - //return 'default.php'; - return 'zero.php'; + return 'default.php'; } /** From 96ada80ce13492902b98c8fb4265d9ceaeebb3c3 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 23 Mar 2025 01:28:51 -0700 Subject: [PATCH 5/8] Update RPi models from latest revision codes --- src/RaspAP/System/Sysinfo.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) 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)', From b99addef4ae0fc3c3d1154a9e43fa0596acb09f1 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 23 Mar 2025 01:30:32 -0700 Subject: [PATCH 6/8] Replace static device illustration w/ $deviceImage --- templates/system/basic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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');

- <?php echo htmlspecialchars($revision, ENT_QUOTES); ?> + <?php echo htmlspecialchars($revision, ENT_QUOTES); ?>
From 2b8f7fd6d801468efee44347870dc8c8aba48be6 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 23 Mar 2025 02:18:50 -0700 Subject: [PATCH 7/8] Initial commit --- app/img/devices/compute.php | 1083 +++++++++++++++++++++++++++++++++++ 1 file changed, 1083 insertions(+) create mode 100644 app/img/devices/compute.php 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 0fd60e37307dfb09c9becb6eb386ff1dabeaed39 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 23 Mar 2025 07:18:55 -0700 Subject: [PATCH 8/8] Update device illustration w/ w/ $deviceImage --- templates/dashboard/status.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/dashboard/status.php b/templates/dashboard/status.php index 5fc77913..e6b354a9 100644 --- a/templates/dashboard/status.php +++ b/templates/dashboard/status.php @@ -25,7 +25,7 @@
- <?php echo htmlspecialchars($revision, ENT_QUOTES); ?> + <?php echo htmlspecialchars($revision, ENT_QUOTES); ?>
:
: