fix: show localhost address when scan is enabled & connected

This commit is contained in:
zlshames
2022-12-24 13:58:36 -05:00
parent 22362e6fbe
commit a87c68652f
3 changed files with 3 additions and 3 deletions

View File

@ -152,7 +152,7 @@ class _ServerManagementPanelState extends CustomState<ServerManagementPanel, voi
: SocketState.disconnected))),
if ((controller.serverVersionCode.value ?? 0) >= 42)
const TextSpan(text: "\n\n"),
TextSpan(text: "Server URL: ${redact ? "Redacted" : ss.settings.serverAddress.value}", recognizer: TapGestureRecognizer()
TextSpan(text: "Server URL: ${redact ? "Redacted" : http.originOverride ?? ss.settings.serverAddress.value}", recognizer: TapGestureRecognizer()
..onTap = () {
Clipboard.setData(ClipboardData(text: ss.settings.serverAddress.value));
showSnackbar('Copied', "Address copied to clipboard");

View File

@ -49,7 +49,7 @@ class NetworkTasks {
}
}
if (address != null) {
http.originOverride = "http://$address:${ss.settings.localhostPort.value}/api/v1";
http.originOverride = "http://$address:${ss.settings.localhostPort.value}";
} else {
http.originOverride = null;
}

View File

@ -16,7 +16,7 @@ class HttpService extends GetxService {
String? originOverride;
/// Get the URL origin from the current server address
String get origin => originOverride ?? "${Uri.parse(ss.settings.serverAddress.value).origin}/api/v1";
String get origin => "${originOverride ?? Uri.parse(ss.settings.serverAddress.value).origin}/api/v1";
/// Helper function to build query params, this way we only need to add the
/// required guid auth param in one place