mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-07 00:05:34 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d99c54af7 | ||
|
|
2b7901e9a8 | ||
|
|
fb06dd1dbc | ||
|
|
f8ba36b8be | ||
|
|
5bf9d99b3d | ||
|
|
7cad05342a | ||
|
|
867780e525 | ||
|
|
ff4f9a79c9 | ||
|
|
6699c36fb3 |
23
CHANGELOG.md
23
CHANGELOG.md
@@ -2,6 +2,29 @@
|
||||
|
||||
<!-- changelog -->
|
||||
|
||||
## [v1.62.3](https://github.com/wanderer-industries/wanderer/compare/v1.62.2...v1.62.3) (2025-05-08)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* Core: Fixed map characters got untracked
|
||||
|
||||
## [v1.62.2](https://github.com/wanderer-industries/wanderer/compare/v1.62.1...v1.62.2) (2025-05-05)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* Core: Fixed audit export API
|
||||
|
||||
## [v1.62.1](https://github.com/wanderer-industries/wanderer/compare/v1.62.0...v1.62.1) (2025-05-05)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.62.0](https://github.com/wanderer-industries/wanderer/compare/v1.61.2...v1.62.0) (2025-05-05)
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ defmodule WandererApp.Character.Tracker do
|
||||
status: binary()
|
||||
}
|
||||
|
||||
@online_error_timeout :timer.minutes(2)
|
||||
@online_error_timeout :timer.minutes(5)
|
||||
@forbidden_ttl :timer.minutes(1)
|
||||
@pubsub_client Application.compile_env(:wanderer_app, :pubsub_client)
|
||||
|
||||
@@ -49,7 +49,7 @@ defmodule WandererApp.Character.Tracker do
|
||||
|> new()
|
||||
end
|
||||
|
||||
def update_track_settings(character_id, track_settings) do
|
||||
def update_settings(character_id, track_settings) do
|
||||
{:ok, character_state} = WandererApp.Character.get_character_state(character_id)
|
||||
|
||||
{:ok,
|
||||
@@ -494,7 +494,7 @@ defmodule WandererApp.Character.Tracker do
|
||||
state,
|
||||
location
|
||||
) do
|
||||
location = get_location(location)
|
||||
location = get_location(location)
|
||||
|
||||
if not is_location_started?(character_id) do
|
||||
WandererApp.Cache.lookup!("character:#{character_id}:start_solar_system_id", nil)
|
||||
@@ -544,14 +544,18 @@ defmodule WandererApp.Character.Tracker do
|
||||
)
|
||||
|
||||
defp is_location_updated?(
|
||||
%{solar_system_id: new_solar_system_id, station_id: new_station_id, structure_id: new_structure_id} = _location,
|
||||
%{
|
||||
solar_system_id: new_solar_system_id,
|
||||
station_id: new_station_id,
|
||||
structure_id: new_structure_id
|
||||
} = _location,
|
||||
solar_system_id,
|
||||
structure_id,
|
||||
station_id
|
||||
),
|
||||
do:
|
||||
solar_system_id != new_solar_system_id ||
|
||||
solar_system_id != new_solar_system_id ||
|
||||
solar_system_id != new_solar_system_id ||
|
||||
structure_id != new_structure_id ||
|
||||
station_id != new_station_id
|
||||
|
||||
@@ -724,14 +728,7 @@ defmodule WandererApp.Character.Tracker do
|
||||
)
|
||||
end
|
||||
|
||||
WandererApp.Character.update_character(character_id, %{online: false})
|
||||
|
||||
%{
|
||||
state
|
||||
| track_ship: false,
|
||||
track_online: false,
|
||||
track_location: false
|
||||
}
|
||||
state
|
||||
end
|
||||
|
||||
defp maybe_stop_tracking(
|
||||
@@ -759,5 +756,5 @@ defmodule WandererApp.Character.Tracker do
|
||||
|
||||
defp get_online(%{"online" => online}), do: %{online: online}
|
||||
|
||||
defp get_online(_), do: %{online: false}
|
||||
defp get_online(_), do: %{online: true}
|
||||
end
|
||||
|
||||
@@ -118,7 +118,7 @@ defmodule WandererApp.Character.TrackerManager.Impl do
|
||||
)
|
||||
|
||||
{:ok, character_state} =
|
||||
WandererApp.Character.Tracker.update_track_settings(character_id, track_settings)
|
||||
WandererApp.Character.Tracker.update_settings(character_id, track_settings)
|
||||
|
||||
WandererApp.Character.update_character_state(character_id, character_state)
|
||||
else
|
||||
@@ -213,15 +213,17 @@ defmodule WandererApp.Character.TrackerManager.Impl do
|
||||
WandererApp.Cache.get_and_remove!("character_untrack_queue", [])
|
||||
|> Task.async_stream(
|
||||
fn {map_id, character_id} ->
|
||||
WandererApp.Cache.delete("map_#{map_id}:character_#{character_id}:tracked")
|
||||
if not character_is_present(map_id, character_id) do
|
||||
WandererApp.Cache.delete("map_#{map_id}:character_#{character_id}:tracked")
|
||||
|
||||
{:ok, character_state} =
|
||||
WandererApp.Character.Tracker.update_track_settings(character_id, %{
|
||||
map_id: map_id,
|
||||
track: false
|
||||
})
|
||||
{:ok, character_state} =
|
||||
WandererApp.Character.Tracker.update_settings(character_id, %{
|
||||
map_id: map_id,
|
||||
track: false
|
||||
})
|
||||
|
||||
WandererApp.Character.update_character_state(character_id, character_state)
|
||||
WandererApp.Character.update_character_state(character_id, character_state)
|
||||
end
|
||||
end,
|
||||
max_concurrency: System.schedulers_online(),
|
||||
on_timeout: :kill_task,
|
||||
@@ -250,4 +252,11 @@ defmodule WandererApp.Character.TrackerManager.Impl do
|
||||
|
||||
def handle_info(_event, state),
|
||||
do: state
|
||||
|
||||
defp character_is_present(map_id, character_id) do
|
||||
{:ok, presence_character_ids} =
|
||||
WandererApp.Cache.lookup("map_#{map_id}:presence_character_ids", [])
|
||||
|
||||
Enum.member?(presence_character_ids, character_id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -120,7 +120,7 @@ defmodule WandererApp.Character.TrackingUtils do
|
||||
{:ok, updated_settings} =
|
||||
WandererApp.MapCharacterSettingsRepo.untrack(existing_settings)
|
||||
|
||||
:ok = untrack_characters([character], map_id, caller_pid)
|
||||
:ok = untrack([character], map_id, caller_pid)
|
||||
:ok = remove_characters([character], map_id)
|
||||
{:ok, updated_settings}
|
||||
else
|
||||
@@ -131,7 +131,7 @@ defmodule WandererApp.Character.TrackingUtils do
|
||||
{:ok, %{tracked: false} = existing_settings} ->
|
||||
if track do
|
||||
{:ok, updated_settings} = WandererApp.MapCharacterSettingsRepo.track(existing_settings)
|
||||
:ok = track_characters([character], map_id, true, caller_pid)
|
||||
:ok = track([character], map_id, true, caller_pid)
|
||||
:ok = add_characters([character], map_id, true)
|
||||
{:ok, updated_settings}
|
||||
else
|
||||
@@ -148,7 +148,7 @@ defmodule WandererApp.Character.TrackingUtils do
|
||||
tracked: true
|
||||
})
|
||||
|
||||
:ok = track_characters([character], map_id, true, caller_pid)
|
||||
:ok = track([character], map_id, true, caller_pid)
|
||||
:ok = add_characters([character], map_id, true)
|
||||
{:ok, settings}
|
||||
else
|
||||
@@ -161,25 +161,25 @@ defmodule WandererApp.Character.TrackingUtils do
|
||||
end
|
||||
|
||||
# Helper functions for character tracking
|
||||
def track_characters(_, _, false, _), do: :ok
|
||||
def track_characters([], _map_id, _is_track_character?, _), do: :ok
|
||||
def track(_, _, false, _), do: :ok
|
||||
def track([], _map_id, _is_track_character?, _), do: :ok
|
||||
|
||||
def track_characters([character | characters], map_id, true, caller_pid) do
|
||||
def track([character | characters], map_id, true, caller_pid) do
|
||||
with :ok <- track_character(character, map_id, caller_pid) do
|
||||
track_characters(characters, map_id, true, caller_pid)
|
||||
track(characters, map_id, true, caller_pid)
|
||||
end
|
||||
end
|
||||
|
||||
def track_character(
|
||||
%{
|
||||
id: character_id,
|
||||
eve_id: eve_id,
|
||||
corporation_id: corporation_id,
|
||||
alliance_id: alliance_id
|
||||
},
|
||||
map_id,
|
||||
caller_pid
|
||||
) do
|
||||
defp track_character(
|
||||
%{
|
||||
id: character_id,
|
||||
eve_id: eve_id,
|
||||
corporation_id: corporation_id,
|
||||
alliance_id: alliance_id
|
||||
},
|
||||
map_id,
|
||||
caller_pid
|
||||
) do
|
||||
with false <- is_nil(caller_pid) do
|
||||
WandererAppWeb.Presence.track(caller_pid, map_id, character_id, %{})
|
||||
|
||||
@@ -202,7 +202,7 @@ defmodule WandererApp.Character.TrackingUtils do
|
||||
end
|
||||
end
|
||||
|
||||
def untrack_characters(characters, map_id, caller_pid) do
|
||||
def untrack(characters, map_id, caller_pid) do
|
||||
with false <- is_nil(caller_pid) do
|
||||
characters
|
||||
|> Enum.each(fn character ->
|
||||
|
||||
@@ -32,7 +32,7 @@ defmodule WandererApp.Esi.ApiClient do
|
||||
}
|
||||
|
||||
@cache_opts [cache: true]
|
||||
@retry_opts [max_retries: 1, retry_log_level: :warning]
|
||||
@retry_opts [max_retries: 0, retry_log_level: :warning]
|
||||
@timeout_opts [pool_timeout: 15_000, receive_timeout: :timer.seconds(30)]
|
||||
@api_retry_count 1
|
||||
|
||||
@@ -490,7 +490,11 @@ defmodule WandererApp.Esi.ApiClient do
|
||||
try do
|
||||
case Req.get(
|
||||
"#{@base_url}#{path}",
|
||||
api_opts |> with_user_agent_opts() |> with_cache_opts() |> Keyword.merge(@retry_opts) |> Keyword.merge(@timeout_opts)
|
||||
api_opts
|
||||
|> with_user_agent_opts()
|
||||
|> with_cache_opts()
|
||||
|> Keyword.merge(@retry_opts)
|
||||
|> Keyword.merge(@timeout_opts)
|
||||
) do
|
||||
{:ok, %{status: 200, body: body}} ->
|
||||
{:ok, body}
|
||||
|
||||
@@ -335,7 +335,7 @@ defmodule WandererAppWeb.MapCharactersEventHandler do
|
||||
|
||||
defp handle_tracking_event({:track_characters, map_characters, track_character}, socket, map_id) do
|
||||
:ok =
|
||||
WandererApp.Character.TrackingUtils.track_characters(
|
||||
WandererApp.Character.TrackingUtils.track(
|
||||
map_characters,
|
||||
map_id,
|
||||
track_character,
|
||||
|
||||
@@ -57,7 +57,7 @@ defmodule WandererAppWeb.MapCoreEventHandler do
|
||||
case track_character do
|
||||
false ->
|
||||
:ok =
|
||||
WandererApp.Character.TrackingUtils.untrack_characters(
|
||||
WandererApp.Character.TrackingUtils.untrack(
|
||||
map_characters,
|
||||
map_id,
|
||||
self()
|
||||
@@ -67,7 +67,7 @@ defmodule WandererAppWeb.MapCoreEventHandler do
|
||||
|
||||
_ ->
|
||||
:ok =
|
||||
WandererApp.Character.TrackingUtils.track_characters(
|
||||
WandererApp.Character.TrackingUtils.track(
|
||||
map_characters,
|
||||
map_id,
|
||||
true,
|
||||
|
||||
@@ -71,20 +71,31 @@ defmodule WandererAppWeb.MapRoutesEventHandler do
|
||||
def handle_ui_event(
|
||||
"get_user_routes",
|
||||
%{"system_id" => solar_system_id, "routes_settings" => routes_settings} = _event,
|
||||
%{assigns: %{map_id: map_id, map_loaded?: true, current_user: current_user}} = socket
|
||||
%{
|
||||
assigns: %{
|
||||
map_id: map_id,
|
||||
map_loaded?: true,
|
||||
current_user: current_user,
|
||||
is_subscription_active?: is_subscription_active?
|
||||
}
|
||||
} = socket
|
||||
) do
|
||||
Task.async(fn ->
|
||||
{:ok, hubs} = WandererApp.MapUserSettingsRepo.get_hubs(map_id, current_user.id)
|
||||
if is_subscription_active? do
|
||||
{:ok, hubs} = WandererApp.MapUserSettingsRepo.get_hubs(map_id, current_user.id)
|
||||
|
||||
{:ok, routes} =
|
||||
WandererApp.Maps.find_routes(
|
||||
map_id,
|
||||
hubs,
|
||||
solar_system_id,
|
||||
get_routes_settings(routes_settings)
|
||||
)
|
||||
{:ok, routes} =
|
||||
WandererApp.Maps.find_routes(
|
||||
map_id,
|
||||
hubs,
|
||||
solar_system_id,
|
||||
get_routes_settings(routes_settings)
|
||||
)
|
||||
|
||||
{:user_routes, {solar_system_id, routes}}
|
||||
{:user_routes, {solar_system_id, routes}}
|
||||
else
|
||||
{:user_routes, {solar_system_id, %{routes: [], systems_static_data: []}}}
|
||||
end
|
||||
end)
|
||||
|
||||
{:noreply, socket}
|
||||
|
||||
@@ -291,6 +291,8 @@ defmodule WandererAppWeb.MapEventHandler do
|
||||
|
||||
def push_map_event(socket, _type, _body), do: socket
|
||||
|
||||
def map_ui_character_stat(nil), do: nil
|
||||
|
||||
def map_ui_character_stat(character),
|
||||
do:
|
||||
character
|
||||
|
||||
Reference in New Issue
Block a user