chore: update dependencies

This commit is contained in:
Benjamin Nussbaum 2025-03-25 13:05:23 +01:00
parent 941305dff6
commit 8eb0b2ccd7
6 changed files with 463 additions and 422 deletions

View file

@ -22,7 +22,7 @@ class FetchProxyCloudResponses implements ShouldQueue
public function handle(): void
{
Device::where('proxy_cloud', true)->each(function ($device) {
if (!$device->getNextPlaylistItem()) {
if (! $device->getNextPlaylistItem()) {
try {
$response = Http::withHeaders([
'id' => $device->mac_address,
@ -35,7 +35,7 @@ class FetchProxyCloudResponses implements ShouldQueue
'fw-version' => $device->last_firmware_version,
'accept-encoding' => 'identity;q=1,chunked;q=0.1,*;q=0',
'user-agent' => 'ESP32HTTPClient',
])->get(config('services.trmnl.proxy_base_url') . '/api/display');
])->get(config('services.trmnl.proxy_base_url').'/api/display');
$device->update([
'proxy_cloud_response' => $response->json(),
@ -44,11 +44,11 @@ class FetchProxyCloudResponses implements ShouldQueue
$imageUrl = $response->json('image_url');
$filename = $response->json('filename');
\Log::info('Response data: ' . $imageUrl);
\Log::info('Response data: '.$imageUrl);
if (isset($imageUrl)) {
try {
$imageContents = Http::get($imageUrl)->body();
if (!Storage::disk('public')->exists("images/generated/{$filename}.bmp")) {
if (! Storage::disk('public')->exists("images/generated/{$filename}.bmp")) {
Storage::disk('public')->put(
"images/generated/{$filename}.bmp",
$imageContents
@ -79,7 +79,7 @@ class FetchProxyCloudResponses implements ShouldQueue
'fw-version' => $device->last_firmware_version,
'accept-encoding' => 'identity;q=1,chunked;q=0.1,*;q=0',
'user-agent' => 'ESP32HTTPClient',
])->post(config('services.trmnl.proxy_base_url') . '/api/log', $device->last_log_request);
])->post(config('services.trmnl.proxy_base_url').'/api/log', $device->last_log_request);
$device->update([
'last_log_request' => null,

View file

@ -53,19 +53,21 @@ class Device extends Model
}
}
public function getUpdateFirmwareAttribute() : bool
public function getUpdateFirmwareAttribute(): bool
{
if ($this->proxy_cloud_response && $this->proxy_cloud_response['update_firmware']) {
return true;
}
return false;
}
public function getFirmwareUrlAttribute() : string | null
public function getFirmwareUrlAttribute(): ?string
{
if ($this->proxy_cloud_response && $this->proxy_cloud_response['firmware_url']) {
return $this->proxy_cloud_response['firmware_url'];
}
return null;
}

View file

@ -44,7 +44,7 @@ class Plugin extends Model
if ($this->data_strategy === 'polling' && $this->polling_url) {
// Parse headers from polling_header string
$headers = ['User-Agent' => 'usetrmnl/byos_laravel', 'Accept' => 'application/json'];
if ($this->polling_header) {
$headerLines = explode("\n", trim($this->polling_header));
foreach ($headerLines as $line) {