Skip to content

Commit 5876e37

Browse files
Copexitclaude
andcommitted
fix: context-aware .onion hint in API settings
When already on the .onion site, only show CORS reminder instead of the confusing "Ensure you are using Tor Browser" message. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ef79ae5 commit 5876e37

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/lib/api/url-diagnostics.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,13 @@ export function diagnoseUrl(url: string): UrlDiagnostic {
7676
"Your browser blocks HTTP requests from this HTTPS page. " +
7777
"Set up HTTPS on your node, or use SSH port forwarding to localhost.";
7878
} else if (result.isOnion) {
79-
result.hint =
80-
"Ensure you are using Tor Browser to reach .onion addresses. " +
81-
"Your node also needs CORS headers for cross-origin requests.";
79+
const pageIsOnion =
80+
typeof window !== "undefined" &&
81+
window.location.hostname.endsWith(".onion");
82+
result.hint = pageIsOnion
83+
? "Your node needs CORS headers to allow cross-origin requests."
84+
: "Ensure you are using Tor Browser to reach .onion addresses. " +
85+
"Your node also needs CORS headers for cross-origin requests.";
8286
}
8387

8488
return result;

0 commit comments

Comments
 (0)