Pass location.hostname as host_ip to app.query #11356
Merged
+10
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes:
Pass location.hostname to the
host_ip
argument toapp.query
API calls. This makes it so that portals use a URL based on the hostname used to access the TrueNAS web UI, rather than a URL based on the IP address which is the default when not passing ahost_ip
.I believe that this was the intention of the existing code, since https://github.com/truenas/webui/blob/master/src/app/pages/apps/components/installed-apps/app-info-card/app-info-card.component.ts#L116-L126 already replaces
0.0.0.0
withwindow.location.hostname
. However, after truenas/middleware#14057, the portal URI which we get from the back-end is already transformed to replace0.0.0.0
with the value passed fromhost_ip
, so that code doesn't have an effect anymore.Testing:
Click a portal (e.g "Web UI") for an installed app using a domain name (typically,
<truenas hostname>.local
will work thanks to mDNS). Before this PR, it will take you to a URL containing the IPv4 address of the TrueNAS host (or do nothing if the websocket uses IPv6; see https://ixsystems.atlassian.net/browse/NAS-133655). After this PR, it should take you to a URL containing the domain you used to access the TrueNAS web UI.