mirror of
https://github.com/wanderer-industries/wanderer
synced 2026-08-26 15:56:32 +00:00
fix(Core): fixed refresh character tokens
This commit is contained in:
@@ -116,7 +116,6 @@ jobs:
|
||||
matrix:
|
||||
platform:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
steps:
|
||||
- name: Prepare
|
||||
run: |
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user