Skip to content

An open source, self-hosted, real-time port monitoring and discovery tool.

fix: update host resolution logic for local server and correct feedback key reference in ActionButton

Mostafa Wahiedd9cfc58bf607
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index 22c1fa5..a4b70f7 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -882,23 +882,31 @@ export default function App() {
onToggleIgnore={toggleIgnore}
onCopy={(p, portProtocol) => {
let hostForCopy;
- if (
- server.id &&
+ if (server.id === "local" &&
+ (p.host_ip === "0.0.0.0" ||
+ p.host_ip === "127.0.0.1" ||
+ p.host_ip === "[::]" ||
+ p.host_ip === "[::1]")) {
+ hostForCopy = window.location.hostname;
+ }
+ else if (
server.id !== "local" &&
server.url &&
(p.host_ip === "0.0.0.0" ||
- p.host_ip === "127.0.0.1" ||
- p.host_ip === "[::]" ||
- p.host_ip === "[::1]")
+ p.host_ip === "127.0.0.1" ||
+ p.host_ip === "[::]" ||
+ p.host_ip === "[::1]")
) {
try {
hostForCopy = new URL(server.url).hostname;
} catch {
hostForCopy = "localhost";
}
- } else {
+ }
+ else {
hostForCopy = p.host_ip;
}
+
const actualProtocol = portProtocol || "http";
const urlToCopy = `${actualProtocol}://${hostForCopy}:${p.host_port}`;
diff --git a/frontend/src/components/server/ActionButton.jsx b/frontend/src/components/server/ActionButton.jsx
index 0b65187..5730462 100644
--- a/frontend/src/components/server/ActionButton.jsx
+++ b/frontend/src/components/server/ActionButton.jsx
@@ -12,7 +12,7 @@ export function ActionButton({
size = "md",
}) {
const feedback = actionFeedback[type];
- const wasClicked = feedback && feedback.key === itemKey;
+ const wasClicked = feedback && feedback.id === itemKey;
const isLoading =
loading &&
feedback &&