feat: enhanced device support when rendering mashups

This commit is contained in:
Benjamin Nussbaum 2025-09-19 17:04:23 +02:00
parent 19a8bb18cc
commit ee9f21a83d
2 changed files with 8 additions and 2 deletions

View file

@ -135,10 +135,13 @@ class PlaylistItem extends Model
/** /**
* Render all plugins with appropriate layout * Render all plugins with appropriate layout
*/ */
public function render(): string public function render(?Device $device = null): string
{ {
if (! $this->isMashup()) { if (! $this->isMashup()) {
return view('trmnl-layouts.single', [ return view('trmnl-layouts.single', [
'colorDepth' => $device?->deviceModel?->color_depth,
'deviceVariant' => $device?->deviceModel?->name ?? 'og',
'scaleLevel' => $device?->deviceModel?->scale_level,
'slot' => $this->plugin instanceof Plugin 'slot' => $this->plugin instanceof Plugin
? $this->plugin->render('full', false) ? $this->plugin->render('full', false)
: throw new Exception('Invalid plugin instance'), : throw new Exception('Invalid plugin instance'),
@ -160,6 +163,9 @@ class PlaylistItem extends Model
} }
return view('trmnl-layouts.mashup', [ return view('trmnl-layouts.mashup', [
'colorDepth' => $device?->deviceModel?->color_depth,
'deviceVariant' => $device?->deviceModel?->name ?? 'og',
'scaleLevel' => $device?->deviceModel?->scale_level,
'mashupLayout' => $this->getMashupLayoutType(), 'mashupLayout' => $this->getMashupLayoutType(),
'slot' => implode('', $pluginMarkups), 'slot' => implode('', $pluginMarkups),
])->render(); ])->render();

View file

@ -110,7 +110,7 @@ Route::get('/display', function (Request $request) {
} }
} }
$markup = $playlistItem->render(); $markup = $playlistItem->render(device: $device);
GenerateScreenJob::dispatchSync($device->id, null, $markup); GenerateScreenJob::dispatchSync($device->id, null, $markup);
$device->refresh(); $device->refresh();