Skip to content

A fast, keyboard-driven TUI API client & webhook inspector. No cloud, no Electron, 100% local-first.

fix(ui): restore clean native header and primary Body & Payload tab ordering (v0.1.4)

4yk589b4c256e915
diff --git a/app.py b/app.py
index 763b7ef..b5203f1 100644
--- a/app.py
+++ b/app.py
@@ -37,21 +37,6 @@ Screen {
#subtitle-label {
color: #8b949e;
margin-left: 2;
- width: 1fr;
-}
-
-#ssl-badge {
- color: #3fb950;
- text-style: bold;
- margin-right: 1;
- padding: 0 1;
- background: #161b22;
- border: solid #238636;
-}
-
-#ssl-badge.insecure {
- color: #f85149;
- border: solid #da3633;
}
#main-container {
@@ -205,7 +190,8 @@ TextArea, TextArea:focus, #body-input, #body-input:focus, #headers-input, #heade
#tab-headers-pane {
height: 1fr;
background: #0d1117;
- padding: 0;
+ border: solid #30363d;
+ padding: 1;
}
#tab-response-pane {
@@ -268,8 +254,7 @@ TextArea, TextArea:focus, #body-input, #body-input:focus, #headers-input, #heade
BINDINGS = [
Binding("ctrl+s", "send_request", "Send Request", priority=True),
- Binding("ctrl+w", "toggle_webhook", "Toggle Webhook", priority=True),
- Binding("ctrl+t", "toggle_ssl", "Toggle TLS Verify", priority=True),
+ Binding("ctrl+w", "toggle_webhook", "Toggle Webhook Server", priority=True),
Binding("ctrl+n", "new_request", "New Request", priority=True),
Binding("ctrl+k", "save_request", "Save Request", priority=True),
Binding("ctrl+q", "quit", "Quit", priority=True)
@@ -285,8 +270,7 @@ TextArea, TextArea:focus, #body-input, #body-input:focus, #headers-input, #heade
def __init__(self):
super().__init__()
- self.verify_ssl: bool = True
- self.network = NetworkEngine(verify_ssl=True)
+ self.network = NetworkEngine()
self.storage = StorageManager()
self.collections = self.storage.load_collections()
self.webhook_server = WebhookServer(
@@ -299,7 +283,6 @@ TextArea, TextArea:focus, #body-input, #body-input:focus, #headers-input, #heade
with Horizontal(id="header-bar"):
yield Label("[GHOSTMAN]", id="title-label")
yield Label("Terminal API & Webhook Studio (Local-First)", id="subtitle-label")
- yield Label("[TLS: ON]", id="ssl-badge")
with Horizontal(id="main-container"):
with Vertical(id="sidebar"):
@@ -316,23 +299,19 @@ TextArea, TextArea:focus, #body-input, #body-input:focus, #headers-input, #heade
yield Button("SAVE", id="save-btn")
yield Tabs(
- Tab("Headers", id="tab-headers"),
Tab("Body & Payload", id="tab-body"),
+ Tab("Headers", id="tab-headers"),
Tab("Response", id="tab-response"),
Tab("Live Webhooks", id="tab-webhook"),
id="tabs"
)
- with Vertical(id="tab-headers-pane"):
- yield TextArea(
- id="headers-input",
- language="yaml",
- text=""
- )
-
with Vertical(id="tab-body-pane"):
yield TextArea(id="body-input", language="json", text='{\n "hello": "world"\n}')
+ with Vertical(id="tab-headers-pane"):
+ yield TextArea(id="headers-input", language="yaml", text="")
+
with Vertical(id="tab-response-pane"):
yield Label("Status: Idle", id="metrics-bar")
yield TextArea(id="response-area", read_only=True, language="json", text="")
@@ -443,8 +422,8 @@ TextArea, TextArea:focus, #body-input, #body-input:focus, #headers-input, #heade
def on_tabs_tab_activated(self, event: Tabs.TabActivated):
tab_id = event.tab.id
- self.query_one("#tab-headers-pane").display = (tab_id == "tab-headers")
self.query_one("#tab-body-pane").display = (tab_id == "tab-body")
+ self.query_one("#tab-headers-pane").display = (tab_id == "tab-headers")
self.query_one("#tab-response-pane").display = (tab_id == "tab-response")
self.query_one("#tab-webhook-pane").display = (tab_id == "tab-webhook")
@@ -463,19 +442,6 @@ TextArea, TextArea:focus, #body-input, #body-input:focus, #headers-input, #heade
self.query_one("#url-input", Input).focus()
self.notify("New request ready")
- def action_toggle_ssl(self):
- """Toggle SSL/TLS Certificate Verification (Ctrl+T)"""
- self.verify_ssl = not self.verify_ssl
- badge = self.query_one("#ssl-badge", Label)
- if self.verify_ssl:
- badge.update("[TLS: ON]")
- badge.remove_class("insecure")
- self.notify("TLS Certificate Verification ENABLED (Secure)", timeout=3)
- else:
- badge.update("[TLS: OFF]")
- badge.add_class("insecure")
- self.notify("TLS Certificate Verification DISABLED (Insecure)", severity="warning", timeout=3)
-
async def on_button_pressed(self, event: Button.Pressed):
btn_id = event.button.id
if btn_id == "send-btn":
@@ -559,13 +525,12 @@ TextArea, TextArea:focus, #body-input, #body-input:focus, #headers-input, #heade
req_body = body if method in ["POST", "PUT", "PATCH", "DELETE"] else None
- # Execute with full headers and TLS verification mode
+ # Execute with full headers
res = await self.network.execute_request(
method=method,
url=url,
headers=req_headers,
- body=req_body,
- verify_ssl=self.verify_ssl
+ body=req_body
)
if res["success"]:
diff --git a/pyproject.toml b/pyproject.toml
index d14af87..a4cd9bd 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "ghostman"
-version = "0.1.3"
+version = "0.1.4"
description = "A fast, keyboard-driven terminal API client and webhook inspector"
readme = "README.md"
authors = [{ name = "4yk5" }]
diff --git a/styles.tcss b/styles.tcss
index 131b5d7..0d53c7e 100644
--- a/styles.tcss
+++ b/styles.tcss
@@ -20,21 +20,6 @@ Screen {
#subtitle-label {
color: #8b949e;
margin-left: 2;
- width: 1fr;
-}
-
-#ssl-badge {
- color: #3fb950;
- text-style: bold;
- margin-right: 1;
- padding: 0 1;
- background: #161b22;
- border: solid #238636;
-}
-
-#ssl-badge.insecure {
- color: #f85149;
- border: solid #da3633;
}
#main-container {
@@ -188,7 +173,8 @@ TextArea, TextArea:focus, #body-input, #body-input:focus, #headers-input, #heade
#tab-headers-pane {
height: 1fr;
background: #0d1117;
- padding: 0;
+ border: solid #30363d;
+ padding: 1;
}
#tab-response-pane {
diff --git a/tests/test_vulnerabilities_fixed.py b/tests/test_vulnerabilities_fixed.py
index 10457f5..ba56e72 100644
--- a/tests/test_vulnerabilities_fixed.py
+++ b/tests/test_vulnerabilities_fixed.py
@@ -187,36 +187,30 @@ async def test_chunked_transfer_encoding_webhook():
async def test_tui_headers_and_ssl_controls():
- print("[*] 4. Testing TUI Headers Tab & SSL Toggle Integration...")
+ print("[*] 4. Testing TUI Headers Tab & Integration...")
app = GhostmanApp()
async with app.run_test() as pilot:
- # Check TLS badge initial state
- ssl_badge = app.query_one("#ssl-badge", Label)
- assert "[TLS: ON]" in str(ssl_badge.render())
- assert app.verify_ssl is True
+ # Initial mount state: Tab Body is active and displayed, matching original clean GUI
+ assert app.query_one("#tab-body-pane").display is True
+ assert app.query_one("#tab-headers-pane").display is False
+ assert app.query_one("#tab-response-pane").display is False
+ assert app.network.verify_ssl is True
- # Toggle TLS verify via hotkey (Ctrl+T)
- await pilot.press("ctrl+t")
- await pilot.pause(0.1)
- assert app.verify_ssl is False
- assert "[TLS: OFF]" in str(ssl_badge.render())
-
- # Toggle back to secure
- await pilot.press("ctrl+t")
- await pilot.pause(0.1)
- assert app.verify_ssl is True
- assert "[TLS: ON]" in str(ssl_badge.render())
-
- # Test Headers input in UI
- headers_input = app.query_one("#headers-input", TextArea)
- headers_input.text = "Authorization: Bearer my-ui-token\nX-Client: Ghostman"
+ # Header bar is clean with exact original title and subtitle
+ assert app.query_one("#title-label", Label) is not None
+ assert app.query_one("#subtitle-label", Label) is not None
# Switch to Headers tab
tabs = app.query_one("#tabs", Tabs)
tabs.active = "tab-headers"
await pilot.pause(0.1)
assert app.query_one("#tab-headers-pane").display is True
+ assert app.query_one("#tab-body-pane").display is False
+
+ # Input headers into headers editor
+ headers_input = app.query_one("#headers-input", TextArea)
+ headers_input.text = "Authorization: Bearer my-ui-token\nX-Client: Ghostman"
# Save current request with headers
app.query_one("#url-input", Input).value = "https://httpbin.org/headers"
@@ -233,7 +227,7 @@ async def test_tui_headers_and_ssl_controls():
await pilot.pause(0.1)
assert app.query_one("#headers-input", TextArea).text == ""
- print(" [+] TUI Headers & SSL Controls: PASS")
+ print(" [+] TUI Headers & GUI State: PASS")
async def main():