Handle errors sent back over the sockt

This commit is contained in:
Dane Everitt 2019-09-28 13:09:47 -07:00
parent b78276d23d
commit 326d346f92
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
4 changed files with 32 additions and 13 deletions

View file

@ -63,7 +63,11 @@ class WebsocketController extends ClientApiController
->expiresAt($now->addMinutes(15)->getTimestamp())
->withClaim('user_id', $request->user()->id)
->withClaim('server_uuid', $server->uuid)
->withClaim('permissions', ['connect', 'send-command', 'send-power'])
->withClaim('permissions', array_merge([
'connect',
'send-command',
'send-power',
], $request->user()->root_admin ? ['receive-errors'] : []))
->getToken($signer, new Key($server->node->daemonSecret));
$socket = str_replace(['https://', 'http://'], ['wss://', 'ws://'], $server->node->getConnectionAddress());