mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-03-16 05:13:29 +00:00
Compare commits
No commits in common. "226afa2ed33a608dbf28fd2fa66a4b7fef8f36cd" and "4e345c493d2cc6b9a494d8da290844a93f12359b" have entirely different histories.
226afa2ed3
...
4e345c493d
5 changed files with 39 additions and 72 deletions
|
|
@ -16,7 +16,7 @@
|
||||||
"ext-simplexml": "*",
|
"ext-simplexml": "*",
|
||||||
"ext-zip": "*",
|
"ext-zip": "*",
|
||||||
"bnussbau/laravel-trmnl-blade": "2.3.*",
|
"bnussbau/laravel-trmnl-blade": "2.3.*",
|
||||||
"bnussbau/trmnl-pipeline-php": "0.7.*",
|
"bnussbau/trmnl-pipeline-php": "^0.6.0",
|
||||||
"keepsuit/laravel-liquid": "^0.5.2",
|
"keepsuit/laravel-liquid": "^0.5.2",
|
||||||
"laravel/fortify": "^1.30",
|
"laravel/fortify": "^1.30",
|
||||||
"laravel/framework": "^12.1",
|
"laravel/framework": "^12.1",
|
||||||
|
|
|
||||||
54
composer.lock
generated
54
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "909d7acdf3f0ace9fb6d20b4de1eeaca",
|
"content-hash": "a4438c591a5d746f546eab261e9e1efc",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "aws/aws-crt-php",
|
"name": "aws/aws-crt-php",
|
||||||
|
|
@ -298,16 +298,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "bnussbau/trmnl-pipeline-php",
|
"name": "bnussbau/trmnl-pipeline-php",
|
||||||
"version": "0.7.0",
|
"version": "0.6.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/bnussbau/trmnl-pipeline-php.git",
|
"url": "https://github.com/bnussbau/trmnl-pipeline-php.git",
|
||||||
"reference": "da80de2b6456776eeabc1fb95fd42e5f3357d865"
|
"reference": "228505afa8a39a5033916e9ae5ccbf1733092c1f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/bnussbau/trmnl-pipeline-php/zipball/da80de2b6456776eeabc1fb95fd42e5f3357d865",
|
"url": "https://api.github.com/repos/bnussbau/trmnl-pipeline-php/zipball/228505afa8a39a5033916e9ae5ccbf1733092c1f",
|
||||||
"reference": "da80de2b6456776eeabc1fb95fd42e5f3357d865",
|
"reference": "228505afa8a39a5033916e9ae5ccbf1733092c1f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
|
@ -349,7 +349,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/bnussbau/trmnl-pipeline-php/issues",
|
"issues": "https://github.com/bnussbau/trmnl-pipeline-php/issues",
|
||||||
"source": "https://github.com/bnussbau/trmnl-pipeline-php/tree/0.7.0"
|
"source": "https://github.com/bnussbau/trmnl-pipeline-php/tree/0.6.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
|
@ -357,7 +357,7 @@
|
||||||
"type": "buy_me_a_coffee"
|
"type": "buy_me_a_coffee"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "https://trmnl.com/?ref=laravel-trmnl",
|
"url": "https://usetrmnl.com/?ref=laravel-trmnl",
|
||||||
"type": "custom"
|
"type": "custom"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -365,7 +365,7 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2026-02-07T22:22:18+00:00"
|
"time": "2025-12-02T15:18:51+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "brick/math",
|
"name": "brick/math",
|
||||||
|
|
@ -9066,16 +9066,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/boost",
|
"name": "laravel/boost",
|
||||||
"version": "v2.1.3",
|
"version": "v2.1.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laravel/boost.git",
|
"url": "https://github.com/laravel/boost.git",
|
||||||
"reference": "b96e0ab547d51d3810498dcc4d5535486991df6f"
|
"reference": "81ecf79e82c979efd92afaeac012605cc7b2f31f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laravel/boost/zipball/b96e0ab547d51d3810498dcc4d5535486991df6f",
|
"url": "https://api.github.com/repos/laravel/boost/zipball/81ecf79e82c979efd92afaeac012605cc7b2f31f",
|
||||||
"reference": "b96e0ab547d51d3810498dcc4d5535486991df6f",
|
"reference": "81ecf79e82c979efd92afaeac012605cc7b2f31f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
|
@ -9086,7 +9086,7 @@
|
||||||
"illuminate/support": "^11.45.3|^12.41.1",
|
"illuminate/support": "^11.45.3|^12.41.1",
|
||||||
"laravel/mcp": "^0.5.1",
|
"laravel/mcp": "^0.5.1",
|
||||||
"laravel/prompts": "^0.3.10",
|
"laravel/prompts": "^0.3.10",
|
||||||
"laravel/roster": "^0.4.0",
|
"laravel/roster": "^0.2.9",
|
||||||
"php": "^8.2"
|
"php": "^8.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
|
@ -9128,7 +9128,7 @@
|
||||||
"issues": "https://github.com/laravel/boost/issues",
|
"issues": "https://github.com/laravel/boost/issues",
|
||||||
"source": "https://github.com/laravel/boost"
|
"source": "https://github.com/laravel/boost"
|
||||||
},
|
},
|
||||||
"time": "2026-02-11T19:22:04+00:00"
|
"time": "2026-02-10T17:40:45+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/mcp",
|
"name": "laravel/mcp",
|
||||||
|
|
@ -9352,31 +9352,31 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/roster",
|
"name": "laravel/roster",
|
||||||
"version": "v0.4.0",
|
"version": "v0.2.9",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laravel/roster.git",
|
"url": "https://github.com/laravel/roster.git",
|
||||||
"reference": "77e6c1187952d0eef50a54922db47893f5e7c986"
|
"reference": "82bbd0e2de614906811aebdf16b4305956816fa6"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laravel/roster/zipball/77e6c1187952d0eef50a54922db47893f5e7c986",
|
"url": "https://api.github.com/repos/laravel/roster/zipball/82bbd0e2de614906811aebdf16b4305956816fa6",
|
||||||
"reference": "77e6c1187952d0eef50a54922db47893f5e7c986",
|
"reference": "82bbd0e2de614906811aebdf16b4305956816fa6",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"illuminate/console": "^11.0|^12.0|^13.0",
|
"illuminate/console": "^10.0|^11.0|^12.0",
|
||||||
"illuminate/contracts": "^11.0|^12.0|^13.0",
|
"illuminate/contracts": "^10.0|^11.0|^12.0",
|
||||||
"illuminate/routing": "^11.0|^12.0|^13.0",
|
"illuminate/routing": "^10.0|^11.0|^12.0",
|
||||||
"illuminate/support": "^11.0|^12.0|^13.0",
|
"illuminate/support": "^10.0|^11.0|^12.0",
|
||||||
"php": "^8.2",
|
"php": "^8.1|^8.2",
|
||||||
"symfony/yaml": "^7.2|^8.0"
|
"symfony/yaml": "^6.4|^7.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"laravel/pint": "^1.14",
|
"laravel/pint": "^1.14",
|
||||||
"mockery/mockery": "^1.6",
|
"mockery/mockery": "^1.6",
|
||||||
"orchestra/testbench": "^9.0|^10.0|^11.0",
|
"orchestra/testbench": "^8.22.0|^9.0|^10.0",
|
||||||
"pestphp/pest": "^3.0|^4.1",
|
"pestphp/pest": "^2.0|^3.0",
|
||||||
"phpstan/phpstan": "^2.0"
|
"phpstan/phpstan": "^2.0"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
|
|
@ -9409,7 +9409,7 @@
|
||||||
"issues": "https://github.com/laravel/roster/issues",
|
"issues": "https://github.com/laravel/roster/issues",
|
||||||
"source": "https://github.com/laravel/roster"
|
"source": "https://github.com/laravel/roster"
|
||||||
},
|
},
|
||||||
"time": "2026-02-11T07:24:41+00:00"
|
"time": "2025-10-20T09:56:46+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/sail",
|
"name": "laravel/sail",
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
{{--@dump($data)--}}
|
{{--@dump($data)--}}
|
||||||
@props(['size' => 'full'])
|
@props(['size' => 'full'])
|
||||||
<x-trmnl::view size="{{ $size }}">
|
<x-trmnl::view size="{{ $size }}">
|
||||||
<x-trmnl::layout class="layout--col">
|
<x-trmnl::layout>
|
||||||
<div class="b-h-gray-1">{{$data['data'][0]['a'] ?? ''}}</div>
|
<x-trmnl::layout class="layout--col">
|
||||||
@if (strlen($data['data'][0]['q'] ?? '') < 300 && $size != 'quadrant')
|
<div class="b-h-gray-1">{{$data['data'][0]['a'] ?? ''}}</div>
|
||||||
<p class="value">{{ $data['data'][0]['q'] ?? '' }}</p>
|
@if (strlen($data['data'][0]['q'] ?? '') < 300 && $size != 'quadrant')
|
||||||
@else
|
<p class="value">{{ $data['data'][0]['q'] ?? '' }}</p>
|
||||||
<p class="value--small">{{ $data['data'][0]['q'] ?? '' }}</p>
|
@else
|
||||||
@endif
|
<p class="value--small">{{ $data['data'][0]['q'] ?? '' }}</p>
|
||||||
|
@endif
|
||||||
|
</x-trmnl::layout>
|
||||||
</x-trmnl::layout>
|
</x-trmnl::layout>
|
||||||
|
|
||||||
<div class="title_bar">
|
<div class="title_bar">
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,8 @@ Route::get('/display', function (Request $request) {
|
||||||
'last_refreshed_at' => now(),
|
'last_refreshed_at' => now(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$batteryPercent = $request->header('battery-percent') ?? $request->header('percent-charged');
|
if ($request->hasHeader('battery-percent')) {
|
||||||
if ($batteryPercent !== null) {
|
$batteryPercent = (int) $request->header('battery-percent');
|
||||||
$batteryPercent = (int) $batteryPercent;
|
|
||||||
$batteryVoltage = $device->calculateVoltageFromPercent($batteryPercent);
|
$batteryVoltage = $device->calculateVoltageFromPercent($batteryPercent);
|
||||||
$device->update([
|
$device->update([
|
||||||
'last_battery_voltage' => $batteryVoltage,
|
'last_battery_voltage' => $batteryVoltage,
|
||||||
|
|
|
||||||
|
|
@ -725,40 +725,6 @@ test('display endpoint updates last_refreshed_at timestamp', function (): void {
|
||||||
->and($device->last_refreshed_at->diffInSeconds(now()))->toBeLessThan(2);
|
->and($device->last_refreshed_at->diffInSeconds(now()))->toBeLessThan(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('display endpoint accepts battery-percent header and updates device', function (): void {
|
|
||||||
$device = Device::factory()->create([
|
|
||||||
'mac_address' => '00:11:22:33:44:56',
|
|
||||||
'api_key' => 'test-api-key-battery',
|
|
||||||
'last_battery_voltage' => null,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->withHeaders([
|
|
||||||
'id' => $device->mac_address,
|
|
||||||
'access-token' => $device->api_key,
|
|
||||||
'battery-percent' => '67',
|
|
||||||
])->get('/api/display')->assertOk();
|
|
||||||
|
|
||||||
$device->refresh();
|
|
||||||
expect($device->battery_percent)->toEqual(67);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('display endpoint accepts Percent-Charged header and updates device', function (): void {
|
|
||||||
$device = Device::factory()->create([
|
|
||||||
'mac_address' => '00:11:22:33:44:57',
|
|
||||||
'api_key' => 'test-api-key-percent-charged',
|
|
||||||
'last_battery_voltage' => null,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->withHeaders([
|
|
||||||
'id' => $device->mac_address,
|
|
||||||
'access-token' => $device->api_key,
|
|
||||||
'Percent-Charged' => '51',
|
|
||||||
])->get('/api/display')->assertOk();
|
|
||||||
|
|
||||||
$device->refresh();
|
|
||||||
expect($device->battery_percent)->toEqual(51);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('display endpoint updates last_refreshed_at timestamp for mirrored devices', function (): void {
|
test('display endpoint updates last_refreshed_at timestamp for mirrored devices', function (): void {
|
||||||
// Create source device
|
// Create source device
|
||||||
$sourceDevice = Device::factory()->create([
|
$sourceDevice = Device::factory()->create([
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue