Add localhost setup feedback and remove UI issues (#587)

main
Alex Hvesuk 2026-01-21 22:14:13 +04:00 committed by GitHub
parent abd596ff4a
commit 1cc582636d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 3 deletions

View File

@ -437,6 +437,11 @@
margin-bottom: 4px;
}
.help-text.error {
color: rgba(255, 80, 80, 1);
-unity-font-style: bold;
}
.path-override-controls {
flex-direction: row;
align-items: center;

View File

@ -435,16 +435,24 @@ namespace MCPForUnity.Editor.Windows.Components.Connection
if (!isLocalHttpUrl)
{
httpServerCommandField.value = string.Empty;
httpServerCommandField.tooltip = string.Empty;
httpServerCommandField.value = "<Invalid Localhost URL>";
httpServerCommandField.tooltip = "The command cannot be generated because the URL is not a local address.";
httpServerCommandSection.EnableInClassList("invalid-url", true);
if (httpServerCommandHint != null)
{
httpServerCommandHint.text = "HTTP Local requires a localhost URL (localhost/127.0.0.1/0.0.0.0/::1).";
httpServerCommandHint.text = "⚠ HTTP Local requires a localhost URL (localhost/127.0.0.1/0.0.0.0/::1).";
httpServerCommandHint.AddToClassList("error");
}
copyHttpServerCommandButton?.SetEnabled(false);
return;
}
httpServerCommandSection.EnableInClassList("invalid-url", false);
if (httpServerCommandHint != null)
{
httpServerCommandHint.RemoveFromClassList("error");
}
if (MCPServiceLocator.Server.TryGetLocalHttpServerCommand(out var command, out var error))
{
httpServerCommandField.value = command;