fix: use window.location.href for nostrsigner: URLs instead of window.open(_system)
window.open(_system) was stripping query parameters from the nostrsigner: URL, causing Amber to receive a request with no type parameter and rejecting it as malformed. window.location.href works correctly in Capacitor WebView — Android intercepts nostrsigner: scheme via intent-filter with full URL intact. Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
This commit is contained in:
parent
55856e2935
commit
fdebfc0d37
1 changed files with 6 additions and 10 deletions
|
|
@ -290,18 +290,14 @@ function buildCallbackUrl(): string {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigate to an Amber nostrsigner: URL.
|
* Navigate to an Amber nostrsigner: URL.
|
||||||
* In Capacitor WebViews, window.location.href causes a "malformed request"
|
*
|
||||||
* error because the WebView tries to navigate instead of firing an intent.
|
* Use window.location.href for all platforms — Android handles the
|
||||||
* Use window.open() with _system target to hand off to Android properly.
|
* nostrsigner: custom scheme via intent-filter regardless of whether
|
||||||
|
* we're in a WebView or browser. window.open(_system) was stripping
|
||||||
|
* query parameters causing Amber to receive a malformed request.
|
||||||
*/
|
*/
|
||||||
function openAmberUrl(url: string): void {
|
function openAmberUrl(url: string): void {
|
||||||
// Capacitor / Android WebView: use _system to fire the intent
|
window.location.href = url;
|
||||||
const isCapacitor = !!(window as unknown as { Capacitor?: { isNativePlatform?: () => boolean } }).Capacitor?.isNativePlatform?.();
|
|
||||||
if (isCapacitor) {
|
|
||||||
window.open(url, '_system');
|
|
||||||
} else {
|
|
||||||
window.location.href = url;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue