From 344286a5d3f014180393f8d466e9364d7477aac8 Mon Sep 17 00:00:00 2001 From: Gabriele Lauricella Date: Sat, 7 Feb 2026 17:38:45 +0100 Subject: [PATCH 1/2] chore: remove mac_address param web mirror trmnl client --- public/mirror/index.html | 18 +----------------- .../views/livewire/devices/configure.blade.php | 2 +- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/public/mirror/index.html b/public/mirror/index.html index 64746fe..ef60a19 100644 --- a/public/mirror/index.html +++ b/public/mirror/index.html @@ -39,7 +39,6 @@ var data = trmnl.getSettings(); trmnl.ui.apiKeyInput.value = data.api_key || ""; trmnl.ui.baseURLInput.value = data.base_url || ""; - trmnl.ui.macAddressInput.value = data.mac_address || ""; trmnl.ui.displayModeSelect.value = data.display_mode || ""; trmnl.ui.setup.style.display = "flex"; @@ -50,7 +49,6 @@ var apiKey = trmnl.ui.apiKeyInput.value; var baseURL = trmnl.ui.baseURLInput.value; - var macAddress = trmnl.ui.macAddressInput.value; var displayMode = trmnl.ui.displayModeSelect.value; if (!apiKey) { @@ -60,7 +58,6 @@ trmnl.saveSettings({ api_key: apiKey, base_url: baseURL, - mac_address: macAddress, display_mode: displayMode }); @@ -84,7 +81,6 @@ var apiKey = setup.api_key; var displayMode = setup.display_mode; var baseURL = setup.base_url || "https://your-byos-trmnl.com"; - var macAddress = setup.mac_address || "00:00:00:00:00:01"; document.body.classList.remove("dark", "night") if (displayMode) { @@ -92,8 +88,7 @@ } var headers = { - "Access-Token": apiKey, - "id": macAddress + "Access-Token": apiKey }; var url = baseURL + "/api/display"; @@ -210,10 +205,6 @@ hasOverrides = true; } - if (key === "mac_address" && value) { - newSettings.mac_address = value; - hasOverrides = true; - } } if (hasOverrides) { @@ -274,7 +265,6 @@ // settings trmnl.ui.apiKeyInput = document.getElementById("api_key"); trmnl.ui.baseURLInput = document.getElementById("base_url"); - trmnl.ui.macAddressInput = document.getElementById("mac_address"); trmnl.ui.displayModeSelect = document.getElementById("display_mode"); trmnl.ui.setup = document.getElementById("setup"); @@ -469,12 +459,6 @@ TRMNL Logo
-
- - -
-
diff --git a/resources/views/livewire/devices/configure.blade.php b/resources/views/livewire/devices/configure.blade.php index 4c9b4c5..f46b1d9 100644 --- a/resources/views/livewire/devices/configure.blade.php +++ b/resources/views/livewire/devices/configure.blade.php @@ -559,7 +559,7 @@ new class extends Component @php - $mirrorUrl = url('/mirror/index.html') . '?mac_address=' . urlencode($device->mac_address) . '&api_key=' . urlencode($device->api_key); + $mirrorUrl = url('/mirror/index.html') . '?api_key=' . urlencode($device->api_key); @endphp
From 0aa38428f693dacf3b0c92760f9238952aa074ba Mon Sep 17 00:00:00 2001 From: Jamie Shiell Date: Sun, 8 Feb 2026 15:37:41 +0000 Subject: [PATCH 2/2] Correctly set content type when specified in pollin headers --- app/Models/Plugin.php | 6 +++++- tests/Unit/Models/PluginTest.php | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/Models/Plugin.php b/app/Models/Plugin.php index d377956..fc49f3c 100644 --- a/app/Models/Plugin.php +++ b/app/Models/Plugin.php @@ -192,8 +192,12 @@ class Plugin extends Model $httpRequest = Http::withHeaders($headers); if ($this->polling_verb === 'post' && $this->polling_body) { + $contentType = (array_key_exists('Content-Type', $headers)) + ? $headers['Content-Type'] + : 'application/json'; + $resolvedBody = $this->resolveLiquidVariables($this->polling_body); - $httpRequest = $httpRequest->withBody($resolvedBody); + $httpRequest = $httpRequest->withBody($resolvedBody, $contentType); } try { diff --git a/tests/Unit/Models/PluginTest.php b/tests/Unit/Models/PluginTest.php index 749fb62..82813d9 100644 --- a/tests/Unit/Models/PluginTest.php +++ b/tests/Unit/Models/PluginTest.php @@ -72,6 +72,27 @@ test('updateDataPayload sends POST request with body when polling_verb is post', $request->body() === '{"query": "query { user { id name } }"}'); }); +test('updateDataPayload sends POST request with body with correct content type when not JSON content', function (): void { + Http::fake([ + 'https://example.com/api' => Http::response(['success' => true], 200), + ]); + + $plugin = Plugin::factory()->create([ + 'data_strategy' => 'polling', + 'polling_url' => 'https://example.com/api', + 'polling_verb' => 'post', + 'polling_body' => '', + 'polling_header' => 'Content-Type: text/xml' + ]); + + $plugin->updateDataPayload(); + + Http::assertSent(fn ($request): bool => $request->url() === 'https://example.com/api' && + $request->method() === 'POST' && + $request->hasHeader('Content-Type', 'text/xml') && + $request->body() === ''); +}); + test('updateDataPayload handles multiple URLs with IDX_ prefixes', function (): void { $plugin = Plugin::factory()->create([ 'data_strategy' => 'polling',