Compare commits

...

3 commits

Author SHA1 Message Date
Benjamin Nussbaum
2b919a193d fix(#176): inject device variables into recipes
Some checks failed
tests / ci (push) Has been cancelled
2026-02-03 22:21:35 +01:00
Benjamin Nussbaum
7adbcc104e chore: update maximum compatibility wording 2026-02-03 22:04:09 +01:00
Benjamin Nussbaum
bb0f2a4555 chore: update dependencies 2026-02-03 21:40:26 +01:00
5 changed files with 109 additions and 52 deletions

View file

@ -143,7 +143,7 @@ class PlaylistItem extends Model
'deviceVariant' => $device?->deviceVariant() ?? 'og',
'scaleLevel' => $device?->scaleLevel(),
'slot' => $this->plugin instanceof Plugin
? $this->plugin->render('full', false)
? $this->plugin->render('full', false, $device)
: throw new Exception('Invalid plugin instance'),
])->render();
}
@ -157,7 +157,7 @@ class PlaylistItem extends Model
foreach ($plugins as $index => $plugin) {
$size = $this->getLayoutSize($index);
$pluginMarkups[] = $plugin->render($size, false);
$pluginMarkups[] = $plugin->render($size, false, $device);
}
return view('trmnl-layouts.mashup', [

View file

@ -447,6 +447,13 @@ class Plugin extends Model
'locale' => 'en',
'time_zone_iana' => $timezone,
],
'device' => [
'friendly_id' => $device?->friendly_id,
'percent_charged' => $device?->battery_percent,
'wifi_strength' => $device?->wifi_strength,
'height' => $device?->height,
'width' => $device?->width,
],
'plugin_settings' => [
'instance_name' => $this->name,
'strategy' => $this->data_strategy,

110
composer.lock generated
View file

@ -62,16 +62,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.369.24",
"version": "3.369.26",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "17f404a47879c1fb47175ac2b61881ab0dc2dc5c"
"reference": "ad0916c6595d98f9052f60e1d7204f4740369e94"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/17f404a47879c1fb47175ac2b61881ab0dc2dc5c",
"reference": "17f404a47879c1fb47175ac2b61881ab0dc2dc5c",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/ad0916c6595d98f9052f60e1d7204f4740369e94",
"reference": "ad0916c6595d98f9052f60e1d7204f4740369e94",
"shasum": ""
},
"require": {
@ -153,9 +153,9 @@
"support": {
"forum": "https://github.com/aws/aws-sdk-php/discussions",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.369.24"
"source": "https://github.com/aws/aws-sdk-php/tree/3.369.26"
},
"time": "2026-01-30T19:14:32+00:00"
"time": "2026-02-03T19:16:42+00:00"
},
{
"name": "bacon/bacon-qr-code",
@ -369,16 +369,16 @@
},
{
"name": "brick/math",
"version": "0.14.2",
"version": "0.14.5",
"source": {
"type": "git",
"url": "https://github.com/brick/math.git",
"reference": "55c950aa71a2cabc1d8f2bec1f8a7020bd244aa2"
"reference": "618a8077b3c326045e10d5788ed713b341fcfe40"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/brick/math/zipball/55c950aa71a2cabc1d8f2bec1f8a7020bd244aa2",
"reference": "55c950aa71a2cabc1d8f2bec1f8a7020bd244aa2",
"url": "https://api.github.com/repos/brick/math/zipball/618a8077b3c326045e10d5788ed713b341fcfe40",
"reference": "618a8077b3c326045e10d5788ed713b341fcfe40",
"shasum": ""
},
"require": {
@ -417,7 +417,7 @@
],
"support": {
"issues": "https://github.com/brick/math/issues",
"source": "https://github.com/brick/math/tree/0.14.2"
"source": "https://github.com/brick/math/tree/0.14.5"
},
"funding": [
{
@ -425,7 +425,7 @@
"type": "github"
}
],
"time": "2026-01-30T14:03:11+00:00"
"time": "2026-02-03T18:06:51+00:00"
},
{
"name": "carbonphp/carbon-doctrine-types",
@ -3194,16 +3194,16 @@
},
{
"name": "livewire/livewire",
"version": "v4.1.0",
"version": "v4.1.2",
"source": {
"type": "git",
"url": "https://github.com/livewire/livewire.git",
"reference": "4ae4ee18448f8e9d97b68c8c091b2b597f852a6f"
"reference": "8adef21f35f4ffa87fd2f3655b350236df0c39a8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/livewire/livewire/zipball/4ae4ee18448f8e9d97b68c8c091b2b597f852a6f",
"reference": "4ae4ee18448f8e9d97b68c8c091b2b597f852a6f",
"url": "https://api.github.com/repos/livewire/livewire/zipball/8adef21f35f4ffa87fd2f3655b350236df0c39a8",
"reference": "8adef21f35f4ffa87fd2f3655b350236df0c39a8",
"shasum": ""
},
"require": {
@ -3258,7 +3258,7 @@
"description": "A front-end framework for Laravel.",
"support": {
"issues": "https://github.com/livewire/livewire/issues",
"source": "https://github.com/livewire/livewire/tree/v4.1.0"
"source": "https://github.com/livewire/livewire/tree/v4.1.2"
},
"funding": [
{
@ -3266,7 +3266,7 @@
"type": "github"
}
],
"time": "2026-01-27T02:21:37+00:00"
"time": "2026-02-03T03:01:29+00:00"
},
{
"name": "maennchen/zipstream-php",
@ -3687,16 +3687,16 @@
},
{
"name": "nette/utils",
"version": "v4.1.1",
"version": "v4.1.2",
"source": {
"type": "git",
"url": "https://github.com/nette/utils.git",
"reference": "c99059c0315591f1a0db7ad6002000288ab8dc72"
"reference": "f76b5dc3d6c6d3043c8d937df2698515b99cbaf5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/c99059c0315591f1a0db7ad6002000288ab8dc72",
"reference": "c99059c0315591f1a0db7ad6002000288ab8dc72",
"url": "https://api.github.com/repos/nette/utils/zipball/f76b5dc3d6c6d3043c8d937df2698515b99cbaf5",
"reference": "f76b5dc3d6c6d3043c8d937df2698515b99cbaf5",
"shasum": ""
},
"require": {
@ -3709,7 +3709,7 @@
"require-dev": {
"jetbrains/phpstorm-attributes": "^1.2",
"nette/tester": "^2.5",
"phpstan/phpstan-nette": "^2.0@stable",
"phpstan/phpstan": "^2.0@stable",
"tracy/tracy": "^2.9"
},
"suggest": {
@ -3770,9 +3770,9 @@
],
"support": {
"issues": "https://github.com/nette/utils/issues",
"source": "https://github.com/nette/utils/tree/v4.1.1"
"source": "https://github.com/nette/utils/tree/v4.1.2"
},
"time": "2025-12-22T12:14:32+00:00"
"time": "2026-02-03T17:21:09+00:00"
},
{
"name": "nikic/php-parser",
@ -8875,16 +8875,16 @@
},
{
"name": "iamcal/sql-parser",
"version": "v0.6",
"version": "v0.7",
"source": {
"type": "git",
"url": "https://github.com/iamcal/SQLParser.git",
"reference": "947083e2dca211a6f12fb1beb67a01e387de9b62"
"reference": "610392f38de49a44dab08dc1659960a29874c4b8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/iamcal/SQLParser/zipball/947083e2dca211a6f12fb1beb67a01e387de9b62",
"reference": "947083e2dca211a6f12fb1beb67a01e387de9b62",
"url": "https://api.github.com/repos/iamcal/SQLParser/zipball/610392f38de49a44dab08dc1659960a29874c4b8",
"reference": "610392f38de49a44dab08dc1659960a29874c4b8",
"shasum": ""
},
"require-dev": {
@ -8910,9 +8910,9 @@
"description": "MySQL schema parser",
"support": {
"issues": "https://github.com/iamcal/SQLParser/issues",
"source": "https://github.com/iamcal/SQLParser/tree/v0.6"
"source": "https://github.com/iamcal/SQLParser/tree/v0.7"
},
"time": "2025-03-17T16:59:46+00:00"
"time": "2026-01-28T22:20:33+00:00"
},
{
"name": "jean85/pretty-package-versions",
@ -8976,21 +8976,21 @@
},
{
"name": "larastan/larastan",
"version": "v3.9.1",
"version": "v3.9.2",
"source": {
"type": "git",
"url": "https://github.com/larastan/larastan.git",
"reference": "4b92d9627f779fd32bdc16f53f8ce88c50446ff5"
"reference": "2e9ed291bdc1969e7f270fb33c9cdf3c912daeb2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/larastan/larastan/zipball/4b92d9627f779fd32bdc16f53f8ce88c50446ff5",
"reference": "4b92d9627f779fd32bdc16f53f8ce88c50446ff5",
"url": "https://api.github.com/repos/larastan/larastan/zipball/2e9ed291bdc1969e7f270fb33c9cdf3c912daeb2",
"reference": "2e9ed291bdc1969e7f270fb33c9cdf3c912daeb2",
"shasum": ""
},
"require": {
"ext-json": "*",
"iamcal/sql-parser": "^0.6.0",
"iamcal/sql-parser": "^0.7.0",
"illuminate/console": "^11.44.2 || ^12.4.1",
"illuminate/container": "^11.44.2 || ^12.4.1",
"illuminate/contracts": "^11.44.2 || ^12.4.1",
@ -9054,7 +9054,7 @@
],
"support": {
"issues": "https://github.com/larastan/larastan/issues",
"source": "https://github.com/larastan/larastan/tree/v3.9.1"
"source": "https://github.com/larastan/larastan/tree/v3.9.2"
},
"funding": [
{
@ -9062,20 +9062,20 @@
"type": "github"
}
],
"time": "2026-01-21T09:15:17+00:00"
"time": "2026-01-30T15:16:32+00:00"
},
{
"name": "laravel/boost",
"version": "v2.0.4",
"version": "v2.0.5",
"source": {
"type": "git",
"url": "https://github.com/laravel/boost.git",
"reference": "6f7a9f70c1b2cc5fcef1585e8aa04b8546f150e9"
"reference": "00eede2041a9bac83eabbd3b3f16bd4aa91277c9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/boost/zipball/6f7a9f70c1b2cc5fcef1585e8aa04b8546f150e9",
"reference": "6f7a9f70c1b2cc5fcef1585e8aa04b8546f150e9",
"url": "https://api.github.com/repos/laravel/boost/zipball/00eede2041a9bac83eabbd3b3f16bd4aa91277c9",
"reference": "00eede2041a9bac83eabbd3b3f16bd4aa91277c9",
"shasum": ""
},
"require": {
@ -9128,7 +9128,7 @@
"issues": "https://github.com/laravel/boost/issues",
"source": "https://github.com/laravel/boost"
},
"time": "2026-01-28T13:53:50+00:00"
"time": "2026-02-01T09:52:44+00:00"
},
{
"name": "laravel/mcp",
@ -10572,16 +10572,16 @@
},
{
"name": "phpunit/php-file-iterator",
"version": "6.0.0",
"version": "6.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "961bc913d42fe24a257bfff826a5068079ac7782"
"reference": "3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/961bc913d42fe24a257bfff826a5068079ac7782",
"reference": "961bc913d42fe24a257bfff826a5068079ac7782",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5",
"reference": "3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5",
"shasum": ""
},
"require": {
@ -10621,15 +10621,27 @@
"support": {
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
"security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy",
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/6.0.0"
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/6.0.1"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpunit/php-file-iterator",
"type": "tidelift"
}
],
"time": "2025-02-07T04:58:37+00:00"
"time": "2026-02-02T14:04:18+00:00"
},
{
"name": "phpunit/php-invoker",

View file

@ -433,7 +433,7 @@ new class extends Component
@endforeach
</flux:select>
<flux:checkbox wire:model="maximum_compatibility" label="Maximum Compatibility" description="Enable if experiencing display issues" />
<flux:checkbox wire:model="maximum_compatibility" label="Maximum Compatibility" description="Resolves display issues caused by certain e-ink driver chips. Disables fast refresh. TRMNL Firmware 1.6.0+ required." />
@if(empty($device_model_id))
<flux:separator class="my-4" text="Advanced Device Settings" />

View file

@ -1,8 +1,10 @@
<?php
use App\Models\Device;
use App\Models\Playlist;
use App\Models\PlaylistItem;
use App\Models\Plugin;
use App\Models\User;
test('playlist item belongs to playlist', function (): void {
$playlist = Playlist::factory()->create();
@ -208,3 +210,39 @@ test('playlist item can create mashup', function (): void {
->is_active->toBeTrue()
->order->toBe($order);
});
test('playlist item mashup render includes device context in liquid (trmnl.device.friendly_id)', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create([
'user_id' => $user->id,
'friendly_id' => 'my-kitchen-display',
]);
$playlist = Playlist::factory()->create(['device_id' => $device->id]);
$plugin1 = Plugin::factory()->create([
'user_id' => $user->id,
'plugin_type' => 'recipe',
'markup_language' => 'liquid',
'render_markup' => '{{ trmnl.device.friendly_id }}',
]);
$plugin2 = Plugin::factory()->create([
'user_id' => $user->id,
'plugin_type' => 'recipe',
'markup_language' => 'liquid',
'render_markup' => 'slot2:{{ trmnl.device.friendly_id }}',
]);
$playlistItem = PlaylistItem::createMashup(
$playlist,
'1Lx1R',
[$plugin1->id, $plugin2->id],
'Device context mashup',
1
);
$markup = $playlistItem->render($device);
expect($markup)
->toContain('my-kitchen-display')
->toContain('slot2:my-kitchen-display');
});