mirror of
https://github.com/wanderer-industries/wanderer
synced 2026-09-25 22:46:19 +00:00
chore: fixed compile warnings
This commit is contained in:
+1
-1
@@ -264,7 +264,7 @@ config :logger,
|
||||
case config_env() do
|
||||
:prod -> "info"
|
||||
:dev -> "info"
|
||||
:test -> "debug"
|
||||
:test -> "warning"
|
||||
end
|
||||
)
|
||||
)
|
||||
|
||||
@@ -45,7 +45,7 @@ defmodule WandererApp.Cache do
|
||||
def insert({id, key}, value, opts) when is_binary(id) and (is_binary(key) or is_atom(key)),
|
||||
do: insert("#{id}:#{key}", value, opts)
|
||||
|
||||
def insert(key, nil, opts) when is_binary(key) or is_atom(key), do: delete(key)
|
||||
def insert(key, nil, _opts) when is_binary(key) or is_atom(key), do: delete(key)
|
||||
def insert(key, value, opts) when is_binary(key) or is_atom(key), do: put(key, value, opts)
|
||||
|
||||
def insert_or_update(key, value, update_fn, opts \\ [])
|
||||
|
||||
@@ -598,9 +598,6 @@ defmodule WandererApp.Character.Tracker do
|
||||
|
||||
{:error, :skipped}
|
||||
end
|
||||
|
||||
_ ->
|
||||
{:error, :skipped}
|
||||
end
|
||||
|
||||
_ ->
|
||||
@@ -799,7 +796,7 @@ defmodule WandererApp.Character.Tracker do
|
||||
corporation_id
|
||||
|> WandererApp.Esi.get_corporation_info()
|
||||
|> case do
|
||||
{:ok, %{"name" => corporation_name, "ticker" => corporation_ticker} = corporation_info} ->
|
||||
{:ok, %{"name" => corporation_name, "ticker" => corporation_ticker}} ->
|
||||
{:ok, character} =
|
||||
WandererApp.Character.get_character(character_id)
|
||||
|
||||
@@ -1002,7 +999,7 @@ defmodule WandererApp.Character.Tracker do
|
||||
defp maybe_update_active_maps(
|
||||
%{character_id: character_id, active_maps: active_maps} =
|
||||
state,
|
||||
%{map_id: map_id, track: true} = track_settings
|
||||
%{map_id: map_id, track: true}
|
||||
) do
|
||||
if not Enum.member?(active_maps, map_id) do
|
||||
WandererApp.Cache.put(
|
||||
|
||||
@@ -89,14 +89,4 @@ defmodule WandererApp.Character.TrackerPoolDynamicSupervisor do
|
||||
end
|
||||
end
|
||||
|
||||
defp stop_child(uuid) do
|
||||
case Registry.lookup(@registry, uuid) do
|
||||
[{pid, _}] ->
|
||||
GenServer.cast(pid, :stop)
|
||||
|
||||
_ ->
|
||||
Logger.warn("Unable to locate pool assigned to #{inspect(uuid)}")
|
||||
:ok
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,7 +38,7 @@ defmodule WandererApp.Character.TrackingConfigUtils do
|
||||
%{id: "default", title: "Default", value: default_count}
|
||||
]
|
||||
|
||||
{:ok, pools_count} =
|
||||
{:ok, _pools_count} =
|
||||
Cachex.get(
|
||||
:esi_auth_cache,
|
||||
"configs_total_count"
|
||||
|
||||
@@ -8,7 +8,6 @@ defmodule WandererApp.Esi.ApiClient do
|
||||
@ttl :timer.hours(1)
|
||||
|
||||
@wanderrer_user_agent "(wanderer-industries@proton.me; +https://github.com/wanderer-industries/wanderer)"
|
||||
@req_esi_options [base_url: "https://esi.evetech.net", finch: WandererApp.Finch]
|
||||
|
||||
@cache_opts [cache: true]
|
||||
@retry_opts [retry: false, retry_log_level: :warning]
|
||||
@@ -74,7 +73,7 @@ defmodule WandererApp.Esi.ApiClient do
|
||||
|> Keyword.merge(@timeout_opts)
|
||||
)
|
||||
|
||||
def get_routes_eve(hubs, origin, params, opts),
|
||||
def get_routes_eve(hubs, origin, _params, _opts),
|
||||
do:
|
||||
{:ok,
|
||||
hubs
|
||||
@@ -101,33 +100,6 @@ defmodule WandererApp.Esi.ApiClient do
|
||||
end
|
||||
end)}
|
||||
|
||||
defp do_get_routes_eve(origin, destination, params, opts) do
|
||||
esi_params =
|
||||
Map.merge(params, %{
|
||||
connections: params.connections |> Enum.join(","),
|
||||
avoid: params.avoid |> Enum.join(",")
|
||||
})
|
||||
|
||||
do_get(
|
||||
"/route/#{origin}/#{destination}/?#{esi_params |> Plug.Conn.Query.encode()}",
|
||||
opts,
|
||||
@cache_opts
|
||||
)
|
||||
|> case do
|
||||
{:ok, result} ->
|
||||
%{
|
||||
"origin" => origin,
|
||||
"destination" => destination,
|
||||
"systems" => result,
|
||||
"success" => true
|
||||
}
|
||||
|
||||
error ->
|
||||
Logger.warning("Error getting routes: #{inspect(error)}")
|
||||
%{"origin" => origin, "destination" => destination, "systems" => [], "success" => false}
|
||||
end
|
||||
end
|
||||
|
||||
@decorate cacheable(
|
||||
cache: Cache,
|
||||
key: "group-info-#{group_id}",
|
||||
@@ -273,6 +245,8 @@ defmodule WandererApp.Esi.ApiClient do
|
||||
opts: [ttl: @ttl]
|
||||
)
|
||||
defp get_search(character_eve_id, search_val, categories_val, merged_opts) do
|
||||
# Note: search_val and categories_val are used by the @decorate cacheable annotation above
|
||||
_unused = {search_val, categories_val}
|
||||
get_character_auth_data(character_eve_id, "search", merged_opts)
|
||||
end
|
||||
|
||||
@@ -348,7 +322,7 @@ defmodule WandererApp.Esi.ApiClient do
|
||||
defp with_cache_opts(opts),
|
||||
do: opts |> Keyword.merge(@cache_opts) |> Keyword.merge(cache_dir: System.tmp_dir!())
|
||||
|
||||
defp do_get(path, api_opts \\ [], opts \\ [], pool \\ @general_pool) do
|
||||
defp do_get(path, api_opts, opts, pool \\ @general_pool) do
|
||||
case Cachex.get(:api_cache, path) do
|
||||
{:ok, cached_data} when not is_nil(cached_data) ->
|
||||
{:ok, cached_data}
|
||||
@@ -358,7 +332,7 @@ defmodule WandererApp.Esi.ApiClient do
|
||||
end
|
||||
end
|
||||
|
||||
defp do_get_request(path, api_opts \\ [], opts \\ [], pool \\ @general_pool) do
|
||||
defp do_get_request(path, api_opts, opts, pool) do
|
||||
try do
|
||||
req_options_for_pool(pool)
|
||||
|> Req.new()
|
||||
@@ -448,7 +422,7 @@ defmodule WandererApp.Esi.ApiClient do
|
||||
{:ok, %{status: status} = _error} when status in [401, 403] ->
|
||||
do_get_retry(path, api_opts, opts)
|
||||
|
||||
{:ok, %{status: status, headers: headers}} ->
|
||||
{:ok, %{status: status}} ->
|
||||
{:error, "Unexpected status: #{status}"}
|
||||
|
||||
{:error, %Mint.TransportError{reason: :timeout}} ->
|
||||
@@ -832,10 +806,10 @@ defmodule WandererApp.Esi.ApiClient do
|
||||
|
||||
defp handle_refresh_token_result(
|
||||
{:error, %OAuth2.Error{reason: :econnrefused} = error},
|
||||
character,
|
||||
_character,
|
||||
character_id,
|
||||
expires_at,
|
||||
scopes
|
||||
_scopes
|
||||
) do
|
||||
expires_at_datetime = DateTime.from_unix!(expires_at)
|
||||
time_since_expiry = DateTime.diff(DateTime.utc_now(), expires_at_datetime, :second)
|
||||
|
||||
@@ -393,9 +393,6 @@ defmodule WandererApp.EveDataService do
|
||||
end
|
||||
end
|
||||
|
||||
defp get_solar_system_name(solar_system_name, wormhole_class) do
|
||||
end
|
||||
|
||||
defp get_triglavian_data(default_data, triglavian_systems, solar_system_id) do
|
||||
case Enum.find(triglavian_systems, fn system -> system.solar_system_id == solar_system_id end) do
|
||||
nil ->
|
||||
@@ -414,7 +411,7 @@ defmodule WandererApp.EveDataService do
|
||||
defp get_security(security) do
|
||||
case security do
|
||||
nil -> {:ok, ""}
|
||||
_ -> {:ok, String.to_float(security) |> get_true_security() |> Float.to_string(decimals: 1)}
|
||||
_ -> {:ok, String.to_float(security) |> get_true_security() |> :erlang.float_to_binary(decimals: 1)}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -496,23 +493,23 @@ defmodule WandererApp.EveDataService do
|
||||
do: {:ok, 10_100}
|
||||
|
||||
defp get_wormhole_class_id(systems, region_id, constellation_id, solar_system_id) do
|
||||
with region <-
|
||||
Enum.find(systems, fn system ->
|
||||
system.location_id |> Integer.parse() |> elem(0) == region_id
|
||||
end),
|
||||
constellation <-
|
||||
Enum.find(systems, fn system ->
|
||||
system.location_id |> Integer.parse() |> elem(0) == constellation_id
|
||||
end),
|
||||
solar_system <-
|
||||
Enum.find(systems, fn system ->
|
||||
system.location_id |> Integer.parse() |> elem(0) == solar_system_id
|
||||
end),
|
||||
wormhole_class_id <- get_wormhole_class_id(region, constellation, solar_system) do
|
||||
{:ok, wormhole_class_id}
|
||||
else
|
||||
_ -> {:ok, -1}
|
||||
end
|
||||
region =
|
||||
Enum.find(systems, fn system ->
|
||||
system.location_id |> Integer.parse() |> elem(0) == region_id
|
||||
end)
|
||||
|
||||
constellation =
|
||||
Enum.find(systems, fn system ->
|
||||
system.location_id |> Integer.parse() |> elem(0) == constellation_id
|
||||
end)
|
||||
|
||||
solar_system =
|
||||
Enum.find(systems, fn system ->
|
||||
system.location_id |> Integer.parse() |> elem(0) == solar_system_id
|
||||
end)
|
||||
|
||||
wormhole_class_id = get_wormhole_class_id(region, constellation, solar_system)
|
||||
{:ok, wormhole_class_id}
|
||||
end
|
||||
|
||||
defp get_wormhole_class_id(_region, _constellation, solar_system)
|
||||
|
||||
@@ -178,6 +178,10 @@ defmodule WandererApp.ExternalEvents.Event do
|
||||
end
|
||||
end
|
||||
|
||||
defp serialize_payload(payload, visited) when is_map(payload) do
|
||||
Map.new(payload, fn {k, v} -> {to_string(k), serialize_value(v, visited)} end)
|
||||
end
|
||||
|
||||
# Get allowed fields based on struct type
|
||||
defp get_allowed_fields(module) do
|
||||
module_name = module |> Module.split() |> List.last()
|
||||
@@ -192,10 +196,6 @@ defmodule WandererApp.ExternalEvents.Event do
|
||||
end
|
||||
end
|
||||
|
||||
defp serialize_payload(payload, visited) when is_map(payload) do
|
||||
Map.new(payload, fn {k, v} -> {to_string(k), serialize_value(v, visited)} end)
|
||||
end
|
||||
|
||||
defp serialize_fields(fields, visited) do
|
||||
Enum.reduce(fields, %{}, fn {k, v}, acc ->
|
||||
if is_nil(v) do
|
||||
|
||||
@@ -182,7 +182,7 @@ defmodule WandererApp.Kills.Client do
|
||||
end
|
||||
|
||||
# Guard against duplicate disconnection events
|
||||
def handle_info({:disconnected, reason}, %{connected: false, connecting: false} = state) do
|
||||
def handle_info({:disconnected, _reason}, %{connected: false, connecting: false} = state) do
|
||||
{:noreply, state}
|
||||
end
|
||||
|
||||
@@ -566,7 +566,7 @@ defmodule WandererApp.Kills.Client do
|
||||
end
|
||||
end
|
||||
|
||||
defp check_health(%{socket_pid: pid} = state) do
|
||||
defp check_health(%{socket_pid: pid}) do
|
||||
if socket_alive?(pid) do
|
||||
:healthy
|
||||
else
|
||||
@@ -590,22 +590,6 @@ defmodule WandererApp.Kills.Client do
|
||||
Process.send_after(self(), :health_check, @health_check_interval)
|
||||
end
|
||||
|
||||
defp handle_connection_lost(%{connected: false} = _state) do
|
||||
Logger.debug("[Client] Connection already lost, skipping cleanup")
|
||||
end
|
||||
|
||||
defp handle_connection_lost(state) do
|
||||
Logger.warning("[Client] Connection lost, cleaning up and reconnecting")
|
||||
|
||||
# Clean up existing socket
|
||||
if state.socket_pid do
|
||||
disconnect_socket(state.socket_pid)
|
||||
end
|
||||
|
||||
# Reset state and trigger reconnection
|
||||
send(self(), {:disconnected, :connection_lost})
|
||||
end
|
||||
|
||||
# Handler module for WebSocket events
|
||||
defmodule Handler do
|
||||
@moduledoc """
|
||||
@@ -640,7 +624,7 @@ defmodule WandererApp.Kills.Client do
|
||||
}
|
||||
|
||||
case GenSocketClient.join(transport, "killmails:lobby", join_params) do
|
||||
{:ok, response} ->
|
||||
{:ok, _response} ->
|
||||
send(state.parent, {:connected, self()})
|
||||
# Reset disconnected flag on successful connection
|
||||
{:ok, %{state | disconnected: false}}
|
||||
|
||||
@@ -46,7 +46,7 @@ defmodule WandererApp.Kills.MapEventListener do
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_info(%{event: :map_server_started, payload: map_info}, state) do
|
||||
def handle_info(%{event: :map_server_started, payload: _map_info}, state) do
|
||||
{:noreply, schedule_subscription_update(state)}
|
||||
end
|
||||
|
||||
@@ -191,7 +191,7 @@ defmodule WandererApp.Kills.MapEventListener do
|
||||
# Client is not connected, retry with backoff
|
||||
schedule_retry_update(state)
|
||||
|
||||
error ->
|
||||
_error ->
|
||||
schedule_retry_update(state)
|
||||
end
|
||||
rescue
|
||||
|
||||
@@ -177,7 +177,7 @@ defmodule WandererApp.Map do
|
||||
end
|
||||
|
||||
def list_hubs(map_id, hubs) do
|
||||
{:ok, map} = map_id |> get_map()
|
||||
{:ok, _map} = map_id |> get_map()
|
||||
|
||||
{:ok, hubs}
|
||||
end
|
||||
@@ -315,7 +315,7 @@ defmodule WandererApp.Map do
|
||||
end
|
||||
end
|
||||
|
||||
def update_subscription_settings!(%{map_id: map_id} = map, %{
|
||||
def update_subscription_settings!(%{map_id: map_id} = _map, %{
|
||||
characters_limit: characters_limit,
|
||||
hubs_limit: hubs_limit
|
||||
}) do
|
||||
@@ -326,7 +326,7 @@ defmodule WandererApp.Map do
|
||||
|> get_map!()
|
||||
end
|
||||
|
||||
def update_options!(%{map_id: map_id} = map, options) do
|
||||
def update_options!(%{map_id: map_id} = _map, options) do
|
||||
map_id
|
||||
|> update_map(%{options: options})
|
||||
|
||||
|
||||
@@ -76,11 +76,6 @@ defmodule WandererApp.Map.Operations do
|
||||
{:ok, map()} | {:skip, :exists} | {:error, String.t()}
|
||||
defdelegate create_connection(map_id, attrs, char_id), to: Connections
|
||||
|
||||
@doc "Create a connection from a Plug.Conn"
|
||||
@spec create_connection(Plug.Conn.t(), map()) ::
|
||||
{:ok, :created} | {:skip, :exists} | {:error, atom()}
|
||||
defdelegate create_connection(conn, attrs), to: Connections
|
||||
|
||||
@doc "Update a connection"
|
||||
@spec update_connection(String.t(), String.t(), map()) ::
|
||||
{:ok, map()} | {:error, String.t()}
|
||||
|
||||
@@ -329,6 +329,9 @@ defmodule WandererApp.Map.MapPool do
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_call(:error, _, state), do: {:stop, :error, :ok, state}
|
||||
|
||||
defp do_start_map(map_id, %{map_ids: map_ids, uuid: uuid} = state) do
|
||||
if map_id in map_ids do
|
||||
# Map already started
|
||||
@@ -344,8 +347,6 @@ defmodule WandererApp.Map.MapPool do
|
||||
[map_id | r_map_ids]
|
||||
end)
|
||||
|
||||
completed_operations = [:registry | completed_operations]
|
||||
|
||||
case registry_result do
|
||||
{new_value, _old_value} when is_list(new_value) ->
|
||||
:ok
|
||||
@@ -363,13 +364,9 @@ defmodule WandererApp.Map.MapPool do
|
||||
raise "Failed to add to cache: #{inspect(reason)}"
|
||||
end
|
||||
|
||||
completed_operations = [:cache | completed_operations]
|
||||
|
||||
# Step 3: Start the map server using extracted helper
|
||||
do_initialize_map_server(map_id)
|
||||
|
||||
completed_operations = [:map_server | completed_operations]
|
||||
|
||||
# Step 4: Update GenServer state (last, as this is in-memory and fast)
|
||||
new_state = %{state | map_ids: [map_id | map_ids]}
|
||||
|
||||
@@ -445,8 +442,6 @@ defmodule WandererApp.Map.MapPool do
|
||||
r_map_ids |> Enum.reject(fn id -> id == map_id end)
|
||||
end)
|
||||
|
||||
completed_operations = [:registry | completed_operations]
|
||||
|
||||
case registry_result do
|
||||
{new_value, _old_value} when is_list(new_value) ->
|
||||
:ok
|
||||
@@ -464,14 +459,10 @@ defmodule WandererApp.Map.MapPool do
|
||||
raise "Failed to delete from cache: #{inspect(reason)}"
|
||||
end
|
||||
|
||||
completed_operations = [:cache | completed_operations]
|
||||
|
||||
# Step 3: Stop the map server (clean up all map resources)
|
||||
map_id
|
||||
|> Server.Impl.stop_map()
|
||||
|
||||
completed_operations = [:map_server | completed_operations]
|
||||
|
||||
# Step 4: Update GenServer state (last, as this is in-memory and fast)
|
||||
new_state = %{state | map_ids: map_ids |> Enum.reject(fn id -> id == map_id end)}
|
||||
|
||||
@@ -560,9 +551,6 @@ defmodule WandererApp.Map.MapPool do
|
||||
# and the cleanup operations are safe to leave in a "stopped" state
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_call(:error, _, state), do: {:stop, :error, :ok, state}
|
||||
|
||||
@impl true
|
||||
def handle_info(:backup_state, %{map_ids: map_ids, uuid: uuid} = state) do
|
||||
Process.send_after(self(), :backup_state, @backup_state_timeout)
|
||||
|
||||
@@ -180,14 +180,4 @@ defmodule WandererApp.Map.MapPoolDynamicSupervisor do
|
||||
end
|
||||
end
|
||||
|
||||
defp stop_child(uuid) do
|
||||
case Registry.lookup(@registry, uuid) do
|
||||
[{pid, _}] ->
|
||||
GenServer.cast(pid, :stop)
|
||||
|
||||
_ ->
|
||||
Logger.warn("Unable to locate pool assigned to #{inspect(uuid)}")
|
||||
:ok
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -77,7 +77,7 @@ defmodule WandererApp.Map.Routes do
|
||||
end
|
||||
end
|
||||
|
||||
def find(_map_id, hubs, origin, routes_settings, true) do
|
||||
def find(_map_id, hubs, origin, _routes_settings, true) do
|
||||
origin = origin |> String.to_integer()
|
||||
hubs = hubs |> Enum.map(&(&1 |> String.to_integer()))
|
||||
|
||||
|
||||
@@ -93,10 +93,8 @@ defmodule WandererApp.Map.Operations.Connections do
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
Determines the ship size for a connection, applying wormhole‑specific rules
|
||||
for C1, C13, and C4⇄NS links, falling back to the caller’s provided size or Large.
|
||||
"""
|
||||
# Determines the ship size for a connection, applying wormhole-specific rules
|
||||
# for C1, C13, and C4⇄NS links, falling back to the caller's provided size or Large.
|
||||
defp resolve_ship_size(type_val, ship_size_val, src_info, tgt_info) do
|
||||
case parse_type(type_val) do
|
||||
@connection_type_wormhole ->
|
||||
|
||||
@@ -12,7 +12,6 @@ defmodule WandererApp.Map.Operations.Duplication do
|
||||
"""
|
||||
|
||||
require Logger
|
||||
import Ash.Query, only: [filter: 2]
|
||||
|
||||
alias WandererApp.Api
|
||||
alias WandererApp.Api.{MapSystem, MapConnection, MapSystemSignature, MapCharacterSettings}
|
||||
|
||||
@@ -100,7 +100,7 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do
|
||||
|
||||
@connection_type_wormhole 0
|
||||
@connection_type_stargate 1
|
||||
@connection_type_bridge 2
|
||||
# @connection_type_bridge 2 # reserved for future use
|
||||
@medium_ship_size 1
|
||||
|
||||
def get_connection_auto_expire_hours(), do: WandererApp.Env.map_connection_auto_expire_hours()
|
||||
@@ -403,7 +403,7 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do
|
||||
time_status: time_status,
|
||||
solar_system_source: solar_system_source,
|
||||
solar_system_target: solar_system_target
|
||||
} = updated_connection
|
||||
} = _updated_connection
|
||||
) do
|
||||
with source_system when not is_nil(source_system) <-
|
||||
WandererApp.Map.find_system_by_location(
|
||||
@@ -909,9 +909,6 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do
|
||||
end
|
||||
end
|
||||
|
||||
defp get_time_status(_source_solar_system_id, _target_solar_system_id, _ship_size_type),
|
||||
do: @connection_time_status_default
|
||||
|
||||
defp get_new_time_status(_start_time, @connection_time_status_default),
|
||||
do: @connection_time_status_eol_24
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ defmodule WandererApp.Map.Server.Impl do
|
||||
Logger.error("Cannot start map #{map_id}: map not loaded")
|
||||
{:error, :map_not_loaded}
|
||||
|
||||
map ->
|
||||
_map ->
|
||||
with :ok <- AclsImpl.track_acls(acls |> Enum.map(& &1.access_list_id)) do
|
||||
@pubsub_client.subscribe(
|
||||
WandererApp.PubSub,
|
||||
|
||||
@@ -5,7 +5,7 @@ defmodule WandererApp.Map.Server.PingsImpl do
|
||||
|
||||
alias WandererApp.Map.Server.Impl
|
||||
|
||||
@ping_auto_expire_timeout :timer.minutes(15)
|
||||
# @ping_auto_expire_timeout :timer.minutes(15) # reserved for future use
|
||||
|
||||
def add_ping(
|
||||
map_id,
|
||||
|
||||
@@ -129,8 +129,8 @@ defmodule WandererApp.Map.Server.SystemsImpl do
|
||||
def remove_system_comment(
|
||||
map_id,
|
||||
comment_id,
|
||||
user_id,
|
||||
character_id
|
||||
_user_id,
|
||||
_character_id
|
||||
) do
|
||||
{:ok, %{system_id: system_id} = comment} =
|
||||
WandererApp.MapSystemCommentRepo.get_by_id(comment_id)
|
||||
@@ -309,7 +309,7 @@ defmodule WandererApp.Map.Server.SystemsImpl do
|
||||
map_id
|
||||
|> WandererApp.MapSystemRepo.remove_from_map(solar_system_id)
|
||||
|> case do
|
||||
{:ok, result} ->
|
||||
{:ok, _result} ->
|
||||
:ok = WandererApp.Map.remove_system(map_id, solar_system_id)
|
||||
@ddrt.delete([solar_system_id], "rtree_#{map_id}")
|
||||
Impl.broadcast!(map_id, :systems_removed, [solar_system_id])
|
||||
@@ -863,10 +863,8 @@ defmodule WandererApp.Map.Server.SystemsImpl do
|
||||
updated_system
|
||||
end
|
||||
|
||||
defp maybe_update_labels(system, _labels), do: system
|
||||
|
||||
defp maybe_update_labels(
|
||||
%{name: old_labels} = system,
|
||||
%{labels: old_labels} = system,
|
||||
labels
|
||||
)
|
||||
when not is_nil(labels) and old_labels != labels do
|
||||
|
||||
@@ -128,7 +128,7 @@ defmodule WandererApp.Maps do
|
||||
tracked: tracked
|
||||
}
|
||||
|
||||
defp get_map_characters(%{id: map_id} = map) do
|
||||
defp get_map_characters(%{id: map_id} = _map) do
|
||||
WandererApp.Cache.lookup!("map_characters-#{map_id}")
|
||||
|> case do
|
||||
nil ->
|
||||
|
||||
@@ -99,7 +99,7 @@ defmodule WandererApp.MapConnectionRepo do
|
||||
def get_by_id(map_id, id) do
|
||||
# Use read_by_map action which doesn't have the FilterConnectionsByActorMap preparation
|
||||
# that was causing "filter being false" errors in tests
|
||||
import Ash.Query
|
||||
require Ash.Query
|
||||
|
||||
WandererApp.Api.MapConnection
|
||||
|> Ash.Query.for_read(:read_by_map, %{map_id: map_id})
|
||||
|
||||
@@ -38,6 +38,4 @@ defmodule WandererApp.MapPingsRepo do
|
||||
|
||||
:ok
|
||||
end
|
||||
|
||||
def destroy(_ping_id), do: :ok
|
||||
end
|
||||
|
||||
@@ -84,7 +84,7 @@ defmodule WandererApp.MapRepo do
|
||||
end
|
||||
end
|
||||
|
||||
error in Ash.Error.Query.NotFound ->
|
||||
_error in Ash.Error.Query.NotFound ->
|
||||
Logger.debug("Map not found with slug: #{slug}")
|
||||
{:error, :not_found}
|
||||
|
||||
|
||||
@@ -487,15 +487,6 @@ defmodule WandererApp.SecurityAudit do
|
||||
|
||||
# Private functions
|
||||
|
||||
defp store_audit_entry(_audit_entry) do
|
||||
# Handle async processing if enabled
|
||||
# if async_enabled?() do
|
||||
# WandererApp.SecurityAudit.AsyncProcessor.log_event(audit_entry)
|
||||
# else
|
||||
# do_store_audit_entry(audit_entry)
|
||||
# end
|
||||
end
|
||||
|
||||
@doc false
|
||||
def do_store_audit_entry(audit_entry) do
|
||||
# Ensure event_type is properly formatted
|
||||
@@ -631,11 +622,6 @@ defmodule WandererApp.SecurityAudit do
|
||||
end
|
||||
end
|
||||
|
||||
defp async_enabled? do
|
||||
Application.get_env(:wanderer_app, __MODULE__, [])
|
||||
|> Keyword.get(:async, false)
|
||||
end
|
||||
|
||||
defp emit_telemetry_event(audit_entry) do
|
||||
:telemetry.execute(
|
||||
[:wanderer_app, :security_audit],
|
||||
|
||||
@@ -5,7 +5,11 @@ defmodule WandererApp.Test.Logger do
|
||||
"""
|
||||
|
||||
@callback info(message :: iodata() | (-> iodata())) :: :ok
|
||||
@callback info(message :: iodata() | (-> iodata()), metadata :: keyword()) :: :ok
|
||||
@callback error(message :: iodata() | (-> iodata())) :: :ok
|
||||
@callback error(message :: iodata() | (-> iodata()), metadata :: keyword()) :: :ok
|
||||
@callback warning(message :: iodata() | (-> iodata())) :: :ok
|
||||
@callback warning(message :: iodata() | (-> iodata()), metadata :: keyword()) :: :ok
|
||||
@callback debug(message :: iodata() | (-> iodata())) :: :ok
|
||||
@callback debug(message :: iodata() | (-> iodata()), metadata :: keyword()) :: :ok
|
||||
end
|
||||
|
||||
@@ -9,12 +9,24 @@ defmodule WandererApp.Test.LoggerStub do
|
||||
@impl true
|
||||
def info(_message), do: :ok
|
||||
|
||||
@impl true
|
||||
def info(_message, _metadata), do: :ok
|
||||
|
||||
@impl true
|
||||
def error(_message), do: :ok
|
||||
|
||||
@impl true
|
||||
def error(_message, _metadata), do: :ok
|
||||
|
||||
@impl true
|
||||
def warning(_message), do: :ok
|
||||
|
||||
@impl true
|
||||
def warning(_message, _metadata), do: :ok
|
||||
|
||||
@impl true
|
||||
def debug(_message), do: :ok
|
||||
|
||||
@impl true
|
||||
def debug(_message, _metadata), do: :ok
|
||||
end
|
||||
|
||||
@@ -124,7 +124,7 @@ defmodule WandererApp.Vault do
|
||||
end)
|
||||
end
|
||||
|
||||
defp find_fallback_module_to_decrypt(config, ciphertext) do
|
||||
defp find_fallback_module_to_decrypt(config, _ciphertext) do
|
||||
Enum.find(config[:ciphers], fn {label, _} ->
|
||||
label == :fallback
|
||||
end)
|
||||
|
||||
@@ -12,7 +12,6 @@ defmodule WandererAppWeb.ApiRouter do
|
||||
"""
|
||||
|
||||
use Phoenix.Router
|
||||
import WandererAppWeb.ApiRouterHelpers
|
||||
alias WandererAppWeb.{ApiRoutes, ApiRouter.RouteSpec}
|
||||
require Logger
|
||||
|
||||
@@ -171,7 +170,7 @@ defmodule WandererAppWeb.ApiRouter do
|
||||
|> halt()
|
||||
end
|
||||
|
||||
defp find_similar_routes(path_info, version) do
|
||||
defp find_similar_routes(path_info, _version) do
|
||||
# Find routes with similar paths in current or other versions
|
||||
all_routes = ApiRoutes.table()
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
defmodule WandererAppWeb.ApiSpec do
|
||||
@behaviour OpenApiSpex.OpenApi
|
||||
|
||||
alias OpenApiSpex.{OpenApi, Info, Paths, Components, SecurityScheme, Server, Schema}
|
||||
alias OpenApiSpex.{OpenApi, Info, Paths, Components, SecurityScheme, Server}
|
||||
alias WandererAppWeb.{Endpoint, Router}
|
||||
alias WandererAppWeb.Schemas.ApiSchemas
|
||||
|
||||
|
||||
@@ -284,6 +284,7 @@ defmodule WandererAppWeb.CoreComponents do
|
||||
"""
|
||||
attr(:type, :string, default: nil)
|
||||
attr(:class, :string, default: nil)
|
||||
attr(:data, :any, default: nil)
|
||||
attr(:rest, :global, include: ~w(disabled form name value))
|
||||
|
||||
slot(:inner_block, required: true)
|
||||
@@ -296,6 +297,7 @@ defmodule WandererAppWeb.CoreComponents do
|
||||
"phx-submit-loading:opacity-75 p-button p-component p-button-outlined p-button-sm",
|
||||
@class
|
||||
]}
|
||||
data={@data}
|
||||
{@rest}
|
||||
>
|
||||
{render_slot(@inner_block)}
|
||||
@@ -614,7 +616,7 @@ defmodule WandererAppWeb.CoreComponents do
|
||||
attr(:empty_label, :string, default: nil)
|
||||
attr(:rows, :list, required: true)
|
||||
attr(:row_id, :any, default: nil, doc: "the function for generating the row id")
|
||||
attr(:row_selected, :boolean, default: false, doc: "the function for generating the row id")
|
||||
attr(:row_selected, :any, default: false, doc: "the function for generating the row id")
|
||||
attr(:row_click, :any, default: nil, doc: "the function for handling phx-click on each row")
|
||||
|
||||
attr(:row_item, :any,
|
||||
@@ -703,13 +705,21 @@ defmodule WandererAppWeb.CoreComponents do
|
||||
"""
|
||||
end
|
||||
|
||||
attr(:field, :any, required: true)
|
||||
attr(:placeholder, :string, default: nil)
|
||||
attr(:label, :string, default: nil)
|
||||
attr(:label_class, :string, default: nil)
|
||||
attr(:input_class, :string, default: nil)
|
||||
attr(:dropdown_extra_class, :string, default: nil)
|
||||
attr(:option_extra_class, :string, default: nil)
|
||||
attr(:mode, :atom, default: nil)
|
||||
attr(:options, :list, default: [])
|
||||
attr(:debounce, :integer, default: nil)
|
||||
attr(:update_min_len, :integer, default: nil)
|
||||
attr(:available_option_class, :string, default: nil)
|
||||
attr(:value_mapper, :any, default: nil)
|
||||
slot(:inner_block)
|
||||
slot(:option)
|
||||
|
||||
def live_select(%{field: %Phoenix.HTML.FormField{} = field} = assigns) do
|
||||
assigns =
|
||||
|
||||
@@ -123,11 +123,6 @@ defmodule WandererAppWeb.LicenseApiController do
|
||||
end
|
||||
end
|
||||
|
||||
def update_validity(conn, %{"id" => _license_id}) do
|
||||
conn
|
||||
|> put_status(:bad_request)
|
||||
|> json(%{error: "Missing required parameter: is_valid"})
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a license's expiration date.
|
||||
|
||||
@@ -2,12 +2,10 @@ defmodule WandererAppWeb.MapAPIController do
|
||||
use WandererAppWeb, :controller
|
||||
use OpenApiSpex.ControllerSpecs
|
||||
|
||||
import Ash.Query, only: [filter: 2]
|
||||
require Ash.Query
|
||||
require Logger
|
||||
|
||||
alias WandererApp.Api.Character
|
||||
alias WandererApp.MapSystemRepo
|
||||
alias WandererApp.MapCharacterSettingsRepo
|
||||
alias WandererApp.MapConnectionRepo
|
||||
alias WandererAppWeb.Helpers.APIUtils
|
||||
alias WandererAppWeb.Schemas.{ApiSchemas, ResponseSchemas}
|
||||
@@ -16,7 +14,7 @@ defmodule WandererAppWeb.MapAPIController do
|
||||
# V1 API Actions (for compatibility with versioned API router)
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
def index_v1(conn, params) do
|
||||
def index_v1(conn, _params) do
|
||||
# Delegate to the existing list implementation or create a basic one
|
||||
json(conn, %{
|
||||
data: [],
|
||||
@@ -43,7 +41,7 @@ defmodule WandererAppWeb.MapAPIController do
|
||||
})
|
||||
end
|
||||
|
||||
def create_v1(conn, params) do
|
||||
def create_v1(conn, _params) do
|
||||
# Basic create implementation for testing
|
||||
json(conn, %{
|
||||
data: %{
|
||||
@@ -59,7 +57,7 @@ defmodule WandererAppWeb.MapAPIController do
|
||||
})
|
||||
end
|
||||
|
||||
def update_v1(conn, %{"id" => id} = params) do
|
||||
def update_v1(conn, %{"id" => id} = _params) do
|
||||
# Basic update implementation for testing
|
||||
json(conn, %{
|
||||
data: %{
|
||||
@@ -82,7 +80,7 @@ defmodule WandererAppWeb.MapAPIController do
|
||||
|> text("")
|
||||
end
|
||||
|
||||
def duplicate_v1(conn, %{"id" => id} = params) do
|
||||
def duplicate_v1(conn, %{"id" => id} = _params) do
|
||||
# Basic duplicate implementation for testing
|
||||
json(conn, %{
|
||||
data: %{
|
||||
@@ -99,7 +97,7 @@ defmodule WandererAppWeb.MapAPIController do
|
||||
})
|
||||
end
|
||||
|
||||
def bulk_create_v1(conn, params) do
|
||||
def bulk_create_v1(conn, _params) do
|
||||
# Basic bulk create implementation for testing
|
||||
json(conn, %{
|
||||
data: [
|
||||
@@ -121,7 +119,7 @@ defmodule WandererAppWeb.MapAPIController do
|
||||
})
|
||||
end
|
||||
|
||||
def bulk_update_v1(conn, params) do
|
||||
def bulk_update_v1(conn, _params) do
|
||||
# Basic bulk update implementation for testing
|
||||
json(conn, %{
|
||||
data: [
|
||||
@@ -325,13 +323,6 @@ defmodule WandererAppWeb.MapAPIController do
|
||||
# Helper functions for the API controller
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
defp get_map_id_by_slug(slug) do
|
||||
case WandererApp.Api.Map.get_map_by_slug(slug) do
|
||||
{:ok, map} -> {:ok, map.id}
|
||||
{:error, error} -> {:error, "Map not found for slug: #{slug}, error: #{inspect(error)}"}
|
||||
end
|
||||
end
|
||||
|
||||
defp normalize_map_identifier(params) do
|
||||
case Map.get(params, "map_identifier") do
|
||||
nil ->
|
||||
|
||||
@@ -4,8 +4,6 @@ defmodule WandererAppWeb.MapAuditAPIController do
|
||||
|
||||
require Logger
|
||||
|
||||
alias WandererApp.Api
|
||||
|
||||
alias WandererAppWeb.Helpers.APIUtils
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
@@ -65,24 +65,6 @@ defmodule WandererAppWeb.MapEventsAPIController do
|
||||
items: @event_schema
|
||||
})
|
||||
|
||||
@events_list_params %OpenApiSpex.Schema{
|
||||
type: :object,
|
||||
properties: %{
|
||||
since: %OpenApiSpex.Schema{
|
||||
type: :string,
|
||||
format: :date_time,
|
||||
description: "Return events after this timestamp (ISO8601)"
|
||||
},
|
||||
limit: %OpenApiSpex.Schema{
|
||||
type: :integer,
|
||||
minimum: 1,
|
||||
maximum: 100,
|
||||
default: 100,
|
||||
description: "Maximum number of events to return"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# OpenApiSpex Operations
|
||||
# -----------------------------------------------------------------
|
||||
@@ -173,7 +155,7 @@ defmodule WandererAppWeb.MapEventsAPIController do
|
||||
|> put_status(:bad_request)
|
||||
|> json(%{error: "Invalid 'limit' parameter. Must be between 1 and 100."})
|
||||
|
||||
{:error, reason} ->
|
||||
{:error, _reason} ->
|
||||
conn
|
||||
|> put_status(:internal_server_error)
|
||||
|> json(%{error: "Internal server error"})
|
||||
@@ -184,7 +166,7 @@ defmodule WandererAppWeb.MapEventsAPIController do
|
||||
# Private Functions
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
defp get_map(conn, map_identifier) do
|
||||
defp get_map(conn, _map_identifier) do
|
||||
# The map should already be loaded by the CheckMapApiKey plug
|
||||
case conn.assigns[:map] do
|
||||
nil -> {:error, :map_not_found}
|
||||
|
||||
@@ -36,7 +36,7 @@ defmodule WandererAppWeb.Plugs.JsonApiPerformanceMonitor do
|
||||
conn
|
||||
|> register_before_send(fn conn ->
|
||||
end_time = System.monotonic_time(:millisecond)
|
||||
duration = end_time - start_time
|
||||
_duration = end_time - start_time
|
||||
|
||||
# Extract response metadata
|
||||
response_metadata = extract_response_metadata(conn, request_metadata)
|
||||
|
||||
@@ -12,7 +12,6 @@ defmodule WandererAppWeb.Plugs.LicenseAuth do
|
||||
require Logger
|
||||
|
||||
alias WandererApp.License.LicenseManager
|
||||
alias WandererApp.Helpers.Config
|
||||
|
||||
@doc """
|
||||
Authenticates requests using the LM_AUTH_KEY.
|
||||
@@ -21,7 +20,7 @@ defmodule WandererAppWeb.Plugs.LicenseAuth do
|
||||
"""
|
||||
def authenticate_lm(conn, _opts) do
|
||||
auth_header = get_req_header(conn, "authorization")
|
||||
lm_auth_key = Config.get_env(:wanderer_app, :lm_auth_key)
|
||||
lm_auth_key = Application.get_env(:wanderer_app, :lm_auth_key)
|
||||
|
||||
case auth_header do
|
||||
["Bearer " <> token] ->
|
||||
|
||||
@@ -37,7 +37,7 @@ defmodule WandererAppWeb.UserAuth do
|
||||
nil ->
|
||||
{:halt, redirect_require_login(socket)}
|
||||
|
||||
%User{characters: characters} ->
|
||||
%User{characters: _characters} ->
|
||||
{:cont, new_socket}
|
||||
end
|
||||
|
||||
@@ -112,13 +112,6 @@ defmodule WandererAppWeb.UserAuth do
|
||||
|> LiveView.redirect(to: ~p"/")
|
||||
end
|
||||
|
||||
defp track_characters([]), do: :ok
|
||||
|
||||
defp track_characters([%{id: character_id} | characters]) do
|
||||
:ok = WandererApp.Character.TrackerManager.start_tracking(character_id)
|
||||
track_characters(characters)
|
||||
end
|
||||
|
||||
defp maybe_store_return_to(%{method: "GET"} = conn) do
|
||||
%{request_path: request_path, query_string: query_string} = conn
|
||||
return_to = if query_string == "", do: request_path, else: request_path <> "?" <> query_string
|
||||
|
||||
@@ -688,7 +688,7 @@ defmodule WandererAppWeb.AccessListsLive do
|
||||
"""
|
||||
end
|
||||
|
||||
slot(:option)
|
||||
attr(:option, :any, required: true)
|
||||
|
||||
def search_member_item(assigns) do
|
||||
~H"""
|
||||
|
||||
@@ -115,13 +115,20 @@
|
||||
</div>
|
||||
</div>
|
||||
<.link
|
||||
disabled={@selected_acl_id == "" or not can_add_members?(@access_list, @current_user)}
|
||||
:if={@selected_acl_id != "" and can_add_members?(@access_list, @current_user)}
|
||||
class="btn mt-2 w-full btn-neutral rounded-none"
|
||||
patch={~p"/access-lists/#{@selected_acl_id}/add-members"}
|
||||
>
|
||||
<.icon name="hero-plus-solid" class="w-6 h-6" />
|
||||
<h3 class="card-title text-center text-md">Add Members</h3>
|
||||
</.link>
|
||||
<div
|
||||
:if={@selected_acl_id == "" or not can_add_members?(@access_list, @current_user)}
|
||||
class="btn mt-2 w-full btn-neutral rounded-none btn-disabled"
|
||||
>
|
||||
<.icon name="hero-plus-solid" class="w-6 h-6" />
|
||||
<h3 class="card-title text-center text-md">Add Members</h3>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
@@ -4,8 +4,6 @@ defmodule WandererAppWeb.AdminLive do
|
||||
require Logger
|
||||
alias BetterNumber, as: Number
|
||||
|
||||
@invite_link_ttl :timer.hours(24)
|
||||
|
||||
def mount(_params, %{"user_id" => user_id} = _session, socket)
|
||||
when not is_nil(user_id) do
|
||||
WandererApp.StartCorpWalletTrackerTask.maybe_start_corp_wallet_tracker(
|
||||
|
||||
@@ -209,7 +209,7 @@
|
||||
rows={@transactions}
|
||||
class="!max-h-[40vh] !overflow-y-auto"
|
||||
>
|
||||
<:col :let={transaction}>
|
||||
<:col :let={_transaction}>
|
||||
<div class=" text-22">
|
||||
<.icon name="hero-credit-card-solid" class="h-5 w-5" />
|
||||
</div>
|
||||
@@ -267,7 +267,7 @@
|
||||
rows={@active_map_subscriptions}
|
||||
class="!max-h-[40vh] !overflow-y-auto"
|
||||
>
|
||||
<:col :let={subscription}>
|
||||
<:col :let={_subscription}>
|
||||
<div class=" text-22">
|
||||
<.icon name="hero-check-badge-solid" class="w-5 h-5" />
|
||||
</div>
|
||||
|
||||
@@ -18,13 +18,6 @@ defmodule WandererAppWeb.CharactersTrackingLive do
|
||||
)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok,
|
||||
socket
|
||||
|> assign(characters: [], selected_map: nil, maps: [])}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_params(params, _url, socket) do
|
||||
{:noreply, apply_action(socket, socket.assigns.live_action, params)}
|
||||
|
||||
@@ -79,7 +79,7 @@ defmodule WandererAppWeb.MapSubscription do
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
defp get_title(%{plan: plan, auto_renew?: auto_renew?, active_till: active_till} = subscription) do
|
||||
defp get_title(%{plan: plan, auto_renew?: auto_renew?, active_till: active_till}) do
|
||||
if plan != :alpha do
|
||||
"Active subscription: omega \nActive till: #{Calendar.strftime(active_till, "%m/%d/%Y")} \nAuto renew: #{auto_renew?}"
|
||||
else
|
||||
|
||||
@@ -300,13 +300,13 @@ defmodule WandererAppWeb.MapCharactersEventHandler do
|
||||
%{"character_eve_id" => character_eve_id},
|
||||
%{
|
||||
assigns: %{
|
||||
map_id: map_id,
|
||||
current_user: %{id: current_user_id}
|
||||
map_id: _map_id,
|
||||
current_user: %{id: _current_user_id}
|
||||
}
|
||||
} = socket
|
||||
)
|
||||
when not is_nil(character_eve_id) do
|
||||
{:ok, character} = WandererApp.Character.get_by_eve_id("#{character_eve_id}")
|
||||
{:ok, _character} = WandererApp.Character.get_by_eve_id("#{character_eve_id}")
|
||||
|
||||
{:noreply, socket}
|
||||
end
|
||||
@@ -338,12 +338,6 @@ defmodule WandererAppWeb.MapCharactersEventHandler do
|
||||
station_id: character.station_id
|
||||
}
|
||||
|
||||
defp get_map_with_acls(map_id) do
|
||||
with {:ok, map} <- WandererApp.Api.Map.by_id(map_id) do
|
||||
{:ok, Ash.load!(map, :acls)}
|
||||
end
|
||||
end
|
||||
|
||||
def needs_tracking_setup?(
|
||||
only_tracked_characters,
|
||||
characters,
|
||||
|
||||
@@ -11,7 +11,7 @@ defmodule WandererAppWeb.MapKillsEventHandler do
|
||||
|
||||
def handle_server_event(
|
||||
%{event: :init_kills},
|
||||
%{assigns: %{map_id: map_id} = assigns} = socket
|
||||
%{assigns: %{map_id: map_id} = _assigns} = socket
|
||||
) do
|
||||
# Get kill counts from cache
|
||||
case WandererApp.Map.get_map(map_id) do
|
||||
|
||||
@@ -3,7 +3,7 @@ defmodule WandererAppWeb.MapRoutesEventHandler do
|
||||
use Phoenix.Component
|
||||
require Logger
|
||||
|
||||
alias WandererAppWeb.{MapEventHandler, MapCoreEventHandler, MapSystemsEventHandler}
|
||||
alias WandererAppWeb.{MapEventHandler, MapCoreEventHandler}
|
||||
|
||||
def handle_server_event(
|
||||
%{
|
||||
|
||||
@@ -168,7 +168,7 @@ defmodule WandererAppWeb.MapSignaturesEventHandler do
|
||||
current_user: %{id: current_user_id},
|
||||
map_id: map_id,
|
||||
main_character_id: main_character_id,
|
||||
map_user_settings: map_user_settings,
|
||||
map_user_settings: _map_user_settings,
|
||||
user_permissions: %{update_system: true}
|
||||
} = assigns
|
||||
} = socket
|
||||
@@ -380,7 +380,7 @@ defmodule WandererAppWeb.MapSignaturesEventHandler do
|
||||
|
||||
def handle_ui_event(
|
||||
"undo_delete_signatures",
|
||||
%{"system_id" => solar_system_id, "eve_ids" => eve_ids} = payload,
|
||||
%{"system_id" => solar_system_id, "eve_ids" => eve_ids} = _payload,
|
||||
%{
|
||||
assigns: %{
|
||||
map_id: map_id,
|
||||
|
||||
@@ -97,7 +97,7 @@ defmodule WandererAppWeb.MapSystemCommentsEventHandler do
|
||||
%{"solarSystemId" => solar_system_id} = _event,
|
||||
%{
|
||||
assigns: %{
|
||||
current_user: current_user,
|
||||
current_user: _current_user,
|
||||
has_tracked_characters?: true,
|
||||
map_id: map_id,
|
||||
user_permissions: %{add_system: true}
|
||||
@@ -109,7 +109,7 @@ defmodule WandererAppWeb.MapSystemCommentsEventHandler do
|
||||
solar_system_id: solar_system_id
|
||||
})
|
||||
|> case do
|
||||
%{id: system_id} = system when not is_nil(system_id) ->
|
||||
%{id: system_id} = _system when not is_nil(system_id) ->
|
||||
{:ok, comments} = WandererApp.MapSystemCommentRepo.get_by_system(system_id)
|
||||
|
||||
{:reply,
|
||||
|
||||
@@ -5,8 +5,6 @@ defmodule WandererAppWeb.MapAuditLive do
|
||||
|
||||
alias WandererAppWeb.UserActivity
|
||||
|
||||
@active_subscription_periods ["2M", "3M"]
|
||||
|
||||
def mount(
|
||||
%{"slug" => map_slug, "period" => period, "activity" => activity} = _params,
|
||||
_session,
|
||||
|
||||
@@ -157,7 +157,7 @@ defmodule WandererAppWeb.MapCharactersLive do
|
||||
|> assign(:groups, groups)
|
||||
end
|
||||
|
||||
defp map_ui_character(map_id, character) do
|
||||
defp map_ui_character(_map_id, character) do
|
||||
character
|
||||
|> Map.take([
|
||||
:id,
|
||||
|
||||
@@ -230,6 +230,7 @@ defmodule WandererAppWeb.MapEventHandler do
|
||||
def handle_event(socket, {:DOWN, ref, :process, _pid, reason}) when is_reference(ref) do
|
||||
# Task failed, log the error and update the client
|
||||
Logger.error("Task failed: #{inspect(reason)}")
|
||||
socket
|
||||
end
|
||||
|
||||
def handle_event(socket, event),
|
||||
|
||||
@@ -112,13 +112,6 @@ defmodule WandererAppWeb.MapLive do
|
||||
|> WandererAppWeb.MapEventHandler.handle_event(info)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_info(info, socket),
|
||||
do:
|
||||
{:noreply,
|
||||
socket
|
||||
|> WandererAppWeb.MapEventHandler.handle_event(info)}
|
||||
|
||||
@impl true
|
||||
def handle_event("change_subscription_tab", %{"tab" => tab}, socket),
|
||||
do: {:noreply, socket |> assign(active_subscription_tab: tab)}
|
||||
|
||||
@@ -5,7 +5,6 @@ defmodule WandererAppWeb.Maps.MapBalanceComponent do
|
||||
require Logger
|
||||
|
||||
alias BetterNumber, as: Number
|
||||
alias WandererApp.License.LicenseManager
|
||||
|
||||
@impl true
|
||||
def mount(socket) do
|
||||
@@ -99,7 +98,7 @@ defmodule WandererAppWeb.Maps.MapBalanceComponent do
|
||||
type: :in
|
||||
})
|
||||
|
||||
{:ok, user} =
|
||||
{:ok, _user} =
|
||||
user
|
||||
|> WandererApp.Api.User.update_balance(%{
|
||||
balance: (user_balance || 0.0) - amount
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
rows={@transactions}
|
||||
class="!max-h-[40vh] !overflow-y-auto"
|
||||
>
|
||||
<:col :let={transaction}>
|
||||
<:col :let={_transaction}>
|
||||
<div class=" text-22">
|
||||
<.icon name="hero-credit-card-solid" class="h-5 w-5" />
|
||||
</div>
|
||||
@@ -145,7 +145,7 @@
|
||||
rows={@invoices}
|
||||
class="!max-h-[40vh] !overflow-y-auto"
|
||||
>
|
||||
<:col :let={invoice}>
|
||||
<:col :let={_invoice}>
|
||||
<div class=" text-22">
|
||||
Map subscription
|
||||
</div>
|
||||
|
||||
@@ -5,8 +5,6 @@ defmodule WandererAppWeb.OpenApiV1Spec do
|
||||
|
||||
@behaviour OpenApiSpex.OpenApi
|
||||
|
||||
alias OpenApiSpex.{OpenApi, Info, Server, Components}
|
||||
|
||||
@impl OpenApiSpex.OpenApi
|
||||
def spec do
|
||||
# This is called by the modify_open_api option in the router
|
||||
|
||||
@@ -220,7 +220,7 @@ defmodule WandererAppWeb.Plugs.RequestValidator do
|
||||
|
||||
defp validate_params(_params, _max_length, _max_depth, _current_depth), do: :ok
|
||||
|
||||
defp validate_param_value(key, value, max_length, max_depth, current_depth)
|
||||
defp validate_param_value(key, value, max_length, _max_depth, _current_depth)
|
||||
when is_binary(value) do
|
||||
cond do
|
||||
String.length(value) > max_length ->
|
||||
|
||||
@@ -94,7 +94,7 @@ defmodule WandererAppWeb.Plugs.ResponseSanitizer do
|
||||
case Application.get_env(:wanderer_app, :environment) do
|
||||
:dev ->
|
||||
nonce = generate_nonce()
|
||||
conn = put_private(conn, :csp_nonce, nonce)
|
||||
_conn = put_private(conn, :csp_nonce, nonce)
|
||||
|
||||
base_policy
|
||||
|> Enum.map(fn directive ->
|
||||
|
||||
@@ -170,9 +170,7 @@ defmodule WandererAppWeb.ApiCase do
|
||||
|> Plug.Conn.put_req_header("content-type", "application/vnd.api+json")
|
||||
end
|
||||
|
||||
@doc """
|
||||
Creates an active subscription for a map to bypass subscription checks in tests.
|
||||
"""
|
||||
# Creates an active subscription for a map to bypass subscription checks in tests.
|
||||
defp create_active_subscription_for_map(map_id) do
|
||||
# Create a subscription with a non-alpha plan (status defaults to :active)
|
||||
{:ok, _subscription} =
|
||||
|
||||
@@ -91,13 +91,6 @@ defmodule WandererApp.Test.DatabaseAccessManager do
|
||||
end)
|
||||
end
|
||||
|
||||
defp setup_child_process_monitoring(parent_pid, owner_pid) do
|
||||
spawn_link(fn ->
|
||||
Process.monitor(parent_pid)
|
||||
monitor_for_new_processes(parent_pid, owner_pid, get_process_children(parent_pid))
|
||||
end)
|
||||
end
|
||||
|
||||
defp grant_access_to_linked_processes(pid, owner_pid) do
|
||||
case Process.info(pid, :links) do
|
||||
{:links, links} ->
|
||||
@@ -118,47 +111,6 @@ defmodule WandererApp.Test.DatabaseAccessManager do
|
||||
end
|
||||
end
|
||||
|
||||
defp setup_continuous_monitoring(genserver_pid, owner_pid) do
|
||||
spawn_link(fn ->
|
||||
Process.monitor(genserver_pid)
|
||||
continuously_monitor_genserver(genserver_pid, owner_pid)
|
||||
end)
|
||||
end
|
||||
|
||||
defp continuously_monitor_genserver(genserver_pid, owner_pid) do
|
||||
if Process.alive?(genserver_pid) do
|
||||
# Check for new linked processes
|
||||
grant_access_to_linked_processes(genserver_pid, owner_pid)
|
||||
|
||||
# Check for new child processes
|
||||
current_children = get_process_children(genserver_pid)
|
||||
|
||||
Enum.each(current_children, fn child_pid ->
|
||||
grant_database_access(child_pid, owner_pid)
|
||||
end)
|
||||
|
||||
# Continue monitoring
|
||||
:timer.sleep(100)
|
||||
continuously_monitor_genserver(genserver_pid, owner_pid)
|
||||
end
|
||||
end
|
||||
|
||||
defp monitor_for_new_processes(parent_pid, owner_pid, previous_children) do
|
||||
if Process.alive?(parent_pid) do
|
||||
current_children = get_process_children(parent_pid)
|
||||
new_children = current_children -- previous_children
|
||||
|
||||
# Grant access to new child processes
|
||||
Enum.each(new_children, fn child_pid ->
|
||||
grant_database_access(child_pid, owner_pid)
|
||||
end)
|
||||
|
||||
# Continue monitoring
|
||||
:timer.sleep(50)
|
||||
monitor_for_new_processes(parent_pid, owner_pid, current_children)
|
||||
end
|
||||
end
|
||||
|
||||
defp monitor_for_database_access_errors(monitored_pid, owner_pid) do
|
||||
if Process.alive?(monitored_pid) do
|
||||
# Monitor for error messages that indicate database access issues
|
||||
|
||||
@@ -83,11 +83,9 @@ defmodule WandererApp.MapTestHelpers do
|
||||
|> Enum.find(&(&1 == :ok))
|
||||
end
|
||||
|
||||
@doc """
|
||||
Continuously grants database access to all MapPool processes and their children.
|
||||
This is necessary when maps are started dynamically during tests.
|
||||
Uses efficient polling with minimal delays.
|
||||
"""
|
||||
# Continuously grants database access to all MapPool processes and their children.
|
||||
# This is necessary when maps are started dynamically during tests.
|
||||
# Uses efficient polling with minimal delays.
|
||||
defp grant_database_access_continuously do
|
||||
owner_pid = Process.get(:sandbox_owner_pid) || self()
|
||||
|
||||
|
||||
@@ -34,11 +34,15 @@ defmodule WandererApp.Test.Mocks do
|
||||
|
||||
defp setup_default_stubs do
|
||||
# Set up default stubs for logger mock (these methods are called during application startup)
|
||||
Test.LoggerMock
|
||||
|> Mox.stub(:info, fn _message -> :ok end)
|
||||
|> Mox.stub(:warning, fn _message -> :ok end)
|
||||
|> Mox.stub(:error, fn _message -> :ok end)
|
||||
|> Mox.stub(:debug, fn _message -> :ok end)
|
||||
# Support both 1-arity (message only) and 2-arity (message + metadata) versions
|
||||
Mox.stub(Test.LoggerMock, :info, fn _message -> :ok end)
|
||||
Mox.stub(Test.LoggerMock, :info, fn _message, _metadata -> :ok end)
|
||||
Mox.stub(Test.LoggerMock, :warning, fn _message -> :ok end)
|
||||
Mox.stub(Test.LoggerMock, :warning, fn _message, _metadata -> :ok end)
|
||||
Mox.stub(Test.LoggerMock, :error, fn _message -> :ok end)
|
||||
Mox.stub(Test.LoggerMock, :error, fn _message, _metadata -> :ok end)
|
||||
Mox.stub(Test.LoggerMock, :debug, fn _message -> :ok end)
|
||||
Mox.stub(Test.LoggerMock, :debug, fn _message, _metadata -> :ok end)
|
||||
|
||||
# Set up default stubs for PubSub mock
|
||||
Test.PubSubMock
|
||||
|
||||
@@ -8,16 +8,10 @@ defmodule WandererAppWeb.OpenAPISchemaEvolution do
|
||||
|
||||
# alias WandererAppWeb.OpenAPISpecAnalyzer # Currently unused
|
||||
|
||||
@breaking_change_types [
|
||||
:removed_endpoint,
|
||||
:removed_operation,
|
||||
:removed_required_field,
|
||||
:removed_enum_value,
|
||||
:type_narrowing,
|
||||
:removed_response_code,
|
||||
:required_field_added,
|
||||
:parameter_location_changed
|
||||
]
|
||||
# Breaking change types for reference:
|
||||
# :removed_endpoint, :removed_operation, :removed_required_field,
|
||||
# :removed_enum_value, :type_narrowing, :removed_response_code,
|
||||
# :required_field_added, :parameter_location_changed
|
||||
|
||||
@doc """
|
||||
Detects breaking changes between two API specifications.
|
||||
|
||||
@@ -12,8 +12,6 @@ defmodule WandererApp.TestOptimization do
|
||||
|
||||
alias WandererApp.TestOptimization.{
|
||||
DependencyAnalyzer,
|
||||
ParallelExecutor,
|
||||
ResourcePool,
|
||||
TestOrderOptimizer
|
||||
}
|
||||
|
||||
@@ -327,7 +325,7 @@ defmodule WandererApp.TestOptimization do
|
||||
end)
|
||||
end
|
||||
|
||||
defp generate_resource_pools(analysis) do
|
||||
defp generate_resource_pools(_analysis) do
|
||||
%{
|
||||
database: %{
|
||||
size: optimal_worker_count() * 2,
|
||||
@@ -527,7 +525,7 @@ defmodule WandererApp.TestOptimization.ParallelExecutor do
|
||||
end
|
||||
|
||||
defp setup_resource_pools(pool_configs) do
|
||||
Enum.each(pool_configs, fn {name, config} ->
|
||||
Enum.each(pool_configs, fn {_name, _config} ->
|
||||
# In practice, you'd set up actual resource pools here
|
||||
# For example, database connection pools, mock registries, etc.
|
||||
:ok
|
||||
|
||||
Reference in New Issue
Block a user