mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-11-03 07:57:05 +00:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4dc6382402 | ||
|
|
cb8c1e32d9 | ||
|
|
bf534be128 | ||
|
|
a89c117612 | ||
|
|
501dbcd76b | ||
|
|
c0ceff1eec | ||
|
|
6039ac5d4f | ||
|
|
48e87f3c47 | ||
|
|
c7866a1270 | ||
|
|
4fadcd5964 | ||
|
|
6480154d1b | ||
|
|
9c064531b8 | ||
|
|
bee64c2570 | ||
|
|
5393321953 | ||
|
|
b44669da87 | ||
|
|
9d8bf1529a | ||
|
|
a514825eaf | ||
|
|
8abcacb517 | ||
|
|
a3fc55e63d | ||
|
|
a4c1d5bf98 | ||
|
|
b16bc615fa | ||
|
|
10ec8d6b97 | ||
|
|
b04f0c9183 | ||
|
|
45e9ebb0d4 | ||
|
|
ac3e68a49f | ||
|
|
b35ef1151a | ||
|
|
ebd01bebd4 | ||
|
|
7c7dd44805 | ||
|
|
152ee60576 | ||
|
|
9db568d726 | ||
|
|
a34805d3dd | ||
|
|
8105af7451 | ||
|
|
88fd0eb3dd |
15
.github/FUNDING.yml
vendored
Normal file
15
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: WandererLtd
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
polar: # Replace with a single Polar username
|
||||
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
|
||||
thanks_dev: # Replace with a single thanks.dev username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
@@ -112,8 +112,6 @@ jobs:
|
||||
git config --global user.name 'CI'
|
||||
git config --global user.email 'ci@users.noreply.github.com'
|
||||
mix git_ops.release --force-patch --yes
|
||||
yes | cp -rf CHANGELOG.md priv/changelog/CHANGELOG.md
|
||||
sed -i '1i%{title: "Change Log"}\n\n---\n' priv/changelog/CHANGELOG.md
|
||||
git push --follow-tags
|
||||
|
||||
docker:
|
||||
@@ -145,6 +143,11 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Prepare Changelog
|
||||
run: |
|
||||
yes | cp -rf CHANGELOG.md priv/changelog/CHANGELOG.md
|
||||
sed -i '1i%{title: "Change Log"}\n\n---\n' priv/changelog/CHANGELOG.md
|
||||
|
||||
- name: Get Release Tag
|
||||
id: get-latest-tag
|
||||
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
||||
|
||||
87
CHANGELOG.md
87
CHANGELOG.md
@@ -2,6 +2,93 @@
|
||||
|
||||
<!-- changelog -->
|
||||
|
||||
## [v1.0.16](https://github.com/wanderer-industries/wanderer/compare/v1.0.15...v1.0.16) (2024-09-21)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* Map: commented console log
|
||||
|
||||
* Map: add console log for check sys loading
|
||||
|
||||
* Map: add key for cache changes detecting
|
||||
|
||||
## [v1.0.15](https://github.com/wanderer-industries/wanderer/compare/v1.0.14...v1.0.15) (2024-09-21)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* map: Show a proper user notification if map was deleted/archived
|
||||
|
||||
## [v1.0.14](https://github.com/wanderer-industries/wanderer/compare/v1.0.13...v1.0.14) (2024-09-21)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.0.13](https://github.com/wanderer-industries/wanderer/compare/v1.0.12...v1.0.13) (2024-09-21)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* tracking: Ensure user has at least one character tracked to work with map
|
||||
|
||||
## [v1.0.12](https://github.com/wanderer-industries/wanderer/compare/v1.0.11...v1.0.12) (2024-09-20)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* audit: Hide character for non-character map activities
|
||||
|
||||
## [v1.0.11](https://github.com/wanderer-industries/wanderer/compare/v1.0.10...v1.0.11) (2024-09-20)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.0.10](https://github.com/wanderer-industries/wanderer/compare/v1.0.9...v1.0.10) (2024-09-19)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* signatures: Fix update signatures error if no character tracked on map
|
||||
|
||||
## [v1.0.9](https://github.com/wanderer-industries/wanderer/compare/v1.0.8...v1.0.9) (2024-09-19)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* core: Fix system add error if it's already added on map
|
||||
|
||||
## [v1.0.8](https://github.com/wanderer-industries/wanderer/compare/v1.0.7...v1.0.8) (2024-09-19)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* docker: Fix DB connection in docker-compose internal network
|
||||
|
||||
## [v1.0.7](https://github.com/wanderer-industries/wanderer/compare/v1.0.6...v1.0.7) (2024-09-19)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.0.6](https://github.com/wanderer-industries/wanderer/compare/v1.0.5...v1.0.6) (2024-09-18)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.0.5](https://github.com/wanderer-industries/wanderer/compare/v1.0.4...v1.0.5) (2024-09-18)
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export const RoutesWidgetContent = () => {
|
||||
|
||||
const { loading } = useLoadRoutes();
|
||||
|
||||
const { systems: systemStatics, loadSystems } = useLoadSystemStatic({ systems: hubs ?? [] });
|
||||
const { systems: systemStatics, loadSystems, lastUpdateKey } = useLoadSystemStatic({ systems: hubs ?? [] });
|
||||
const { open, ...systemCtxProps } = useContextMenuSystemInfoHandlers({
|
||||
outCommand,
|
||||
hubs,
|
||||
@@ -51,7 +51,8 @@ export const RoutesWidgetContent = () => {
|
||||
|
||||
return { ...systemStatics.get(parseInt(x))!, ...(sys && { customName: sys.name ?? '' }) };
|
||||
});
|
||||
}, [hubs, systems, systemStatics]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [hubs, systems, systemStatics, lastUpdateKey]);
|
||||
|
||||
const preparedRoutes = useMemo(() => {
|
||||
return (
|
||||
@@ -114,6 +115,10 @@ export const RoutesWidgetContent = () => {
|
||||
{preparedRoutes.map(route => {
|
||||
const sys = preparedHubs.find(x => x.solar_system_id === route.destination)!;
|
||||
|
||||
// TODO do not delte this console log
|
||||
// eslint-disable-next-line no-console
|
||||
// console.log('JOipP', `Check sys [${route.destination}]:`, sys);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex gap-2 items-center">
|
||||
|
||||
@@ -27,12 +27,14 @@ interface UseLoadSystemStaticProps {
|
||||
export const useLoadSystemStatic = ({ systems }: UseLoadSystemStaticProps) => {
|
||||
const { outCommand } = useMapRootState();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [lastUpdateKey, setLastUpdateKey] = useState(0);
|
||||
|
||||
const ref = useRef({ outCommand });
|
||||
ref.current = { outCommand };
|
||||
|
||||
const addSystemStatic = useCallback((static_info: SolarSystemStaticInfoRaw) => {
|
||||
cache.set(static_info.solar_system_id, static_info);
|
||||
setLastUpdateKey(new Date().getTime());
|
||||
}, []);
|
||||
|
||||
const loadSystems = useCallback(async (systems: (number | string)[]) => {
|
||||
@@ -43,6 +45,7 @@ export const useLoadSystemStatic = ({ systems }: UseLoadSystemStaticProps) => {
|
||||
if (toLoad.length > 0) {
|
||||
const res = await loadSystemStaticInfo(ref.current.outCommand, toLoad);
|
||||
res.forEach(x => cache.set(x.solar_system_id, x));
|
||||
setLastUpdateKey(new Date().getTime());
|
||||
}
|
||||
setLoading(false);
|
||||
}, []);
|
||||
@@ -52,5 +55,5 @@ export const useLoadSystemStatic = ({ systems }: UseLoadSystemStaticProps) => {
|
||||
// eslint-disable-next-line
|
||||
}, [systems]);
|
||||
|
||||
return { addSystemStatic, systems: cache, loading, loadSystems };
|
||||
return { addSystemStatic, systems: cache, lastUpdateKey, loading, loadSystems };
|
||||
};
|
||||
|
||||
BIN
assets/static/images/news/09-19-connection-info/connection.png
Normal file
BIN
assets/static/images/news/09-19-connection-info/connection.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 304 KiB |
BIN
assets/static/images/news/09-19-connection-info/cover.png
Normal file
BIN
assets/static/images/news/09-19-connection-info/cover.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 285 KiB |
BIN
assets/static/images/news/09-19-connection-info/info.png
Normal file
BIN
assets/static/images/news/09-19-connection-info/info.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 189 KiB |
@@ -1,22 +1,6 @@
|
||||
import Config
|
||||
import WandererApp.ConfigHelpers
|
||||
|
||||
# config/runtime.exs is executed for all environments, including
|
||||
# during releases. It is executed after compilation and before the
|
||||
# system starts, so it is typically used to load production configuration
|
||||
# and secrets from environment variables or elsewhere. Do not define
|
||||
# any compile-time configuration in here, as it won't be applied.
|
||||
# The block below contains prod specific runtime configuration.
|
||||
|
||||
# ## Using releases
|
||||
#
|
||||
# If you use `mix release`, you need to explicitly enable the server
|
||||
# by passing the PHX_SERVER=true when you start it:
|
||||
#
|
||||
# PHX_SERVER=true bin/wanderer_app start
|
||||
#
|
||||
# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server`
|
||||
# script that automatically sets the env var above.
|
||||
if System.get_env("PHX_SERVER") do
|
||||
config :wanderer_app, WandererAppWeb.Endpoint, server: true
|
||||
end
|
||||
@@ -69,6 +53,15 @@ map_subscriptions_enabled =
|
||||
|> get_var_from_path_or_env("WANDERER_MAP_SUBSCRIPTIONS_ENABLED", "false")
|
||||
|> String.to_existing_atom()
|
||||
|
||||
|
||||
map_subscription_characters_limit =
|
||||
config_dir
|
||||
|> get_int_from_path_or_env("WANDERER_MAP_SUBSCRIPTION_CHARACTERS_LIMIT", 100)
|
||||
|
||||
map_subscription_hubs_limit =
|
||||
config_dir
|
||||
|> get_int_from_path_or_env("WANDERER_MAP_SUBSCRIPTION_HUBS_LIMIT", 10)
|
||||
|
||||
wallet_tracking_enabled =
|
||||
config_dir
|
||||
|> get_var_from_path_or_env("WANDERER_WALLET_TRACKING_ENABLED", "false")
|
||||
@@ -93,7 +86,7 @@ config :wanderer_app,
|
||||
wallet_tracking_enabled: wallet_tracking_enabled,
|
||||
subscription_settings: %{
|
||||
plans: [
|
||||
%{id: "alpha", characters_limit: 100, hubs_limit: 10, base_price: 0, monthly_discount: 0},
|
||||
%{id: "alpha", characters_limit: map_subscription_characters_limit, hubs_limit: map_subscription_hubs_limit, base_price: 0, monthly_discount: 0},
|
||||
%{
|
||||
id: "omega",
|
||||
characters_limit: 300,
|
||||
@@ -178,10 +171,23 @@ if config_env() == :prod do
|
||||
For example: ecto://USER:PASS@HOST/DATABASE
|
||||
"""
|
||||
|
||||
maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: []
|
||||
maybe_ipv6 =
|
||||
config_dir
|
||||
|> get_var_from_path_or_env("ECTO_IPV6", "false")
|
||||
|> String.to_existing_atom()
|
||||
|> case do
|
||||
true -> [:inet6]
|
||||
_ -> []
|
||||
end
|
||||
|
||||
db_ssl_enabled =
|
||||
config_dir
|
||||
|> get_var_from_path_or_env("DATABASE_SSL_ENABLED", "false")
|
||||
|> String.to_existing_atom()
|
||||
|
||||
config :wanderer_app, WandererApp.Repo,
|
||||
url: database_url,
|
||||
ssl: db_ssl_enabled,
|
||||
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
|
||||
socket_options: maybe_ipv6
|
||||
|
||||
|
||||
@@ -1657,32 +1657,35 @@ defmodule WandererApp.Map.Server.Impl do
|
||||
{:ok, solar_system_info} =
|
||||
WandererApp.Api.MapSolarSystem.by_solar_system_id(location.solar_system_id)
|
||||
|
||||
{:ok, new_system} =
|
||||
WandererApp.MapSystemRepo.create(%{
|
||||
map_id: map_id,
|
||||
solar_system_id: location.solar_system_id,
|
||||
name: solar_system_info.solar_system_name,
|
||||
position_x: position.x,
|
||||
position_y: position.y
|
||||
})
|
||||
map_id: map_id,
|
||||
solar_system_id: location.solar_system_id,
|
||||
name: solar_system_info.solar_system_name,
|
||||
position_x: position.x,
|
||||
position_y: position.y
|
||||
})
|
||||
|> case do
|
||||
{:ok, new_system} ->
|
||||
@ddrt.insert(
|
||||
{new_system.solar_system_id,
|
||||
WandererApp.Map.PositionCalculator.get_system_bounding_rect(new_system)},
|
||||
rtree_name
|
||||
)
|
||||
|
||||
@ddrt.insert(
|
||||
{new_system.solar_system_id,
|
||||
WandererApp.Map.PositionCalculator.get_system_bounding_rect(new_system)},
|
||||
rtree_name
|
||||
)
|
||||
WandererApp.Cache.put(
|
||||
"map_#{map_id}:system_#{new_system.id}:last_activity",
|
||||
DateTime.utc_now(),
|
||||
ttl: @system_inactive_timeout
|
||||
)
|
||||
|
||||
WandererApp.Cache.put(
|
||||
"map_#{map_id}:system_#{new_system.id}:last_activity",
|
||||
DateTime.utc_now(),
|
||||
ttl: @system_inactive_timeout
|
||||
)
|
||||
|
||||
broadcast!(map_id, :add_system, new_system)
|
||||
WandererApp.Map.add_system(map_id, new_system)
|
||||
broadcast!(map_id, :add_system, new_system)
|
||||
WandererApp.Map.add_system(map_id, new_system)
|
||||
_ ->
|
||||
:ok
|
||||
end
|
||||
end
|
||||
|
||||
{:error, :already_exists} ->
|
||||
{:error, _} ->
|
||||
:ok
|
||||
end
|
||||
end
|
||||
|
||||
@@ -51,7 +51,7 @@ defmodule WandererAppWeb.Alerts do
|
||||
def delayed_fade_out_flash() do
|
||||
JS.hide(
|
||||
transition:
|
||||
{"transition-opacity ease-out delay-2000 duration-1000", "opacity-100", "opacity-0"},
|
||||
{"transition-opacity ease-out delay-5000 duration-6000", "opacity-100", "opacity-0"},
|
||||
time: 6000
|
||||
)
|
||||
|> JS.push("lv:clear-flash")
|
||||
|
||||
@@ -42,27 +42,30 @@
|
||||
integrity={integrity_hash("https://unpkg.com/react-dom@18/umd/react-dom.production.min.js")}
|
||||
>
|
||||
</script>
|
||||
|
||||
<script defer phx-track-static type="module" src={~p"/assets/app.js"} crossorigin="anonymous">
|
||||
</script>
|
||||
|
||||
<!-- Appzi: Capture Insightful Feedback -->
|
||||
<script async src="https://w.appzi.io/w.js?token=yddv0">
|
||||
<script defer src="https://w.appzi.io/w.js?token=yddv0">
|
||||
</script>
|
||||
<!-- End Appzi -->
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script
|
||||
async
|
||||
defer
|
||||
src="https://www.googletagmanager.com/gtag/js?id=G-61PHLLS0LD"
|
||||
crossorigin="anonymous"
|
||||
>
|
||||
</script>
|
||||
<script>
|
||||
<script defer>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'G-61PHLLS0LD');
|
||||
</script>
|
||||
<script defer phx-track-static type="module" src={~p"/assets/app.js"} crossorigin="anonymous">
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<%= @inner_content %>
|
||||
|
||||
@@ -46,7 +46,7 @@ defmodule WandererAppWeb.UserActivity do
|
||||
<.local_time id={@activity.id} at={@activity.inserted_at} />
|
||||
</span>
|
||||
</p>
|
||||
<p class="flex shrink-0 items-center space-x-1 min-w-[200px]">
|
||||
<p :if={not is_nil(@activity.character)} class="flex shrink-0 items-center space-x-1 min-w-[200px]">
|
||||
<.character_item character={@activity.character} />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -20,13 +20,7 @@
|
||||
<div class="h-10"></div>
|
||||
<div>
|
||||
<div class="inline-flex w-full flex-col items-stretch justify-center gap-2 px-4 md:flex-row xl:justify-start xl:px-0">
|
||||
<a
|
||||
href="https://discord.gg/cafERvDD2k"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label="Discord"
|
||||
class="btn md:btn-lg group shrink-0 rounded-full [@media(min-width:768px)]:px-10 bg-[oklch(64.74%_0.124_270.62)] border-[oklch(64.74%_0.124_270.62)] hover:bg-[oklch(60%_0.124_270.62)] hover:border-[oklch(60%_0.124_270.62)]"
|
||||
>
|
||||
<.link href={"https://discord.gg/cafERvDD2k"} class="btn md:btn-lg group shrink-0 rounded-full [@media(min-width:768px)]:px-10 bg-[oklch(64.74%_0.124_270.62)] border-[oklch(64.74%_0.124_270.62)] hover:bg-[oklch(60%_0.124_270.62)] hover:border-[oklch(60%_0.124_270.62)]">
|
||||
<svg
|
||||
class="h-7 w-auto transition-opacity opacity-100 group-hover:opacity-0"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
@@ -66,7 +60,7 @@
|
||||
>
|
||||
</path>
|
||||
</svg>
|
||||
</a>
|
||||
</.link>
|
||||
|
||||
<a
|
||||
href="https://t.me/wanderer_mapper"
|
||||
|
||||
@@ -11,35 +11,30 @@
|
||||
</div>
|
||||
<!--Right Col-->
|
||||
<div :if={@invite_token_valid} class="overflow-hidden">
|
||||
<%!-- <img class="mx-auto w-full md:w-4/5 transform -rotate-6 transition hover:scale-105 duration-700 ease-in-out hover:rotate-6" src="macbook.svg" /> --%>
|
||||
<.link navigate={~p"/auth/eve?invite=#{@invite_token}"}>
|
||||
<img src="https://web.ccpgamescdn.com/eveonlineassets/developers/eve-sso-login-black-large.png" />
|
||||
</.link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="carousel carousel-center !bg-neutral rounded-box max-w-4xl space-x-6 p-4">
|
||||
<%= for post <- @posts do %>
|
||||
<.link class="carousel-item relative" navigate={~p"/news/#{post.id}"}>
|
||||
<div class="artboard-horizontal phone-1 relative hover:text-white mt-10">
|
||||
<img
|
||||
class="rounded-lg shadow-lg block !w-[400px] !h-[200px] opacity-75"
|
||||
src={post.cover_image_uri}
|
||||
/>
|
||||
<p class="absolute bottom-24 left-14 text-sm font-normal ccp-font">
|
||||
<%= post.date %> - BY <span class="uppercase"><%= post.author %></span>
|
||||
</p>
|
||||
<h3 class="absolute bottom-4 left-14 font-bold break-normal pt-6 pb-2 ccp-font text-white">
|
||||
<%= post.title %>
|
||||
</h3>
|
||||
</div>
|
||||
</.link>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="flex w-full justify-center gap-2 py-2">
|
||||
<%= for post <- @posts do %>
|
||||
<.link class="btn btn-xs" navigate={~p"/news/#{post.id}"}></.link>
|
||||
<% end %>
|
||||
<div class="carousel carousel-center bg-neutral rounded-box max-w-[80%] space-x-4 p-4">
|
||||
<%= for post <- @posts do %>
|
||||
<.link class="group carousel-item relative" navigate={~p"/news/#{post.id}"}>
|
||||
<div class="artboard-horizontal phone-1 relative hover:text-white mt-10">
|
||||
<img
|
||||
class="rounded-lg shadow-lg block !w-[400px] !h-[200px] opacity-75"
|
||||
src={post.cover_image_uri}
|
||||
/>
|
||||
<div class="absolute top-0 left-0 w-full h-full bg-gradient-to-b from-transparent to-black opacity-75 group-hover:opacity-25 transition-opacity duration-300"></div>
|
||||
<h3 class="absolute bottom-4 left-14 font-bold break-normal pt-6 pb-2 ccp-font text-white">
|
||||
<%= post.title %>
|
||||
</h3>
|
||||
</div>
|
||||
</.link>
|
||||
<% end %>
|
||||
</div>
|
||||
<%!-- <div class="carousel carousel-center !bg-neutral rounded-box max-w-4xl space-x-6 p-4">
|
||||
|
||||
</div> --%>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -64,6 +64,18 @@ defmodule WandererAppWeb.MapLive do
|
||||
timeout: 2000
|
||||
})
|
||||
|
||||
{:ok,
|
||||
%{
|
||||
deleted: true
|
||||
} = map} ->
|
||||
|
||||
socket
|
||||
|> put_flash(
|
||||
:error,
|
||||
"Map was deleted by owner or administrator."
|
||||
)
|
||||
|> push_navigate(to: ~p"/maps")
|
||||
|
||||
{:error, _} ->
|
||||
socket
|
||||
|> put_flash(
|
||||
@@ -386,6 +398,13 @@ defmodule WandererAppWeb.MapLive do
|
||||
"One of your characters has expired token. Please refresh it on characters page."
|
||||
)
|
||||
|
||||
:empty_tracked_characters ->
|
||||
socket
|
||||
|> put_flash(
|
||||
:info,
|
||||
"You should enable tracking for at least one character to work with map."
|
||||
)
|
||||
|
||||
:map_character_limit ->
|
||||
socket
|
||||
|> put_flash(
|
||||
@@ -400,7 +419,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
|
||||
{:noreply,
|
||||
socket
|
||||
|> assign(map_loaded?: true, user_characters: user_character_eve_ids)
|
||||
|> assign(map_loaded?: true, user_characters: user_character_eve_ids, has_tracked_characters?: _has_tracked_characters?(user_character_eve_ids))
|
||||
|> _push_map_event("init", initial_data)
|
||||
|> push_event("js-exec", %{
|
||||
to: "#map-loader",
|
||||
@@ -470,16 +489,24 @@ defmodule WandererAppWeb.MapLive do
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event("manual_add_system", %{"coordinates" => coordinates} = _event, socket) do
|
||||
case _check_user_permissions(socket, :add_system) do
|
||||
def handle_event("manual_add_system", %{"coordinates" => coordinates} = _event, %{assigns: %{has_tracked_characters?: has_tracked_characters?}} = socket) do
|
||||
case has_tracked_characters? do
|
||||
true ->
|
||||
{:noreply,
|
||||
socket
|
||||
|> assign(coordinates: coordinates)
|
||||
|> push_patch(to: ~p"/#{socket.assigns.map_slug}/add-system")}
|
||||
case _check_user_permissions(socket, :add_system) do
|
||||
true ->
|
||||
{:noreply,
|
||||
socket
|
||||
|> assign(coordinates: coordinates)
|
||||
|> push_patch(to: ~p"/#{socket.assigns.map_slug}/add-system")}
|
||||
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
{:noreply, socket |> put_flash(
|
||||
:error,
|
||||
"You should enable tracking for at least one character to add system."
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -487,157 +514,189 @@ defmodule WandererAppWeb.MapLive do
|
||||
def handle_event(
|
||||
"manual_add_connection",
|
||||
%{"source" => solar_system_source_id, "target" => solar_system_target_id} = _event,
|
||||
%{assigns: %{current_user: current_user, tracked_character_ids: tracked_character_ids}} =
|
||||
%{assigns: %{current_user: current_user, tracked_character_ids: tracked_character_ids, has_tracked_characters?: has_tracked_characters?}} =
|
||||
socket
|
||||
) do
|
||||
case _check_user_permissions(socket, :add_connection) do
|
||||
true ->
|
||||
map_id =
|
||||
socket
|
||||
|> map_id()
|
||||
case has_tracked_characters? do
|
||||
true ->
|
||||
case _check_user_permissions(socket, :add_connection) do
|
||||
true ->
|
||||
map_id =
|
||||
socket
|
||||
|> map_id()
|
||||
|
||||
map_id
|
||||
|> WandererApp.Map.Server.add_connection(%{
|
||||
solar_system_source_id: solar_system_source_id |> String.to_integer(),
|
||||
solar_system_target_id: solar_system_target_id |> String.to_integer()
|
||||
})
|
||||
map_id
|
||||
|> WandererApp.Map.Server.add_connection(%{
|
||||
solar_system_source_id: solar_system_source_id |> String.to_integer(),
|
||||
solar_system_target_id: solar_system_target_id |> String.to_integer()
|
||||
})
|
||||
|
||||
:telemetry.execute([:wanderer_app, :map, :connection, :add], %{count: 1}, %{
|
||||
character_id: tracked_character_ids |> List.first(),
|
||||
user_id: current_user.id,
|
||||
map_id: map_id,
|
||||
solar_system_source_id: "#{solar_system_source_id}" |> String.to_integer(),
|
||||
solar_system_target_id: "#{solar_system_target_id}" |> String.to_integer()
|
||||
})
|
||||
:telemetry.execute([:wanderer_app, :map, :connection, :add], %{count: 1}, %{
|
||||
character_id: tracked_character_ids |> List.first(),
|
||||
user_id: current_user.id,
|
||||
map_id: map_id,
|
||||
solar_system_source_id: "#{solar_system_source_id}" |> String.to_integer(),
|
||||
solar_system_target_id: "#{solar_system_target_id}" |> String.to_integer()
|
||||
})
|
||||
|
||||
{:noreply, socket}
|
||||
{:noreply, socket}
|
||||
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket |> put_flash(
|
||||
:error,
|
||||
"You should enable tracking for at least one character to add connection."
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event(
|
||||
"add_hub",
|
||||
%{"system_id" => solar_system_id} = _event,
|
||||
%{assigns: %{current_user: current_user, tracked_character_ids: tracked_character_ids}} =
|
||||
%{assigns: %{current_user: current_user, tracked_character_ids: tracked_character_ids, has_tracked_characters?: has_tracked_characters?}} =
|
||||
socket
|
||||
) do
|
||||
case _check_user_permissions(socket, :update_system) do
|
||||
true ->
|
||||
map_id =
|
||||
socket
|
||||
|> map_id()
|
||||
case has_tracked_characters? do
|
||||
true ->
|
||||
case _check_user_permissions(socket, :update_system) do
|
||||
true ->
|
||||
map_id =
|
||||
socket
|
||||
|> map_id()
|
||||
|
||||
:telemetry.execute([:wanderer_app, :map, :hub, :add], %{count: 1}, %{
|
||||
character_id: tracked_character_ids |> List.first(),
|
||||
user_id: current_user.id,
|
||||
map_id: map_id,
|
||||
solar_system_id: solar_system_id
|
||||
})
|
||||
:telemetry.execute([:wanderer_app, :map, :hub, :add], %{count: 1}, %{
|
||||
character_id: tracked_character_ids |> List.first(),
|
||||
user_id: current_user.id,
|
||||
map_id: map_id,
|
||||
solar_system_id: solar_system_id
|
||||
})
|
||||
|
||||
map_id
|
||||
|> WandererApp.Map.Server.add_hub(%{
|
||||
solar_system_id: solar_system_id
|
||||
})
|
||||
map_id
|
||||
|> WandererApp.Map.Server.add_hub(%{
|
||||
solar_system_id: solar_system_id
|
||||
})
|
||||
|
||||
{:noreply, socket}
|
||||
{:noreply, socket}
|
||||
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket |> put_flash(
|
||||
:error,
|
||||
"You should enable tracking for at least one character to add hub."
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event(
|
||||
"delete_hub",
|
||||
%{"system_id" => solar_system_id} = _event,
|
||||
%{assigns: %{current_user: current_user, tracked_character_ids: tracked_character_ids}} =
|
||||
%{assigns: %{current_user: current_user, tracked_character_ids: tracked_character_ids, has_tracked_characters?: has_tracked_characters?}} =
|
||||
socket
|
||||
) do
|
||||
case _check_user_permissions(socket, :update_system) do
|
||||
true ->
|
||||
map_id =
|
||||
socket
|
||||
|> map_id()
|
||||
case has_tracked_characters? do
|
||||
true ->
|
||||
case _check_user_permissions(socket, :update_system) do
|
||||
true ->
|
||||
map_id =
|
||||
socket
|
||||
|> map_id()
|
||||
|
||||
:telemetry.execute([:wanderer_app, :map, :hub, :remove], %{count: 1}, %{
|
||||
character_id: tracked_character_ids |> List.first(),
|
||||
user_id: current_user.id,
|
||||
map_id: map_id,
|
||||
solar_system_id: solar_system_id
|
||||
})
|
||||
:telemetry.execute([:wanderer_app, :map, :hub, :remove], %{count: 1}, %{
|
||||
character_id: tracked_character_ids |> List.first(),
|
||||
user_id: current_user.id,
|
||||
map_id: map_id,
|
||||
solar_system_id: solar_system_id
|
||||
})
|
||||
|
||||
map_id
|
||||
|> WandererApp.Map.Server.remove_hub(%{
|
||||
solar_system_id: solar_system_id
|
||||
})
|
||||
map_id
|
||||
|> WandererApp.Map.Server.remove_hub(%{
|
||||
solar_system_id: solar_system_id
|
||||
})
|
||||
|
||||
{:noreply, socket}
|
||||
{:noreply, socket}
|
||||
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket |> put_flash(
|
||||
:error,
|
||||
"You should enable tracking for at least one character to remove hub."
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event(
|
||||
"update_system_" <> param,
|
||||
%{"system_id" => solar_system_id, "value" => value} = _event,
|
||||
%{assigns: %{current_user: current_user, tracked_character_ids: tracked_character_ids}} =
|
||||
%{assigns: %{current_user: current_user, tracked_character_ids: tracked_character_ids, has_tracked_characters?: has_tracked_characters?}} =
|
||||
socket
|
||||
) do
|
||||
case _check_user_permissions(socket, :update_system) do
|
||||
true ->
|
||||
method_atom =
|
||||
case param do
|
||||
"name" -> :update_system_name
|
||||
"description" -> :update_system_description
|
||||
"labels" -> :update_system_labels
|
||||
"locked" -> :update_system_locked
|
||||
"tag" -> :update_system_tag
|
||||
"status" -> :update_system_status
|
||||
_ -> nil
|
||||
end
|
||||
case has_tracked_characters? do
|
||||
true ->
|
||||
case _check_user_permissions(socket, :update_system) do
|
||||
true ->
|
||||
method_atom =
|
||||
case param do
|
||||
"name" -> :update_system_name
|
||||
"description" -> :update_system_description
|
||||
"labels" -> :update_system_labels
|
||||
"locked" -> :update_system_locked
|
||||
"tag" -> :update_system_tag
|
||||
"status" -> :update_system_status
|
||||
_ -> nil
|
||||
end
|
||||
|
||||
key_atom =
|
||||
case param do
|
||||
"name" -> :name
|
||||
"description" -> :description
|
||||
"labels" -> :labels
|
||||
"locked" -> :locked
|
||||
"tag" -> :tag
|
||||
"status" -> :status
|
||||
_ -> :none
|
||||
end
|
||||
key_atom =
|
||||
case param do
|
||||
"name" -> :name
|
||||
"description" -> :description
|
||||
"labels" -> :labels
|
||||
"locked" -> :locked
|
||||
"tag" -> :tag
|
||||
"status" -> :status
|
||||
_ -> :none
|
||||
end
|
||||
|
||||
map_id =
|
||||
socket
|
||||
|> map_id()
|
||||
map_id =
|
||||
socket
|
||||
|> map_id()
|
||||
|
||||
:telemetry.execute([:wanderer_app, :map, :system, :update], %{count: 1}, %{
|
||||
character_id: tracked_character_ids |> List.first(),
|
||||
user_id: current_user.id,
|
||||
map_id: map_id,
|
||||
solar_system_id: "#{solar_system_id}" |> String.to_integer(),
|
||||
key: key_atom,
|
||||
value: value
|
||||
})
|
||||
:telemetry.execute([:wanderer_app, :map, :system, :update], %{count: 1}, %{
|
||||
character_id: tracked_character_ids |> List.first(),
|
||||
user_id: current_user.id,
|
||||
map_id: map_id,
|
||||
solar_system_id: "#{solar_system_id}" |> String.to_integer(),
|
||||
key: key_atom,
|
||||
value: value
|
||||
})
|
||||
|
||||
apply(WandererApp.Map.Server, method_atom, [
|
||||
map_id,
|
||||
%{
|
||||
solar_system_id: "#{solar_system_id}" |> String.to_integer()
|
||||
}
|
||||
|> Map.put_new(key_atom, value)
|
||||
])
|
||||
apply(WandererApp.Map.Server, method_atom, [
|
||||
map_id,
|
||||
%{
|
||||
solar_system_id: "#{solar_system_id}" |> String.to_integer()
|
||||
}
|
||||
|> Map.put_new(key_atom, value)
|
||||
])
|
||||
|
||||
{:noreply, socket}
|
||||
{:noreply, socket}
|
||||
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket |> put_flash(
|
||||
:error,
|
||||
"You should enable tracking for at least one character to update system."
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
@@ -648,57 +707,65 @@ defmodule WandererAppWeb.MapLive do
|
||||
"target" => solar_system_target_id,
|
||||
"value" => value
|
||||
} = _event,
|
||||
%{assigns: %{current_user: current_user, tracked_character_ids: tracked_character_ids}} =
|
||||
%{assigns: %{current_user: current_user, tracked_character_ids: tracked_character_ids, has_tracked_characters?: has_tracked_characters?}} =
|
||||
socket
|
||||
) do
|
||||
case _check_user_permissions(socket, :update_system) do
|
||||
true ->
|
||||
method_atom =
|
||||
case param do
|
||||
"time_status" -> :update_connection_time_status
|
||||
"mass_status" -> :update_connection_mass_status
|
||||
"ship_size_type" -> :update_connection_ship_size_type
|
||||
"locked" -> :update_connection_locked
|
||||
_ -> nil
|
||||
end
|
||||
case has_tracked_characters? do
|
||||
true ->
|
||||
case _check_user_permissions(socket, :update_system) do
|
||||
true ->
|
||||
method_atom =
|
||||
case param do
|
||||
"time_status" -> :update_connection_time_status
|
||||
"mass_status" -> :update_connection_mass_status
|
||||
"ship_size_type" -> :update_connection_ship_size_type
|
||||
"locked" -> :update_connection_locked
|
||||
_ -> nil
|
||||
end
|
||||
|
||||
key_atom =
|
||||
case param do
|
||||
"time_status" -> :time_status
|
||||
"mass_status" -> :mass_status
|
||||
"ship_size_type" -> :ship_size_type
|
||||
"locked" -> :locked
|
||||
_ -> nil
|
||||
end
|
||||
key_atom =
|
||||
case param do
|
||||
"time_status" -> :time_status
|
||||
"mass_status" -> :mass_status
|
||||
"ship_size_type" -> :ship_size_type
|
||||
"locked" -> :locked
|
||||
_ -> nil
|
||||
end
|
||||
|
||||
map_id =
|
||||
socket
|
||||
|> map_id()
|
||||
map_id =
|
||||
socket
|
||||
|> map_id()
|
||||
|
||||
:telemetry.execute([:wanderer_app, :map, :connection, :update], %{count: 1}, %{
|
||||
character_id: tracked_character_ids |> List.first(),
|
||||
user_id: current_user.id,
|
||||
map_id: map_id,
|
||||
solar_system_source_id: "#{solar_system_source_id}" |> String.to_integer(),
|
||||
solar_system_target_id: "#{solar_system_target_id}" |> String.to_integer(),
|
||||
key: key_atom,
|
||||
value: value
|
||||
})
|
||||
:telemetry.execute([:wanderer_app, :map, :connection, :update], %{count: 1}, %{
|
||||
character_id: tracked_character_ids |> List.first(),
|
||||
user_id: current_user.id,
|
||||
map_id: map_id,
|
||||
solar_system_source_id: "#{solar_system_source_id}" |> String.to_integer(),
|
||||
solar_system_target_id: "#{solar_system_target_id}" |> String.to_integer(),
|
||||
key: key_atom,
|
||||
value: value
|
||||
})
|
||||
|
||||
apply(WandererApp.Map.Server, method_atom, [
|
||||
map_id,
|
||||
%{
|
||||
solar_system_source_id: "#{solar_system_source_id}" |> String.to_integer(),
|
||||
solar_system_target_id: "#{solar_system_target_id}" |> String.to_integer()
|
||||
}
|
||||
|> Map.put_new(key_atom, value)
|
||||
])
|
||||
apply(WandererApp.Map.Server, method_atom, [
|
||||
map_id,
|
||||
%{
|
||||
solar_system_source_id: "#{solar_system_source_id}" |> String.to_integer(),
|
||||
solar_system_target_id: "#{solar_system_target_id}" |> String.to_integer()
|
||||
}
|
||||
|> Map.put_new(key_atom, value)
|
||||
])
|
||||
|
||||
{:noreply, socket}
|
||||
{:noreply, socket}
|
||||
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket |> put_flash(
|
||||
:error,
|
||||
"You should enable tracking for at least one character to update connection."
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
@@ -724,47 +791,55 @@ defmodule WandererAppWeb.MapLive do
|
||||
first_character_eve_id =
|
||||
Map.get(socket.assigns, :user_characters, []) |> List.first()
|
||||
|
||||
added_signatures =
|
||||
added_signatures
|
||||
|> _parse_signatures(first_character_eve_id, system.id)
|
||||
case not is_nil(first_character_eve_id) do
|
||||
true ->
|
||||
added_signatures =
|
||||
added_signatures
|
||||
|> _parse_signatures(first_character_eve_id, system.id)
|
||||
|
||||
updated_signatures =
|
||||
updated_signatures
|
||||
|> _parse_signatures(first_character_eve_id, system.id)
|
||||
updated_signatures =
|
||||
updated_signatures
|
||||
|> _parse_signatures(first_character_eve_id, system.id)
|
||||
|
||||
updated_signatures_eve_ids =
|
||||
updated_signatures
|
||||
|> Enum.map(fn s -> s.eve_id end)
|
||||
updated_signatures_eve_ids =
|
||||
updated_signatures
|
||||
|> Enum.map(fn s -> s.eve_id end)
|
||||
|
||||
removed_signatures_eve_ids =
|
||||
removed_signatures
|
||||
|> _parse_signatures(first_character_eve_id, system.id)
|
||||
|> Enum.map(fn s -> s.eve_id end)
|
||||
removed_signatures_eve_ids =
|
||||
removed_signatures
|
||||
|> _parse_signatures(first_character_eve_id, system.id)
|
||||
|> Enum.map(fn s -> s.eve_id end)
|
||||
|
||||
WandererApp.Api.MapSystemSignature.by_system_id!(system.id)
|
||||
|> Enum.filter(fn s -> s.eve_id in removed_signatures_eve_ids end)
|
||||
|> Enum.each(fn s ->
|
||||
s
|
||||
|> Ash.destroy!()
|
||||
end)
|
||||
WandererApp.Api.MapSystemSignature.by_system_id!(system.id)
|
||||
|> Enum.filter(fn s -> s.eve_id in removed_signatures_eve_ids end)
|
||||
|> Enum.each(fn s ->
|
||||
s
|
||||
|> Ash.destroy!()
|
||||
end)
|
||||
|
||||
WandererApp.Api.MapSystemSignature.by_system_id!(system.id)
|
||||
|> Enum.filter(fn s -> s.eve_id in updated_signatures_eve_ids end)
|
||||
|> Enum.each(fn s ->
|
||||
updated = updated_signatures |> Enum.find(fn u -> u.eve_id == s.eve_id end)
|
||||
WandererApp.Api.MapSystemSignature.by_system_id!(system.id)
|
||||
|> Enum.filter(fn s -> s.eve_id in updated_signatures_eve_ids end)
|
||||
|> Enum.each(fn s ->
|
||||
updated = updated_signatures |> Enum.find(fn u -> u.eve_id == s.eve_id end)
|
||||
|
||||
if not is_nil(updated) do
|
||||
s
|
||||
|> WandererApp.Api.MapSystemSignature.update(updated)
|
||||
end
|
||||
end)
|
||||
if not is_nil(updated) do
|
||||
s
|
||||
|> WandererApp.Api.MapSystemSignature.update(updated)
|
||||
end
|
||||
end)
|
||||
|
||||
added_signatures
|
||||
|> Enum.map(fn s ->
|
||||
s |> WandererApp.Api.MapSystemSignature.create!()
|
||||
end)
|
||||
added_signatures
|
||||
|> Enum.map(fn s ->
|
||||
s |> WandererApp.Api.MapSystemSignature.create!()
|
||||
end)
|
||||
|
||||
{:reply, %{signatures: _get_system_signatures(system.id)}, socket}
|
||||
{:reply, %{signatures: _get_system_signatures(system.id)}, socket}
|
||||
_ ->
|
||||
{:reply, %{signatures: []}, socket |> put_flash(
|
||||
:error,
|
||||
"You should enable tracking for at least one character to work with signatures."
|
||||
)}
|
||||
end
|
||||
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
@@ -883,18 +958,26 @@ defmodule WandererAppWeb.MapLive do
|
||||
def handle_event(
|
||||
"update_system_position",
|
||||
position,
|
||||
socket
|
||||
%{assigns: %{has_tracked_characters?: has_tracked_characters?}} = socket
|
||||
) do
|
||||
case _check_user_permissions(socket, :update_system) do
|
||||
case has_tracked_characters? do
|
||||
true ->
|
||||
socket
|
||||
|> map_id()
|
||||
|> _update_system_position(position)
|
||||
case _check_user_permissions(socket, :update_system) do
|
||||
true ->
|
||||
socket
|
||||
|> map_id()
|
||||
|> _update_system_position(position)
|
||||
|
||||
{:noreply, socket}
|
||||
{:noreply, socket}
|
||||
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
{:noreply, socket |> put_flash(
|
||||
:error,
|
||||
"You should enable tracking for at least one character to update system."
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -902,18 +985,26 @@ defmodule WandererAppWeb.MapLive do
|
||||
def handle_event(
|
||||
"update_system_positions",
|
||||
positions,
|
||||
socket
|
||||
%{assigns: %{has_tracked_characters?: has_tracked_characters?}} = socket
|
||||
) do
|
||||
case _check_user_permissions(socket, :update_system) do
|
||||
case has_tracked_characters? do
|
||||
true ->
|
||||
socket
|
||||
|> map_id()
|
||||
|> _update_system_positions(positions)
|
||||
case _check_user_permissions(socket, :update_system) do
|
||||
true ->
|
||||
socket
|
||||
|> map_id()
|
||||
|> _update_system_positions(positions)
|
||||
|
||||
{:noreply, socket}
|
||||
{:noreply, socket}
|
||||
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
{:noreply, socket |> put_flash(
|
||||
:error,
|
||||
"You should enable tracking for at least one character to update systems."
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -921,58 +1012,76 @@ defmodule WandererAppWeb.MapLive do
|
||||
def handle_event(
|
||||
"delete_systems",
|
||||
solar_system_ids,
|
||||
%{assigns: %{current_user: current_user, tracked_character_ids: tracked_character_ids}} =
|
||||
%{assigns: %{current_user: current_user, tracked_character_ids: tracked_character_ids, has_tracked_characters?: has_tracked_characters?}} =
|
||||
socket
|
||||
) do
|
||||
case _check_user_permissions(socket, :delete_system) do
|
||||
case has_tracked_characters? do
|
||||
true ->
|
||||
socket
|
||||
|> map_id()
|
||||
|> WandererApp.Map.Server.delete_systems(
|
||||
solar_system_ids |> Enum.map(&String.to_integer/1),
|
||||
current_user.id,
|
||||
tracked_character_ids |> List.first()
|
||||
)
|
||||
case _check_user_permissions(socket, :delete_system) do
|
||||
true ->
|
||||
socket
|
||||
|> map_id()
|
||||
|> WandererApp.Map.Server.delete_systems(
|
||||
solar_system_ids |> Enum.map(&String.to_integer/1),
|
||||
current_user.id,
|
||||
tracked_character_ids |> List.first()
|
||||
)
|
||||
|
||||
{:noreply, socket}
|
||||
{:noreply, socket}
|
||||
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
{:noreply, socket |> put_flash(
|
||||
:error,
|
||||
"You should enable tracking for at least one character to delete systems."
|
||||
)}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event(
|
||||
"manual_delete_connection",
|
||||
%{"source" => solar_system_source_id, "target" => solar_system_target_id} = _event,
|
||||
%{assigns: %{current_user: current_user, tracked_character_ids: tracked_character_ids}} =
|
||||
%{assigns: %{current_user: current_user, tracked_character_ids: tracked_character_ids, has_tracked_characters?: has_tracked_characters?}} =
|
||||
socket
|
||||
) do
|
||||
case _check_user_permissions(socket, :delete_connection) do
|
||||
case has_tracked_characters? do
|
||||
true ->
|
||||
map_id =
|
||||
socket
|
||||
|> map_id()
|
||||
case _check_user_permissions(socket, :delete_connection) do
|
||||
true ->
|
||||
map_id =
|
||||
socket
|
||||
|> map_id()
|
||||
|
||||
map_id
|
||||
|> WandererApp.Map.Server.delete_connection(%{
|
||||
solar_system_source_id: solar_system_source_id |> String.to_integer(),
|
||||
solar_system_target_id: solar_system_target_id |> String.to_integer()
|
||||
})
|
||||
map_id
|
||||
|> WandererApp.Map.Server.delete_connection(%{
|
||||
solar_system_source_id: solar_system_source_id |> String.to_integer(),
|
||||
solar_system_target_id: solar_system_target_id |> String.to_integer()
|
||||
})
|
||||
|
||||
:telemetry.execute([:wanderer_app, :map, :connection, :remove], %{count: 1}, %{
|
||||
character_id: tracked_character_ids |> List.first(),
|
||||
user_id: current_user.id,
|
||||
map_id: map_id,
|
||||
solar_system_source_id: "#{solar_system_source_id}" |> String.to_integer(),
|
||||
solar_system_target_id: "#{solar_system_target_id}" |> String.to_integer()
|
||||
})
|
||||
:telemetry.execute([:wanderer_app, :map, :connection, :remove], %{count: 1}, %{
|
||||
character_id: tracked_character_ids |> List.first(),
|
||||
user_id: current_user.id,
|
||||
map_id: map_id,
|
||||
solar_system_source_id: "#{solar_system_source_id}" |> String.to_integer(),
|
||||
solar_system_target_id: "#{solar_system_target_id}" |> String.to_integer()
|
||||
})
|
||||
|
||||
{:noreply, socket}
|
||||
{:noreply, socket}
|
||||
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
_ ->
|
||||
{:noreply, socket}
|
||||
{:noreply, socket |> put_flash(
|
||||
:error,
|
||||
"You should enable tracking for at least one character to delete connection."
|
||||
)}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@impl true
|
||||
@@ -1061,6 +1170,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
def handle_event("toggle_track", %{"character-id" => character_id}, socket) do
|
||||
map = socket.assigns.map
|
||||
character_settings = socket.assigns.character_settings
|
||||
current_user = socket.assigns.current_user
|
||||
|
||||
socket =
|
||||
case character_settings |> Enum.find(&(&1.character_id == character_id)) do
|
||||
@@ -1139,6 +1249,8 @@ defmodule WandererAppWeb.MapLive do
|
||||
|
||||
{:noreply,
|
||||
socket
|
||||
|> assign(user_characters: user_character_eve_ids)
|
||||
|> assign(has_tracked_characters?: _has_tracked_characters?(user_character_eve_ids))
|
||||
|> assign(character_settings: character_settings)
|
||||
|> assign_async(:characters, fn ->
|
||||
{:ok, %{characters: characters}}
|
||||
@@ -1275,6 +1387,15 @@ defmodule WandererAppWeb.MapLive do
|
||||
[]
|
||||
end
|
||||
|
||||
events =
|
||||
case map_characters |> Enum.empty?() do
|
||||
true ->
|
||||
events ++ [:empty_tracked_characters]
|
||||
|
||||
_ ->
|
||||
events
|
||||
end
|
||||
|
||||
{:ok, characters_limit} = map_id |> WandererApp.Map.get_characters_limit()
|
||||
|
||||
{:ok, present_character_ids} =
|
||||
@@ -1480,6 +1601,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
:character_eve_id,
|
||||
:name,
|
||||
:description,
|
||||
:custom_info,
|
||||
:kind,
|
||||
:group,
|
||||
:updated_at
|
||||
@@ -1509,6 +1631,9 @@ defmodule WandererAppWeb.MapLive do
|
||||
{:ok, %{maps: maps |> Enum.sort_by(& &1.name, :asc) |> Enum.map(&map_map/1)}}
|
||||
end
|
||||
|
||||
defp _has_tracked_characters?([]), do: false
|
||||
defp _has_tracked_characters?(_user_characters), do: true
|
||||
|
||||
defp _update_system_positions(_map_id, []), do: :ok
|
||||
|
||||
defp _update_system_positions(map_id, [position | rest]) do
|
||||
@@ -1684,6 +1809,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
eve_id: eve_id,
|
||||
name: name,
|
||||
description: Map.get(signature, "description"),
|
||||
custom_info: Map.get(signature, "custom_info"),
|
||||
kind: kind,
|
||||
group: group,
|
||||
character_eve_id: character_eve_id
|
||||
|
||||
4
mix.exs
4
mix.exs
@@ -2,7 +2,7 @@ defmodule WandererApp.MixProject do
|
||||
use Mix.Project
|
||||
|
||||
@source_url "https://github.com/wanderer-industries/wanderer"
|
||||
@version "1.0.5"
|
||||
@version "1.0.16"
|
||||
|
||||
def project do
|
||||
[
|
||||
@@ -56,7 +56,7 @@ defmodule WandererApp.MixProject do
|
||||
{:phoenix, "~> 1.7.12"},
|
||||
{:phoenix_ecto, "~> 4.6"},
|
||||
{:ecto_sql, "~> 3.10"},
|
||||
{:postgrex, ">= 0.0.0"},
|
||||
{:postgrex, "~> 0.19.1"},
|
||||
{:phoenix_html, "~> 4.0"},
|
||||
{:phoenix_live_reload, "~> 1.5.3", only: :dev},
|
||||
{:phoenix_live_view, "~> 0.20.17"},
|
||||
|
||||
65
priv/posts/2024/09-19-connection-info.md
Normal file
65
priv/posts/2024/09-19-connection-info.md
Normal file
@@ -0,0 +1,65 @@
|
||||
%{
|
||||
title: "User Guide: Map Connection Info",
|
||||
author: "Wanderer Team",
|
||||
cover_image_uri: "/images/news/09-19-connection-info/cover.png",
|
||||
tags: ~w(interface guide map connection),
|
||||
description: "This guide provides instructions on how to access and interpret connection information on the map. The connection info feature helps users monitor traffic between systems and estimate the mass of ships that have passed through a connection."
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
## Step-by-Step Guide
|
||||
|
||||
### 1. Accessing Connection Information
|
||||
|
||||

|
||||
|
||||
- **Overview:** Users can view detailed information about system connections, such as wormholes or stargates, to track the ships that have passed through.
|
||||
- **How to Open Connection Info:**
|
||||
1. On the map, locate a connection line between two systems.
|
||||
2. Click on the connection to open the information panel.
|
||||
3. The panel will display key data about the connection, including ships passed, time and estimated mass.
|
||||
|
||||
### 2. Viewing Ships Passed
|
||||
|
||||

|
||||
|
||||
- **Tracked Characters Only:** The information provided about ships that passed through a connection is based on characters being tracked via the map's character tracking system.
|
||||
- **Details Provided:**
|
||||
1. Once the connection info is open, you will see a list of all ships that passed through the connection.
|
||||
2. The ships are displayed along with the names of the tracked characters that piloted them.
|
||||
3. This information allows you to track traffic patterns and analyze ship movements through the connection.
|
||||
|
||||
### 3. Viewing Estimated Ship Mass
|
||||
|
||||
- **Ship Mass Calculation:** The approximate sum of the mass of all ships that passed through the connection is also displayed.
|
||||
- **How the Mass is Calculated:**
|
||||
1. Ship mass is estimated based on the ship type only.
|
||||
2. The displayed mass may not be 100% precise, as factors like ship fittings or enabled propulsion modes can influence the actual mass.
|
||||
3. The total mass of all ships that passed through the connection is provided to help estimate how much mass the connection has handled, which is particularly important for wormhole stability.
|
||||
|
||||
### Important Notes
|
||||
|
||||
- **Accuracy of Values:** Please note that all values (such as ship mass and the number of ships) are approximations. Ship mass is calculated based on known ship types, but the actual mass may vary depending on fittings and propulsion mode settings.
|
||||
- **Tracked Characters Only:** The ships counted in the "Ships Passed" section are only those of characters being tracked by the map. Ships from non-tracked characters or unidentified sources will not be listed.
|
||||
|
||||
### Example Workflow
|
||||
|
||||
1. **Check Connection Info:**
|
||||
- Click on a connection between two systems (e.g., a wormhole connection).
|
||||
- Review the list of ships passed through the connection.
|
||||
|
||||
2. **Monitor Ship Mass:**
|
||||
- In the same panel, review the approximate total mass of the ships that have passed.
|
||||
- Use this information to assess the connection's usage or potential collapse (in the case of wormholes).
|
||||
|
||||
## Conclusion
|
||||
|
||||
The connection information feature is a valuable tool for tracking ship traffic and estimating mass through system connections. While the values are approximations, this feature provides useful insights for map users to monitor and manage connections more effectively. If you have any questions or need further assistance, please contact our support team.
|
||||
|
||||
Fly safe,
|
||||
WANDERER TEAM
|
||||
|
||||
---
|
||||
|
||||
_Note: Eve Online is a trademark of CCP hf. This application is not affiliated with or endorsed by CCP hf._
|
||||
BIN
priv/static/images/news/09-19-connection-info/connection.png
Normal file
BIN
priv/static/images/news/09-19-connection-info/connection.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 304 KiB |
BIN
priv/static/images/news/09-19-connection-info/cover.png
Normal file
BIN
priv/static/images/news/09-19-connection-info/cover.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 285 KiB |
BIN
priv/static/images/news/09-19-connection-info/info.png
Normal file
BIN
priv/static/images/news/09-19-connection-info/info.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 189 KiB |
@@ -1,6 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
export ERL_AFLAGS="-proto_dist inet6_tcp"
|
||||
export ECTO_IPV6="true"
|
||||
export RELEASE_DISTRIBUTION="name"
|
||||
export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*-}@${FLY_PRIVATE_IP}"
|
||||
|
||||
Reference in New Issue
Block a user