Skip to content

Commit

Permalink
fix: update ua in invoke, not constructor (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
Crypta-Eve authored Jan 26, 2025
1 parent 2a03d9e commit b7aa1c1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Services/EseyeClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public function __construct()
$config->http_client = Client::class;
$config->http_stream_factory = HttpFactory::class;
$config->http_request_factory = HttpFactory::class;
$config->http_user_agent = sprintf('SeAT %s/%s', $version, setting('admin_contact', true));
$config->http_user_agent = sprintf('SeAT %s', $version);
$config->http_user_agent_eveapi_version = $version; //store this for later.

$config->logger = Log::channel('eseye');
$config->cache = Cache::store('eseye');
Expand Down Expand Up @@ -190,6 +191,16 @@ public function setBody(array $body): EsiClient
*/
public function invoke(string $method, string $uri, array $uri_data = []): EsiResponse
{
// Here we update the user--agent with contact information.
// At this point it is updating it each call, at the cost
// of a cache request each time. If this proves to impact,
// then in the future we could guard the cache call.
// The benefit to not guarding it is that changes made in
// the UI are appied immediately.
$config = Configuration::getInstance();
$version = $config->http_user_agent_eveapi_version;
$config->http_user_agent = sprintf('SeAT %s/%s', $version, setting('admin_contact', true));

$response = $this->instance->invoke($method, $uri, $uri_data);

return new \Seat\Eveapi\Containers\EsiResponse(
Expand Down

0 comments on commit b7aa1c1

Please sign in to comment.