mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-03-14 20:33:40 +00:00
Compare commits
3 commits
b7bcaf6feb
...
e9037ef5d7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9037ef5d7 | ||
|
|
ee9f21a83d | ||
|
|
19a8bb18cc |
4 changed files with 34 additions and 9 deletions
2
.github/workflows/docker-build.yml
vendored
2
.github/workflows/docker-build.yml
vendored
|
|
@ -43,7 +43,7 @@ jobs:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
tags: |
|
tags: |
|
||||||
type=ref,event=tag
|
type=ref,event=tag
|
||||||
type=raw,value=latest,enable=${{ github.event.release.prerelease == false }}
|
type=raw,value=latest,enable=${{ !github.event.release.prerelease }}
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
|
|
@ -343,12 +343,22 @@ class Plugin extends Model
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($standalone) {
|
if ($standalone) {
|
||||||
return view('trmnl-layouts.single', [
|
if ($size === 'full') {
|
||||||
'colorDepth' => $device?->deviceModel?->color_depth,
|
return view('trmnl-layouts.single', [
|
||||||
'deviceVariant' => $device?->deviceModel?->name ?? 'og',
|
'colorDepth' => $device?->deviceModel?->color_depth,
|
||||||
'scaleLevel' => $device?->deviceModel?->scale_level,
|
'deviceVariant' => $device?->deviceModel?->name ?? 'og',
|
||||||
'slot' => $renderedContent,
|
'scaleLevel' => $device?->deviceModel?->scale_level,
|
||||||
])->render();
|
'slot' => $renderedContent,
|
||||||
|
])->render();
|
||||||
|
} else {
|
||||||
|
return view('trmnl-layouts.mashup', [
|
||||||
|
'mashupLayout' => $this->getPreviewMashupLayoutForSize($size),
|
||||||
|
'colorDepth' => $device?->deviceModel?->color_depth,
|
||||||
|
'deviceVariant' => $device?->deviceModel?->name ?? 'og',
|
||||||
|
'scaleLevel' => $device?->deviceModel?->scale_level,
|
||||||
|
'slot' => $renderedContent,
|
||||||
|
])->render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $renderedContent;
|
return $renderedContent;
|
||||||
|
|
@ -386,4 +396,13 @@ class Plugin extends Model
|
||||||
{
|
{
|
||||||
return $this->configuration[$key] ?? $default;
|
return $this->configuration[$key] ?? $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPreviewMashupLayoutForSize(string $size): string
|
||||||
|
{
|
||||||
|
return match ($size) {
|
||||||
|
'half_vertical' => '1Lx1R',
|
||||||
|
'quadrant' => '2x2',
|
||||||
|
default => '1Tx1B',
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue