Skip to content

Commit ef75822

Browse files
Merge branch 'develop'
2 parents 14e55bf + 535b54c commit ef75822

File tree

4 files changed

+156
-114
lines changed

4 files changed

+156
-114
lines changed

packages/admin-ui/src/pages/wifi/components/localProxying/LocalProxying.tsx

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import Alert from "react-bootstrap/esm/Alert";
2121
import { LocalProxyingStatus } from "@dappnode/types";
2222
import { useNavigate } from "react-router-dom";
2323
import LinkDocs from "components/LinkDocs";
24+
import { AlertDismissible } from "components/AlertDismissible";
2425

2526
export function LocalProxying() {
2627
const navigate = useNavigate();
@@ -38,7 +39,7 @@ export function LocalProxying() {
3839
await new Promise<void>((resolve) => {
3940
confirm({
4041
title: `Stopping Local Network Proxy`,
41-
text: `Warning, if you are connected to your DAppNode through Local Network Proxy you may lose access to your DAppNode. Make sure to have an alternative way to connect to it, like WiFi or a VPN connection.`,
42+
text: `Warning, if you are connected to your Dappnode through Local Network Proxy you may lose access to your Dappnode. Make sure to have an alternative way to connect to it, like WiFi or a VPN connection.`,
4243
label: "Pause",
4344
onClick: resolve
4445
});
@@ -73,37 +74,48 @@ export function LocalProxying() {
7374
return (
7475
<>
7576
{localProxyingStatus.data ? (
76-
<Card spacing>
77-
<p>
78-
If you are connected to the same router as your DAppNode you can use this page at{" "}
79-
<a href={adminUiLocalDomain}>{adminUiLocalDomain}</a>. Learn more about the Local Network Proxy at:{" "}
80-
<LinkDocs href={docsUrl.connectLocalProxy}>How to connect to DAppNode Local Network Proxy</LinkDocs>
81-
</p>
82-
{dappnodeIdentity.internalIp === dappnodeIdentity.ip && (
77+
<>
78+
{window.location.origin !== adminUiLocalDomain && (
79+
<AlertDismissible variant="warning">
80+
<p>
81+
Note that connecting via local proxy is less reliable than using a VPN or Wi-fi hotspot. The local proxy
82+
only provides access to the Dappmanager UI and does not grant access to other domains served through
83+
your Dappnode, such as client interfaces or other package UIs.
84+
</p>
85+
</AlertDismissible>
86+
)}
87+
<Card spacing>
8388
<p>
84-
Local and public IPs are equal. This may be due to dappnode is running on a remote machine and does not
85-
require Local Network Proxy.
89+
If you are connected to the same router as your Dappnode you can use this page at{" "}
90+
<a href={adminUiLocalDomain}>{adminUiLocalDomain}</a>. Learn more about the Local Network Proxy at:{" "}
91+
<LinkDocs href={docsUrl.connectLocalProxy}>How to connect to Dappnode Local Network Proxy</LinkDocs>
8692
</p>
87-
)}
88-
<hr />
93+
{dappnodeIdentity.internalIp === dappnodeIdentity.ip && (
94+
<p>
95+
Local and public IPs are equal. This may be due to dappnode is running on a remote machine and does not
96+
require Local Network Proxy.
97+
</p>
98+
)}
99+
<hr />
89100

90-
<div className="wifi-local-status-actions-row">
91-
<div className="wifi-local-status-container">
92-
<StateBadge {...parseAvahiPublishCmdState(localProxyingStatus.data)} />
93-
<MdWifi className="wifi-local-status-icon" />
94-
<span className="wifi-local-status-name">Local Network Proxy</span>
95-
</div>
101+
<div className="wifi-local-status-actions-row">
102+
<div className="wifi-local-status-container">
103+
<StateBadge {...parseAvahiPublishCmdState(localProxyingStatus.data)} />
104+
<MdWifi className="wifi-local-status-icon" />
105+
<span className="wifi-local-status-name">Local Network Proxy</span>
106+
</div>
96107

97-
<div className="wifi-local-actions">
98-
<Switch
99-
checked={localProxyingStatus.data === "running"}
100-
onToggle={localProxyingEnableDisable}
101-
disabled={reqStatus.loading}
102-
label={localProxyingStatus.data === "running" ? "On" : "Off"}
103-
></Switch>
108+
<div className="wifi-local-actions">
109+
<Switch
110+
checked={localProxyingStatus.data === "running"}
111+
onToggle={localProxyingEnableDisable}
112+
disabled={reqStatus.loading}
113+
label={localProxyingStatus.data === "running" ? "On" : "Off"}
114+
></Switch>
115+
</div>
104116
</div>
105-
</div>
106-
</Card>
117+
</Card>
118+
</>
107119
) : localProxyingStatus.isValidating ? (
108120
<Loading steps={["Loading Local Network Proxy..."]} />
109121
) : localProxyingStatus.error ? (

packages/dappmanager/src/calls/pwaRequirementsGet.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import dns from "dns/promises";
77
import net from "net";
88

99
import { NetworkInspectInfo } from "dockerode";
10+
import { logs } from "@dappnode/logger";
1011

1112
/**
1213
* Returns the HTTPS package status and PWA mapping url if it exists, otherwise adds the mapping.
@@ -68,10 +69,10 @@ async function isPwaResolvable(pwaMappingUrl: string): Promise<boolean | undefin
6869
if (result.length > 0) {
6970
return true;
7071
}
71-
console.error("PWA Check - Pwa not Resolvable");
72+
logs.error("PWA Check - Pwa not Resolvable");
7273
return false;
7374
} catch (err) {
74-
console.error("PWA Check - DNS resolution failed:", err);
75+
logs.error("PWA Check - DNS resolution failed:", err);
7576
return undefined;
7677
}
7778
}
@@ -94,8 +95,8 @@ export async function checkContainersOnPublicNetwork(): Promise<{ dappmanager: b
9495
const dappmanagerConnected = connectedSet.has(params.dappmanagerContainerName);
9596
const httpsConnected = connectedSet.has(params.httpsContainerName);
9697

97-
if (!dappmanagerConnected) console.error(`PWA Check - dappmanager not in "${publicNetwork}"`);
98-
if (!httpsConnected) console.error(`PWA Check - https not in "${publicNetwork}"`);
98+
if (!dappmanagerConnected) logs.error(`PWA Check - dappmanager not in "${publicNetwork}"`);
99+
if (!httpsConnected) logs.error(`PWA Check - https not in "${publicNetwork}"`);
99100

100101
return { dappmanager: dappmanagerConnected, httpsDnp: httpsConnected };
101102
}
@@ -113,7 +114,7 @@ export async function isPrivateIp(domain: string): Promise<boolean> {
113114

114115
return (ipInt & maskInt) === (baseInt & maskInt);
115116
} catch (err) {
116-
console.error(`PWA Check - Error while checking ${domain} private IP`, err);
117+
logs.error(`PWA Check - Error while checking ${domain} private IP`, err);
117118
return false;
118119
}
119120
}
@@ -173,14 +174,14 @@ async function doesExternalPointToDappmanager(): Promise<boolean> {
173174
}
174175
if (!!resolvedIp && !!dappmanagerIp && resolvedIp === dappmanagerIp) return true;
175176
else {
176-
console.error(
177+
logs.error(
177178
`PWA Check - dappmanager.external (${resolvedIp}) does not point to dappmanager container IP (${dappmanagerIp})`
178179
);
179180

180181
return false;
181182
}
182183
} catch (err) {
183-
console.error("PWA Check - Error comparing dappmanager.external and dappmanager IP:", err);
184+
logs.error("PWA Check - Error comparing dappmanager.external and dappmanager IP:", err);
184185
return false;
185186
}
186187
}

packages/dockerCompose/src/editor.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ export class ComposeServiceEditor {
3838
this.serviceName = serviceName;
3939
}
4040

41+
/**
42+
* Returns the networks object for this service, always as an object
43+
*/
44+
getNetworks(): ComposeServiceNetworksObj {
45+
return parseServiceNetworks(this.get().networks || {});
46+
}
47+
4148
private getGlobalEnvsFilePath(isCore: boolean): string {
4249
return isCore ? params.GLOBAL_ENVS_PATH_FOR_CORE : params.GLOBAL_ENVS_PATH_FOR_DNP;
4350
}

0 commit comments

Comments
 (0)