mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
* feat: autojoin toggle * feat: auto add devices * feat: proxy feature * feat: support puppeteer in docker * feat: toggle to activate cloud proxy * feat: relay device information * feat: relay logs to cloud * feat: migrate on start * feat: calculate battery state, wifi signal * feat: eye candy for configure view * feat: update via api
56 lines
1.7 KiB
PHP
56 lines
1.7 KiB
PHP
<?php
|
|
|
|
use Livewire\Volt\Component;
|
|
|
|
new class extends Component {
|
|
public $token;
|
|
|
|
public function mount(): void
|
|
{
|
|
$token = Auth::user()?->tokens()?->first();
|
|
if ($token === null) {
|
|
$token = Auth::user()->createToken('api-token', ['update-screen']);
|
|
}
|
|
$this->token = $token->plainTextToken;
|
|
}
|
|
|
|
public function regenerateToken()
|
|
{
|
|
Auth::user()->tokens()?->first()?->delete();
|
|
$token = Auth::user()->createToken('api-token', ['update-screen']);
|
|
$this->token = $token->plainTextToken;
|
|
}
|
|
};
|
|
?>
|
|
|
|
<div class="py-12">
|
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
|
<div class="flex justify-between items-center mb-6">
|
|
<h2 class="text-2xl font-semibold dark:text-gray-100">API</h2>
|
|
|
|
</div>
|
|
<div>
|
|
<p>
|
|
<flux:badge>POST</flux:badge>
|
|
<span class="ml-2 font-mono">{{route('display.update')}}</span>
|
|
</p>
|
|
<div class="mt-4">
|
|
<h3 class="text-lg">Headers</h3>
|
|
<div>Authorization <span class="ml-2 font-mono">Bearer {{$token ?? '**********'}}</span>
|
|
<flux:button variant="subtle" size="xs" class="mt-2" wire:click="regenerateToken()">
|
|
Regenerate Token
|
|
</flux:button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-4">
|
|
<h3 class="text-lg">Body</h3>
|
|
<div class="font-mono">
|
|
<pre>
|
|
{"markup":"<h1>Hello World</h1>"}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|