fix(Core): fixed refresh character tokens

This commit is contained in:
Dmitry Popov
2025-06-07 01:47:03 +02:00
parent 346c2c65b0
commit c5f6cf0080
4 changed files with 19 additions and 16 deletions
-1
View File
@@ -116,7 +116,6 @@ jobs:
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Prepare
run: |
+4 -8
View File
@@ -129,8 +129,7 @@ defmodule WandererApp.Character.Tracker do
_ ->
case WandererApp.Esi.get_character_online(eve_id,
access_token: access_token,
character_id: character_id,
refresh_token?: true
character_id: character_id
) do
{:ok, online} ->
online = get_online(online)
@@ -331,8 +330,7 @@ defmodule WandererApp.Character.Tracker do
_ ->
case WandererApp.Esi.get_character_ship(eve_id,
access_token: access_token,
character_id: character_id,
refresh_token?: true
character_id: character_id
) do
{:ok, ship} when is_non_struct_map(ship) ->
character_state |> maybe_update_ship(ship)
@@ -415,8 +413,7 @@ defmodule WandererApp.Character.Tracker do
_ ->
case WandererApp.Esi.get_character_location(eve_id,
access_token: access_token,
character_id: character_id,
refresh_token?: true
character_id: character_id
) do
{:ok, location} when is_non_struct_map(location) ->
character_state
@@ -505,8 +502,7 @@ defmodule WandererApp.Character.Tracker do
case WandererApp.Esi.get_character_wallet(eve_id,
params: %{datasource: "tranquility"},
access_token: access_token,
character_id: character_id,
refresh_token?: true
character_id: character_id
) do
{:ok, result} ->
{:ok, state} = WandererApp.Character.get_character_state(character_id)
@@ -145,13 +145,15 @@ defmodule WandererApp.Character.TransactionsTracker.Impl do
end
defp get_wallet_journal(
%{corporation_id: corporation_id, access_token: access_token} = _character,
%{id: character_id, corporation_id: corporation_id, access_token: access_token} =
_character,
division
)
when not is_nil(access_token) do
case WandererApp.Esi.get_corporation_wallet_journal(corporation_id, division,
params: %{datasource: "tranquility"},
access_token: access_token
access_token: access_token,
character_id: character_id
) do
{:ok, result} ->
{:corporation_wallet_journal, result}
@@ -173,12 +175,14 @@ defmodule WandererApp.Character.TransactionsTracker.Impl do
defp get_wallet_journal(_character, _division), do: {:error, :skipped}
defp update_corp_wallets(
%{corporation_id: corporation_id, access_token: access_token} = _character
%{id: character_id, corporation_id: corporation_id, access_token: access_token} =
_character
)
when not is_nil(access_token) do
case WandererApp.Esi.get_corporation_wallets(corporation_id,
params: %{datasource: "tranquility"},
access_token: access_token
access_token: access_token,
character_id: character_id
) do
{:ok, result} ->
{:corporation_wallets, result}
+7 -3
View File
@@ -463,10 +463,10 @@ defmodule WandererApp.Esi.ApiClient do
get(
path,
auth_opts,
opts
opts |> with_refresh_token()
)
else
get_retry(path, auth_opts, opts)
get_retry(path, auth_opts, opts |> with_refresh_token())
end
end
@@ -485,7 +485,7 @@ defmodule WandererApp.Esi.ApiClient do
"/corporations/#{corporation_eve_id}/#{info_path}",
[params: opts[:params] || []] ++
(opts |> get_auth_opts()),
opts ++ @cache_opts
(opts |> with_refresh_token()) ++ @cache_opts
)
defp with_user_agent_opts(opts) do
@@ -495,6 +495,10 @@ defmodule WandererApp.Esi.ApiClient do
)
end
defp with_refresh_token(opts) do
opts |> Keyword.merge(refresh_token?: true)
end
defp with_cache_opts(opts) do
opts |> Keyword.merge(@cache_opts) |> Keyword.merge(cache_dir: System.tmp_dir!())
end