Merge Active Profile picker with Profile management

This commit is contained in:
proxyctl coordinator
2026-07-17 22:44:55 +08:00
13 changed files with 514 additions and 52 deletions
+16 -16
View File
@@ -49,7 +49,7 @@ func TestMainAndProfilePagesMapKeysAndObscurePasswords(t *testing.T) {
t.Fatalf("main view missing Active Profile:\n%s", view)
}
model = updateKey(model, "p")
model = updateKey(model, "m")
view := model.View()
if !strings.Contains(view, "Proxy Profile management") || !strings.Contains(view, "alice:") {
t.Fatalf("Profile page did not render selected Profile:\n%s", view)
@@ -71,7 +71,7 @@ func TestMainAndProfilePagesMapKeysAndObscurePasswords(t *testing.T) {
func TestProfileFormMapsKeyboardInputToCreateIntent(t *testing.T) {
module := &recordingModule{}
model := NewModel(module)
model = updateKey(model, "p")
model = updateKey(model, "m")
model = updateKey(model, "n")
model = updateRunes(model, "home")
model = updateKey(model, "tab")
@@ -100,7 +100,7 @@ func TestEditingSingleURLExpandsCurrentValueWhenSwitchingToAdvanced(t *testing.T
HTTPURL: oldURL, HTTPSURL: oldURL, AllURL: oldURL,
}}}}
model := NewModel(module)
model = updateKey(model, "p")
model = updateKey(model, "m")
model = updateKey(model, "e")
model = updateKey(model, "tab")
for range oldURL {
@@ -124,7 +124,7 @@ func TestRenderedMalformedProxyURLStillObscuresPassword(t *testing.T) {
Name: "manual", Mode: profile.SingleMode, SingleURL: "http://alice:do-not-show@proxy.example:bad",
}}}}
model := NewModel(module)
model = updateKey(model, "p")
model = updateKey(model, "m")
if view := model.View(); strings.Contains(view, "do-not-show") {
t.Fatalf("malformed proxy URL exposed password:\n%s", view)
}
@@ -133,7 +133,7 @@ func TestRenderedMalformedProxyURLStillObscuresPassword(t *testing.T) {
func TestNoProfileStateStaysOnAccessibleMainPage(t *testing.T) {
model := NewModel(&recordingModule{})
view := model.View()
if !strings.Contains(view, "No Active Profile") || !strings.Contains(view, "p: manage Proxy Profiles") {
if !strings.Contains(view, "No Active Profile") || !strings.Contains(view, "m: manage Proxy Profiles") {
t.Fatalf("no-Profile main view is not actionable:\n%s", view)
}
}
@@ -146,7 +146,7 @@ func TestProtocolProbeDetectsHTTPAndRewritesSingleURL(t *testing.T) {
probed = append(probed, address)
return probe.Capabilities{HTTP: true}, nil
}
model = updateKey(model, "p")
model = updateKey(model, "m")
model = updateKey(model, "n")
model = updateRunes(model, "home")
model = updateKey(model, "tab")
@@ -185,7 +185,7 @@ func TestProtocolProbeFailureLeavesFieldUntouchedAndSavePossible(t *testing.T) {
model.detect = func(_ context.Context, address string) (probe.Capabilities, error) {
return probe.Capabilities{}, errors.New("connection refused")
}
model = updateKey(model, "p")
model = updateKey(model, "m")
model = updateKey(model, "n")
model = updateRunes(model, "home")
model = updateKey(model, "tab")
@@ -216,7 +216,7 @@ func TestProtocolProbeUnrecognizedProtocolLeavesFieldUntouched(t *testing.T) {
model.detect = func(_ context.Context, address string) (probe.Capabilities, error) {
return probe.Capabilities{}, nil
}
model = updateKey(model, "p")
model = updateKey(model, "m")
model = updateKey(model, "n")
model = updateRunes(model, "home")
model = updateKey(model, "tab")
@@ -245,7 +245,7 @@ func TestProtocolProbeIgnoresRepeatedCtrlDWhileInFlight(t *testing.T) {
calls++
return probe.Capabilities{HTTP: true}, nil
}
model = updateKey(model, "p")
model = updateKey(model, "m")
model = updateKey(model, "n")
model = updateRunes(model, "home")
model = updateKey(model, "tab")
@@ -276,7 +276,7 @@ func TestProtocolProbeLateResultIgnoredAfterEscLeavesForm(t *testing.T) {
model.detect = func(_ context.Context, address string) (probe.Capabilities, error) {
return probe.Capabilities{HTTP: true}, nil
}
model = updateKey(model, "p")
model = updateKey(model, "m")
model = updateKey(model, "n")
model = updateRunes(model, "home")
model = updateKey(model, "tab")
@@ -309,7 +309,7 @@ func TestProtocolProbeLateResultIgnoredAfterSaveLeavesForm(t *testing.T) {
model.detect = func(_ context.Context, address string) (probe.Capabilities, error) {
return probe.Capabilities{HTTP: true}, nil
}
model = updateKey(model, "p")
model = updateKey(model, "m")
model = updateKey(model, "n")
model = updateRunes(model, "home")
model = updateKey(model, "tab")
@@ -348,7 +348,7 @@ func TestSaveFormDoesNotTriggerProtocolProbe(t *testing.T) {
calls++
return probe.Capabilities{HTTP: true}, nil
}
model = updateKey(model, "p")
model = updateKey(model, "m")
model = updateKey(model, "n")
model = updateRunes(model, "home")
model = updateKey(model, "tab")
@@ -371,7 +371,7 @@ func TestProtocolProbeOnlyTriggersOnSingleURLField(t *testing.T) {
calls++
return probe.Capabilities{HTTP: true}, nil
}
model = updateKey(model, "p")
model = updateKey(model, "m")
model = updateKey(model, "n")
model = updateRunes(model, "home")
@@ -409,7 +409,7 @@ func TestProtocolProbeDetectsDualProtocolEndpointBuildsCompatibleAdvancedProfile
model.detect = func(_ context.Context, address string) (probe.Capabilities, error) {
return probe.Capabilities{HTTP: true, SOCKS5: true}, nil
}
model = updateKey(model, "p")
model = updateKey(model, "m")
model = updateKey(model, "n")
model = updateRunes(model, "home")
model = updateKey(model, "tab")
@@ -437,7 +437,7 @@ func TestProtocolProbeDetectsSOCKS5AndRewritesSingleURL(t *testing.T) {
model.detect = func(_ context.Context, address string) (probe.Capabilities, error) {
return probe.Capabilities{SOCKS5: true}, nil
}
model = updateKey(model, "p")
model = updateKey(model, "m")
model = updateKey(model, "n")
model = updateRunes(model, "home")
model = updateKey(model, "tab")
@@ -466,7 +466,7 @@ func TestProtocolProbeInAdvancedModeShowsHintWithoutProbing(t *testing.T) {
calls++
return probe.Capabilities{HTTP: true}, nil
}
model = updateKey(model, "p")
model = updateKey(model, "m")
model = updateKey(model, "n")
model = updateRunes(model, "home")
model = updateKey(model, "ctrl+t")