@konemono/nostr-login 1.15.3 → 1.15.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@konemono/nostr-login",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.4",
|
|
4
4
|
"description": "Extended fork of nostr-login with multi-relay support, QR scanner, and improved stability",
|
|
5
5
|
"main": "./dist/index.esm.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"tseep": "^1.2.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@konemono/nostr-login-components": "^1.4.
|
|
30
|
+
"@konemono/nostr-login-components": "^1.4.4",
|
|
31
31
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
32
32
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
33
33
|
"@rollup/plugin-terser": "^0.4.4",
|
|
@@ -144,7 +144,21 @@ class AuthNostrService extends EventEmitter implements Signer {
|
|
|
144
144
|
) {
|
|
145
145
|
console.log('[nostrConnect] Called', { relay, domain, link, iframeUrl, importConnect, customRelays });
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
// linkのnostrconnect URLからリレーヒントを抽出
|
|
148
|
+
let linkRelays: string[] = [];
|
|
149
|
+
if (link) {
|
|
150
|
+
try {
|
|
151
|
+
const ncMatch = link.match(/nostrconnect:\/\/[^?]*\?(.*)/);
|
|
152
|
+
if (ncMatch) {
|
|
153
|
+
const params = new URLSearchParams(ncMatch[1]);
|
|
154
|
+
linkRelays = params.getAll('relay');
|
|
155
|
+
}
|
|
156
|
+
} catch (e) {
|
|
157
|
+
console.warn('[nostrConnect] Failed to parse relay hints from link', e);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const relays = customRelays && customRelays.length > 0 ? customRelays : linkRelays.length > 0 ? linkRelays : relay ? [relay] : DEFAULT_NIP46_RELAYS;
|
|
148
162
|
|
|
149
163
|
const info: Info = {
|
|
150
164
|
authMethod: 'connect',
|
|
@@ -264,7 +278,11 @@ class AuthNostrService extends EventEmitter implements Signer {
|
|
|
264
278
|
|
|
265
279
|
await Promise.all(fetchPromises);
|
|
266
280
|
|
|
267
|
-
|
|
281
|
+
// QRコード用のnostrconnect URLにもリレーヒントを付与
|
|
282
|
+
const relayParams = defaultRelays.map(r => `&relay=${encodeURIComponent(r)}`).join('');
|
|
283
|
+
const nostrconnectWithRelays = nostrconnect + relayParams;
|
|
284
|
+
|
|
285
|
+
return [nostrconnectWithRelays, apps];
|
|
268
286
|
}
|
|
269
287
|
|
|
270
288
|
public async localSignup(name: string, sk?: string) {
|