From a4818ce6599a6130768a98d62b7ec3f03a6ab1ec Mon Sep 17 00:00:00 2001
From: xmok <30526133+xmok@users.noreply.github.com>
Date: Sat, 21 Jun 2025 19:10:04 +0500
Subject: [PATCH] fix: osIntToIcon gives wrong icons if wrong ID
---
app/Models/Server.php | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/app/Models/Server.php b/app/Models/Server.php
index 26e93e0..16f0460 100644
--- a/app/Models/Server.php
+++ b/app/Models/Server.php
@@ -116,22 +116,29 @@ class Server extends Model
public static function osIntToIcon(int $os, string $os_name): string
{
- if ($os === 1) {//None
+ $name = strtolower(str_replace(' ', '', $os_name));
+ if ($name === "none") {//None
return "";
- } else if ($os <= 3) {//Centos
+ } else if (str_contains($name, "centos")) {//CentOS
return "";
- } elseif (($os > 7 && $os <= 10) || $os === 44) {//Debian
- return "";
- } elseif (($os > 11 && $os < 15) || $os === 43) {//Fedora
+ } elseif (str_contains($name, "debian")) {//Debian
+ return "";
+ } elseif (str_contains($name, "fedora")) {//Fedora
return "";
- } elseif (($os > 14 && $os < 18) || $os === 46) {//FreeBSD
+ } elseif (str_contains($name, "freebsd")) {//FreeBSD
+ return "";
+ } elseif (str_contains($name, "openbsd")) {//OpenBSD
return "";
- } elseif (($os > 17 && $os < 21) || $os === 42) {//OpenBSD
- return "";
- } elseif (($os > 25 && $os < 32) || $os === 41) {//Ubuntu
+ } elseif (str_contains($name, "ubuntu")) {//Ubuntu
return "";
- } elseif (($os > 32 && $os < 38) || $os === 40) {//Windows
+ } elseif (str_contains($name, "windows")) {//Windows
return "";
+ } elseif (str_contains($name, "opensuse")) {//OpenSUSE
+ return "";
+ } elseif (str_contains($name, "redhat")) {//Red Hat
+ return "";
+ } elseif (str_contains($name, "linux")) {//Linux
+ return "";
} else {//OTHER ISO CUSTOM etc
return "";
}