@konemono/nostr-login 1.9.3 → 1.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +1 -1
- package/dist/unpkg.js +1 -1
- package/package.json +1 -1
- package/src/modules/AmberDirectSigner.ts +10 -4
package/package.json
CHANGED
|
@@ -126,10 +126,9 @@ export class AmberDirectSigner implements Signer {
|
|
|
126
126
|
const baseUrl = window.location.href.split('#')[0].split('?')[0];
|
|
127
127
|
const encodedContent = encodeURIComponent(content || '');
|
|
128
128
|
|
|
129
|
-
// callbackUrl にはベースURL
|
|
130
|
-
// Amber
|
|
131
|
-
const callbackUrl =
|
|
132
|
-
const encodedCallback = encodeURIComponent(callbackUrl);
|
|
129
|
+
// callbackUrl にはベースURLだけを渡す
|
|
130
|
+
// Amberが自動的に ?event=<result> を追加する (NIP-55)
|
|
131
|
+
const callbackUrl = baseUrl;
|
|
133
132
|
|
|
134
133
|
localStorage.setItem('amber_last_type', type);
|
|
135
134
|
localStorage.setItem('amber_last_id', id);
|
|
@@ -171,6 +170,13 @@ export class AmberDirectSigner implements Signer {
|
|
|
171
170
|
// パターン1: NIP-55標準 (?event=...)
|
|
172
171
|
let result = url.searchParams.get('event');
|
|
173
172
|
|
|
173
|
+
// Amberが壊れた{result}プレースホルダーを返した場合のクリーンアップ
|
|
174
|
+
// 例: ?event=result}5650178... → 5650178...
|
|
175
|
+
if (result && result.includes('result}')) {
|
|
176
|
+
result = result.replace(/^result\}/, '');
|
|
177
|
+
console.log('[AmberDirectSigner] Cleaned up malformed result:', result);
|
|
178
|
+
}
|
|
179
|
+
|
|
174
180
|
// パターン2: パス末尾にhexId (/<hexId>)
|
|
175
181
|
if (!result) {
|
|
176
182
|
const pathParts = url.pathname.split('/').filter(Boolean);
|