user()->plugins->contains($this->plugin), 403); abort_unless($this->plugin->plugin_type === 'image_webhook', 404); $this->name = $this->plugin->name; } protected array $rules = [ 'name' => 'required|string|max:255', 'checked_devices' => 'array', 'device_playlist_names' => 'array', 'device_playlists' => 'array', 'device_weekdays' => 'array', 'device_active_from' => 'array', 'device_active_until' => 'array', ]; public function updateName(): void { abort_unless(auth()->user()->plugins->contains($this->plugin), 403); $this->validate(['name' => 'required|string|max:255']); $this->plugin->update(['name' => $this->name]); } public function addToPlaylist() { $this->validate([ 'checked_devices' => 'required|array|min:1', ]); foreach ($this->checked_devices as $deviceId) { if (!isset($this->device_playlists[$deviceId]) || empty($this->device_playlists[$deviceId])) { $this->addError('device_playlists.' . $deviceId, 'Please select a playlist for each device.'); return; } if ($this->device_playlists[$deviceId] === 'new') { if (!isset($this->device_playlist_names[$deviceId]) || empty($this->device_playlist_names[$deviceId])) { $this->addError('device_playlist_names.' . $deviceId, 'Playlist name is required when creating a new playlist.'); return; } } } foreach ($this->checked_devices as $deviceId) { $playlist = null; if ($this->device_playlists[$deviceId] === 'new') { $playlist = \App\Models\Playlist::create([ 'device_id' => $deviceId, 'name' => $this->device_playlist_names[$deviceId], 'weekdays' => !empty($this->device_weekdays[$deviceId] ?? null) ? $this->device_weekdays[$deviceId] : null, 'active_from' => $this->device_active_from[$deviceId] ?? null, 'active_until' => $this->device_active_until[$deviceId] ?? null, ]); } else { $playlist = \App\Models\Playlist::findOrFail($this->device_playlists[$deviceId]); } $maxOrder = $playlist->items()->max('order') ?? 0; // Image webhook plugins only support full layout $playlist->items()->create([ 'plugin_id' => $this->plugin->id, 'order' => $maxOrder + 1, ]); } $this->reset([ 'checked_devices', 'device_playlists', 'device_playlist_names', 'device_weekdays', 'device_active_from', 'device_active_until', ]); Flux::modal('add-to-playlist')->close(); } public function getDevicePlaylists($deviceId) { return \App\Models\Playlist::where('device_id', $deviceId)->get(); } public function hasAnyPlaylistSelected(): bool { foreach ($this->checked_devices as $deviceId) { if (isset($this->device_playlists[$deviceId]) && !empty($this->device_playlists[$deviceId])) { return true; } } return false; } public function deletePlugin(): void { abort_unless(auth()->user()->plugins->contains($this->plugin), 403); $this->plugin->delete(); $this->redirect(route('plugins.image-webhook')); } public function getImagePath(): ?string { if (!$this->plugin->current_image) { return null; } $extensions = ['png', 'bmp']; foreach ($extensions as $ext) { $path = 'images/generated/'.$this->plugin->current_image.'.'.$ext; if (\Illuminate\Support\Facades\Storage::disk('public')->exists($path)) { return $path; } } return null; } }; ?>

Image Webhook – {{$plugin->name}}

Add to Playlist Delete Instance
Add to Playlist
@foreach(auth()->user()->devices as $device) @endforeach
@if(count($checked_devices) > 0)
@foreach($checked_devices as $deviceId) @php $device = auth()->user()->devices->find($deviceId); @endphp
{{ $device->name }}
@foreach($this->getDevicePlaylists($deviceId) as $playlist) @endforeach
@if(isset($device_playlists[$deviceId]) && $device_playlists[$deviceId] === 'new')
@endif
@endforeach
@endif
Add to Playlist
Delete {{ $plugin->name }}?

This will also remove this instance from your playlists.

Cancel Delete instance
Save
Webhook URL POST an image (PNG or BMP) to this URL to update the displayed image. Images must be posted in a format that can directly be read by the device. You need to take care of image format, dithering, and bit-depth. Check device logs if the image is not shown.
Current Image @if($this->getImagePath()) {{ $plugin->name }} @else No image uploaded yet. POST an image to the webhook URL to get started. @endif