From fd926e983de0524ba92725c25ff6c70e8abdd19b Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Sat, 2 Aug 2025 17:17:40 +0100 Subject: [PATCH] Fix for some enhanced apps not working --- app/Http/Controllers/ItemController.php | 27 ++++++++++++++++--------- app/Services/CustomFormBuilder.php | 14 +++++++++++++ config/app.php | 2 +- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php index 7c0598fb..0d87ba29 100644 --- a/app/Http/Controllers/ItemController.php +++ b/app/Http/Controllers/ItemController.php @@ -429,20 +429,31 @@ class ItemController extends Controller return null; } - $output['config'] = null; - $output['custom'] = null; - $app = Application::single($appid); + + if (!$app) { + return response()->json(['error' => 'Application not found.'], 404); + } + $output = (array)$app; $appdetails = Application::getApp($appid); + if (!$appdetails) { + return response()->json(['error' => 'Application details not found.'], 404); + } + if ((bool)$app->enhanced === true) { $item = $itemId ? Item::find($itemId) : Item::where('appid', $appid)->first(); - // if(!isset($app->config)) { // class based config - $output['custom'] = className($appdetails->name) . '.config'; - $output['appvalue'] = $item->description; - // } + + if ($item) { + $output['custom'] = className($appdetails->name) . '.config'; + $output['appvalue'] = $item->description; + } else { + // Ensure the app is installed if not found + $output['custom'] = className($appdetails->name) . '.config'; + $output['appvalue'] = null; + } } $output['colour'] = ($app->tile_background == 'light') ? '#fafbfc' : '#161b1f'; @@ -450,14 +461,12 @@ class ItemController extends Controller if (strpos($app->icon, '://') !== false) { $output['iconview'] = $app->icon; } elseif (strpos($app->icon, 'icons/') !== false) { - // Private apps have the icon locally $output['iconview'] = URL::to('/') . '/storage/' . $app->icon; $output['icon'] = str_replace('icons/', '', $output['icon']); } else { $output['iconview'] = config('app.appsource') . 'icons/' . $app->icon; } - return json_encode($output); } diff --git a/app/Services/CustomFormBuilder.php b/app/Services/CustomFormBuilder.php index 8700982f..1b8758d9 100644 --- a/app/Services/CustomFormBuilder.php +++ b/app/Services/CustomFormBuilder.php @@ -21,6 +21,20 @@ class CustomFormBuilder ); } + public function hidden($name, $value = null, $options = []) + { + return new HtmlString( + $this->html->input('hidden', $name, $value)->attributes($options) + ); + } + + public function checkbox($name, $value = null, $checked = false, $options = []) + { + return new HtmlString( + $this->html->checkbox($name, $value, $checked)->attributes($options) + ); + } + public function select($name, $list = [], $selected = null, $options = []) { return new HtmlString( diff --git a/config/app.php b/config/app.php index 583ad695..097afdea 100644 --- a/config/app.php +++ b/config/app.php @@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Facade; return [ - 'version' => '2.7.3', + 'version' => '2.7.4', 'appsource' => env('APP_SOURCE', 'https://appslist.heimdall.site/'),