Added server name and client name

This commit is contained in:
Abdulmhsen B. A. A
2022-06-20 21:58:53 +03:00
parent c3802bed14
commit 9e233799be
3 changed files with 12 additions and 9 deletions

View File

@@ -5,8 +5,8 @@ declare(strict_types=1);
namespace App\Backends\Emby\Action;
use App\Backends\Common\CommonTrait;
use App\Backends\Common\Response;
use App\Backends\Common\Context;
use App\Backends\Common\Response;
use Psr\Http\Message\ServerRequestInterface;
class InspectRequest
@@ -27,9 +27,9 @@ class InspectRequest
$payload = (string)ag($request->getParsedBody() ?? [], 'data', null);
$json = json_decode(
json: $payload,
json: $payload,
associative: true,
flags: JSON_INVALID_UTF8_IGNORE | JSON_THROW_ON_ERROR
flags: JSON_INVALID_UTF8_IGNORE | JSON_THROW_ON_ERROR
);
$alteredRequest = $request->withParsedBody($json);
@@ -38,7 +38,8 @@ class InspectRequest
'ITEM_ID' => ag($json, 'Item.Id', ''),
'SERVER_ID' => ag($json, 'Server.Id', ''),
'SERVER_NAME' => ag($json, 'Server.Name', ''),
'SERVER_VERSION' => afterLast($userAgent, '/'),
'SERVER_CLIENT' => before($userAgent, '/'),
'SERVER_VERSION' => ag($json, 'Server.Version', fn() => afterLast($userAgent, '/')),
'USER_ID' => ag($json, 'User.Id', ''),
'USER_NAME' => ag($json, 'User.Name', ''),
'WH_EVENT' => ag($json, 'Event', 'not_set'),

View File

@@ -5,8 +5,8 @@ declare(strict_types=1);
namespace App\Backends\Jellyfin\Action;
use App\Backends\Common\CommonTrait;
use App\Backends\Common\Response;
use App\Backends\Common\Context;
use App\Backends\Common\Response;
use Psr\Http\Message\ServerRequestInterface;
final class InspectRequest
@@ -38,6 +38,7 @@ final class InspectRequest
'ITEM_ID' => ag($json, 'ItemId', ''),
'SERVER_ID' => ag($json, 'ServerId', ''),
'SERVER_NAME' => ag($json, 'ServerName', ''),
'SERVER_CLIENT' => before($userAgent, '/'),
'SERVER_VERSION' => ag($json, 'ServerVersion', fn() => afterLast($userAgent, '/')),
'USER_ID' => ag($json, 'UserId', ''),
'USER_NAME' => ag($json, 'NotificationUsername', ''),

View File

@@ -5,8 +5,8 @@ declare(strict_types=1);
namespace App\Backends\Plex\Action;
use App\Backends\Common\CommonTrait;
use App\Backends\Common\Response;
use App\Backends\Common\Context;
use App\Backends\Common\Response;
use Psr\Http\Message\ServerRequestInterface;
final class InspectRequest
@@ -27,9 +27,9 @@ final class InspectRequest
$payload = ag($request->getParsedBody() ?? [], 'payload', null);
$json = json_decode(
json: $payload,
json: $payload,
associative: true,
flags: JSON_INVALID_UTF8_IGNORE | JSON_THROW_ON_ERROR
flags: JSON_INVALID_UTF8_IGNORE | JSON_THROW_ON_ERROR
);
$alteredRequest = $request->withParsedBody($json);
@@ -38,7 +38,8 @@ final class InspectRequest
'ITEM_ID' => ag($json, 'Metadata.ratingKey', ''),
'SERVER_ID' => ag($json, 'Server.uuid', ''),
'SERVER_NAME' => ag($json, 'Server.title', ''),
'SERVER_VERSION' => afterLast($userAgent, '/'),
'SERVER_CLIENT' => before($userAgent, '/'),
'SERVER_VERSION' => ag($json, 'Server.version', fn() => afterLast($userAgent, '/')),
'USER_ID' => ag($json, 'Account.id', ''),
'USER_NAME' => ag($json, 'Account.title', ''),
'WH_EVENT' => ag($json, 'event', 'not_set'),