mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
feat: add plugin model
initial implementation of playlist feat: added support for playlists
This commit is contained in:
parent
276511fc98
commit
4195269414
17 changed files with 669 additions and 15 deletions
|
|
@ -8,7 +8,6 @@ use Illuminate\Support\Facades\Route;
|
|||
use Illuminate\Support\Str;
|
||||
|
||||
Route::get('/display', function (Request $request) {
|
||||
|
||||
$mac_address = $request->header('id');
|
||||
$access_token = $request->header('access-token');
|
||||
$device = Device::where('mac_address', $mac_address)
|
||||
|
|
@ -42,6 +41,18 @@ Route::get('/display', function (Request $request) {
|
|||
'last_firmware_version' => $request->header('fw-version'),
|
||||
]);
|
||||
|
||||
// Skip if cloud proxy is enabled for device
|
||||
if (! $device->proxy_cloud) {
|
||||
$playlistItem = $device->getNextPlaylistItem();
|
||||
|
||||
if ($playlistItem) {
|
||||
$playlistItem->update(['last_displayed_at' => now()]);
|
||||
$markup = Blade::render($playlistItem->plugin->render_markup, ['data' => $playlistItem->plugin->data_payload]);
|
||||
|
||||
GenerateScreenJob::dispatchSync($device->id, $markup);
|
||||
}
|
||||
}
|
||||
|
||||
$image_uuid = $device->current_screen_image;
|
||||
if (! $image_uuid) {
|
||||
$image_path = 'images/setup-logo.bmp';
|
||||
|
|
@ -55,7 +66,7 @@ Route::get('/display', function (Request $request) {
|
|||
'status' => '0',
|
||||
'image_url' => url('storage/'.$image_path),
|
||||
'filename' => $filename,
|
||||
'refresh_rate' => 900,
|
||||
'refresh_rate' => $device->default_refresh_interval,
|
||||
'reset_firmware' => false,
|
||||
'update_firmware' => false,
|
||||
'firmware_url' => null,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ Route::middleware(['auth'])->group(function () {
|
|||
|
||||
Volt::route('plugins', 'plugins.index')->name('plugins.index');
|
||||
|
||||
Volt::route('plugins/receipt/{plugin}', 'plugins.receipt')->name('plugins.receipt');
|
||||
Volt::route('plugins/markup', 'plugins.markup')->name('plugins.markup');
|
||||
Volt::route('plugins/api', 'plugins.api')->name('plugins.api');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue